Skip to content

Commit f929327

Browse files
committed
Fix Checkbox component
1 parent bdd5c39 commit f929327

File tree

1 file changed

+13
-22
lines changed
  • packages/components/src/components/Checkbox

1 file changed

+13
-22
lines changed

packages/components/src/components/Checkbox/index.tsx

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,7 @@ export function Checkbox({
3737
}
3838

3939
return (
40-
<Flex
41-
className={css({
42-
alignItems: 'center',
43-
gap: '8px',
44-
})}
45-
>
40+
<Flex alignItems="center" gap="8px">
4641
<label
4742
className={css({
4843
position: 'relative',
@@ -85,50 +80,46 @@ export function Checkbox({
8580
bg="var(--inputBg, light-dark(#FFF, #2E2E2E))"
8681
border="1px solid var(--border, light-dark(#E0E0E0, #333333))"
8782
borderRadius="2px"
88-
checked={checked}
89-
className={css({
90-
position: 'absolute',
91-
top: 0,
92-
left: 0,
93-
width: '100%',
94-
height: '100%',
95-
opacity: 1,
96-
zIndex: 0,
97-
pointerEvents: 'none',
98-
})}
83+
checked={isChecked}
9984
cursor={disabled ? 'not-allowed' : 'pointer'}
10085
disabled={disabled}
10186
display="block"
87+
height="100%"
10288
id={generateId}
89+
left={0}
10390
m="0"
10491
onChange={
10592
disabled ? undefined : (e) => handleChange(e.target.checked)
10693
}
94+
opacity={1}
95+
pointerEvents="none"
96+
pos="absolute"
10797
styleOrder={1}
10898
styleVars={{
10999
primary: colors?.primary,
110100
border: colors?.border,
111101
inputBg: colors?.inputBg,
112102
}}
103+
top={0}
113104
type="checkbox"
105+
width="100%"
106+
zIndex={0}
114107
{...props}
115108
/>
116109
{isChecked && (
117110
<Box
118111
as={CheckIcon}
112+
opacity="1"
113+
pointerEvents="none"
119114
props={{
120115
color: disabled
121116
? 'light-dark(#D6D7DE, #47474A)'
122117
: 'var(--checkIcon, #FFF)',
123-
className: css({
124-
pointerEvents: 'none',
125-
opacity: 1,
126-
zIndex: 1,
127-
}),
128118
}}
129119
styleVars={{
130120
checkIcon: colors?.checkIcon,
131121
}}
122+
zIndex="1"
132123
/>
133124
)}
134125
</label>

0 commit comments

Comments
 (0)