File size: 1,135 Bytes
f23825d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import styled from "@emotion/styled"
import ArrowDropDown from "mdi-react/ArrowDropDownIcon"
import { DetailedHTMLProps, FC } from "react"

const StyledSelect = styled.select`
  display: block;
  width: 100%;
  appearance: none;
  border: none;
  background: inherit;
  border: 1px solid ${({ theme }) => theme.dividerColor};
  border-radius: 0.25rem;
  height: 3rem;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  color: inherit;
  font-size: 1rem;
  font-family: inherit;
  outline: none;

  &:focus {
    border-color: ${({ theme }) => theme.themeColor};
  }

  option {
    color: ${({ theme }) => theme.textColor};
    background: ${({ theme }) => theme.backgroundColor};
  }
`

const Arrow = styled(ArrowDropDown)`
  position: absolute;
  right: 0.5rem;
  top: 0.8rem;
  pointer-events: none;
`

const Wrapper = styled.div`
  position: relative;
`

export const Select: FC<
  DetailedHTMLProps<
    React.SelectHTMLAttributes<HTMLSelectElement>,
    HTMLSelectElement
  >
> = (props) => (
  <Wrapper>
    <StyledSelect {...props} />
    <Arrow />
  </Wrapper>
)