Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as ReachUI from '@reach/menu-button'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import React from 'react'
import { ErrorMsg, Label } from './TextInput'
import SelectorCaret from '../icons/SelectorCaret'
const MenuButton = styled(ReachUI.MenuButton)`
background-color: ${p => p.theme.colors.translucentPrimary};
color: ${p => p.theme.colors.light};
font-size: 1.3rem;
font-weight: 600;
letter-spacing: 0.5px;
text-shadow: ${p => p.theme.textShadow};
padding: 0;
border: none;
display: block;
height: 4.8rem;
text-align: left;
width: 100%;
line-height: 4rem;
margin-top: 0.8rem;
cursor: pointer;
display: flex;
z-index: 4;
width: 168px;
}
`
const Title = styled.div`
color: ${({ theme }) => theme.colors.light};
font-size: 0.9rem;
letter-spacing: 1.6px;
font-weight: 600;
opacity: 0.5;
margin-bottom: 0.8rem;
margin-left: 0.6rem;
`
const MenuButton = styled(ReachUI.MenuButton)`
background-color: ${({ theme }) => theme.colors.lightShade};
font: inherit;
color: ${({ theme }) => theme.colors.light};
border-radius: 1.2rem;
border: none;
text-align: left;
display: block;
width: 100%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: space-between;
padding: 1rem 0.4rem 1rem 0.8rem;
transition: padding 0.3s;
&:focus,
svg {
fill: ${p => p.theme.colors.primary};
}
}
[disabled] & {
opacity: 0.25;
}
`
const MenuList = styled(ReachUI.MenuList)`
background-color: ${p => p.theme.colors.light};
padding: 1.6rem 0;
`
const MenuItem = styled(ReachUI.MenuItem)`
color: ${p => p.theme.colors.copy};
font-size: 1.3rem;
font-weight: 600;
letter-spacing: 0.5px;
padding: 1.2rem 1.6rem;
&[data-selected] {
background-color: rgba(126, 97, 248, 0.1);
color: ${p => p.theme.colors.primary};
outline: none;
}
`
export default class Selector extends React.Component {
static propTypes = {
'data-testid': PropTypes.string,
padding: 1.6rem 1.2rem;
`};
`
const MenuList = styled(ReachUI.MenuList)`
box-shadow: 0 0 32px 0 rgba(0, 0, 0, 0.4);
background-color: ${({ theme }) => theme.colors.dark};
display: block;
white-space: nowrap;
outline: none;
overflow: hidden;
border-radius: 1.2rem;
transform: translateY(-56px);
`
const MenuItem = styled(ReachUI.MenuItem)`
background-color: ${({ theme }) => theme.colors.lightShade};
display: block;
cursor: pointer;
padding: 1.6rem 1.2rem;
display: flex;
align-items: center;
justify-content: space-between;
&[data-selected] {
background-color: ${({ theme }) => theme.colors.translucentPrimary};
outline: none;
}
@media (min-width: 800px) {
justify-content: center;
}
[aria-expanded='true'] & {
background-color: ${p => p.theme.colors.light};
box-shadow: 0 -1px 0 0 ${p => p.theme.colors.dark} inset;
svg {
fill: ${p => p.theme.colors.primary};
}
}
[disabled] & {
opacity: 0.25;
}
`
const MenuList = styled(ReachUI.MenuList)`
background-color: ${p => p.theme.colors.light};
padding: 1.6rem 0;
`
const MenuItem = styled(ReachUI.MenuItem)`
color: ${p => p.theme.colors.copy};
font-size: 1.3rem;
font-weight: 600;
letter-spacing: 0.5px;
padding: 1.2rem 1.6rem;
&[data-selected] {
background-color: rgba(126, 97, 248, 0.1);
color: ${p => p.theme.colors.primary};
outline: none;
}
&:hover {
background-color: ${({ theme }) => theme.colors.darkShade};
outline: none;
}
&[aria-expanded='true'] {
visibility: hidden;
}
${wideOrHover`
justify-content: center;
padding: 1.6rem 1.2rem;
`};
`
const MenuList = styled(ReachUI.MenuList)`
box-shadow: 0 0 32px 0 rgba(0, 0, 0, 0.4);
background-color: ${({ theme }) => theme.colors.dark};
display: block;
white-space: nowrap;
outline: none;
overflow: hidden;
border-radius: 1.2rem;
transform: translateY(-56px);
`
const MenuItem = styled(ReachUI.MenuItem)`
background-color: ${({ theme }) => theme.colors.lightShade};
display: block;
cursor: pointer;
padding: 1.6rem 1.2rem;
display: flex;