forked from tdjsnelling/sqtracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelect.js
More file actions
55 lines (52 loc) · 1.28 KB
/
Copy pathSelect.js
File metadata and controls
55 lines (52 loc) · 1.28 KB
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
import React from "react";
import styled from "styled-components";
import { layout, space, typography } from "styled-system";
import css from "@styled-system/css";
import { ChevronDown } from "@styled-icons/boxicons-regular";
import Box from "./Box";
import { WrapLabel } from "./Input";
const StyledSelect = styled.select(
() =>
css({
appearance: "none",
display: "block",
bg: "sidebar",
color: "text",
border: "2px solid",
borderColor: "sidebar",
borderRadius: 1,
fontFamily: "body",
fontSize: 2,
pl: 4,
pr: 6,
py: 3,
"&:focus": {
borderColor: "primary",
outline: 0,
},
}),
layout,
space,
typography
);
const Select = ({ label, required, fRef, ...rest }) => {
return (
<WrapLabel label={label && required ? `${label} *` : label}>
<Box position="relative" display="inline-block">
<StyledSelect {...rest} ref={fRef} required={required} />
<Box
position="absolute"
top="7px"
right={4}
color="grey"
_css={{ pointerEvents: "none" }}
>
<ChevronDown size={22} />
</Box>
</Box>
</WrapLabel>
);
};
export default React.forwardRef((props, ref) => (
<Select {...props} fRef={ref} />
));