Skip to content

Commit

Permalink
fix disabled checkbox style
Browse files Browse the repository at this point in the history
  • Loading branch information
zoran995 committed Apr 26, 2021
1 parent 3e53c15 commit 8566f8e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
14 changes: 10 additions & 4 deletions lib/Styled/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const Checkbox = memo(
const id = useUID();
return (
<TextSpan
as={"label"}
css={`
display: flex;
flex-shrink: 0;
Expand All @@ -59,9 +58,16 @@ const Checkbox = memo(
//copy the global focus
outline: 3px solid #c390f9;
}
&:hover svg {
opacity: 0.6;
}
${!isDisabled &&
`
&:hover svg {
opacity: 0.6;
}
`}
${isDisabled &&
`
cursor: not-allowed;
`}
`}
>
<HiddenCheckbox
Expand Down
13 changes: 9 additions & 4 deletions lib/Styled/Checkbox/Elements/CheckboxIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ import { CheckboxIconProps } from "../types";

const StyledCheckboxIcon = styled(StyledIcon).attrs({
styledWidth: "1em"
})`
})<{ disabled?: boolean }>`
top: 0.125em;
align-self: flex-start;
position: relative;
fill: currentColor;
&:hover {
opacity: 0.6;
}
${props =>
!props.disabled &&
`
&:hover {
opacity: 0.6;
}
`}
`;

const CheckboxIcon: React.FC<CheckboxIconProps> = (
Expand All @@ -22,6 +26,7 @@ const CheckboxIcon: React.FC<CheckboxIconProps> = (
return (
<StyledCheckboxIcon
glyph={GLYPHS.checkboxOff}
disabled
css={`
opacity: 0.3;
`}
Expand Down
3 changes: 2 additions & 1 deletion lib/Styled/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ export const Text = styled.div<ITextProps>`
props.isDisabled &&
`
opacity: 0.3;
`}
cursor: not-allowed;
`}
${props => props.overflowHide && ` overflow: hidden;`}
${props => props.overflowEllipsis && ` text-overflow: ellipsis;`}
Expand Down

0 comments on commit 8566f8e

Please sign in to comment.