Skip to content

Commit

Permalink
chore: clean up CheckBox.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
beheh committed Aug 22, 2023
1 parent 18a1472 commit 6ece942
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/utils/CheckBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface Props {
onChange: (checked: boolean) => void;
}

const Container = styled.div<{ disabled?: boolean }>`
const Container = styled.label<{ disabled?: boolean }>`
display: flex;
color: rgba(255, 255, 255, ${(props) => (props.disabled ? 0.5 : 1)});
`;
Expand All @@ -30,9 +30,20 @@ export default class CheckBox extends React.Component<Props> {
return (
<Container
onClick={() => !disabled && onChange(!checked)}
onDoubleClick={(event) => {
// prevent Twitch fullscreen when clicked
event.stopPropagation();
}}
disabled={disabled}
>
<Box disabled={disabled}>{checked ? "✔" : ""}</Box>
<Box
disabled={disabled}
role="checkbox"
aria-checked={checked}
aria-disabled={disabled}
>
{checked ? "✔" : ""}
</Box>
{label}
</Container>
);
Expand Down

0 comments on commit 6ece942

Please sign in to comment.