Skip to content

Commit d32aff3

Browse files
author
Marcella Malune
committed
moved styles from objects to tags
1 parent a7dd671 commit d32aff3

File tree

1 file changed

+34
-41
lines changed

1 file changed

+34
-41
lines changed

src/components/Checkbox.tsx

Lines changed: 34 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -22,48 +22,41 @@ const Checkbox: React.FC<IProps> = ({
2222
callback()
2323
}
2424
}
25-
26-
const checkboxContainerAttributes = {
27-
display: "inline-block",
28-
verticalAlign: "middle",
29-
className: className,
30-
onClick: handleClick,
31-
}
32-
33-
const hiddenCheckboxAttributes = {
34-
type: "checkbox",
35-
checked: checked,
36-
readOnly: true,
37-
...rest,
38-
}
39-
40-
const styledCheckboxAttributes = {
41-
"aria-hidden": true,
42-
className: "styled-checkbox",
43-
display: "inline-block",
44-
w: `${size}rem`,
45-
h: `${size}rem`,
46-
minW: `${size}rem`,
47-
bg: `${checked ? "primary400" : "background"}`,
48-
border: "1px",
49-
borderStyle: "solid",
50-
borderColor: "black50",
51-
borderRadius: "3px",
52-
transition: "all 150ms",
53-
_hover: {
54-
boxShadow: "tableItemBoxShadow",
55-
border: "1px",
56-
borderStyle: "solid",
57-
borderColor: "primary600",
58-
transition: "transform 0.1s",
59-
transform: "scale(1.02)",
60-
},
61-
}
62-
6325
return (
64-
<Box {...checkboxContainerAttributes}>
65-
<VisuallyHiddenInput {...hiddenCheckboxAttributes} />
66-
<Box {...styledCheckboxAttributes}>
26+
<Box
27+
display="inline-block"
28+
verticalAlign="middle"
29+
className={className}
30+
onClick={handleClick}
31+
>
32+
<VisuallyHiddenInput
33+
type="checkbox"
34+
checked={checked}
35+
readOnly
36+
{...rest}
37+
/>
38+
<Box
39+
aria-hidden={true}
40+
className="styled-checkbox"
41+
display="inline-block"
42+
w={`${size}rem`}
43+
h={`${size}rem`}
44+
minW={`${size}rem`}
45+
bg={`${checked ? "primary400" : "background"}`}
46+
border="1px"
47+
borderStyle="solid"
48+
borderColor="black50"
49+
borderRadius="3px"
50+
transition="all 150ms"
51+
_hover={{
52+
boxShadow: "tableItemBoxShadow",
53+
border: "1px",
54+
borderStyle: "solid",
55+
borderColor: "primary600",
56+
transition: "transform 0.1s",
57+
transform: "scale(1.02)",
58+
}}
59+
>
6760
<svg
6861
viewBox="0 0 24 24"
6962
fill="none"

0 commit comments

Comments
 (0)