Skip to content

Commit 8aa03d7

Browse files
committed
feat(radio): migrate to semantic colors
1 parent 37c9df5 commit 8aa03d7

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

src/components/RadioButton/components/Checkmark.tsx

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styled from 'styled-components';
2-
import { Colors } from '../../../essentials';
2+
import { getSemanticValue } from '../../../utils/cssVariables';
33

44
interface CheckmarkProps {
55
error?: boolean;
@@ -17,8 +17,8 @@ const Checkmark = styled.input<CheckmarkProps>`
1717
padding: 0;
1818
margin: 0 0.5rem 0 0;
1919
20-
background-color: ${Colors.WHITE};
21-
box-shadow: inset 0 0 0 0.125rem ${props => (props.error ? Colors.NEGATIVE_ORANGE_900 : Colors.AUTHENTIC_BLUE_200)};
20+
background-color: ${getSemanticValue('background-primary-default')};
21+
box-shadow: inset 0 0 0 0.125rem ${props => getSemanticValue(props.error ? 'border-danger-emphasized' : 'border-primary-default')};
2222
border-radius: 50%;
2323
transition: background-color 100ms, box-shadow 100ms;
2424
cursor: pointer;
@@ -41,7 +41,7 @@ const Checkmark = styled.input<CheckmarkProps>`
4141
4242
&:checked {
4343
box-shadow: inset 0 0 0 0.3125rem
44-
${props => (props.error ? Colors.NEGATIVE_ORANGE_900 : Colors.ACTION_BLUE_900)};
44+
${props => getSemanticValue(props.error ? 'border-danger-emphasized' : 'border-info-emphasized')};
4545
4646
&::after {
4747
opacity: 1;
@@ -52,20 +52,20 @@ const Checkmark = styled.input<CheckmarkProps>`
5252
5353
&:disabled {
5454
cursor: not-allowed;
55-
background-color: ${Colors.AUTHENTIC_BLUE_50};
56-
box-shadow: inset 0 0 0 0.125rem ${Colors.AUTHENTIC_BLUE_50};
55+
background-color: ${getSemanticValue('background-tertiary-disabled')};
56+
box-shadow: inset 0 0 0 0.125rem ${getSemanticValue('background-tertiary-disabled')};
5757
5858
&:hover {
59-
box-shadow: inset 0 0 0 0.125rem ${Colors.AUTHENTIC_BLUE_50};
59+
box-shadow: inset 0 0 0 0.125rem ${getSemanticValue('background-tertiary-disabled')};
6060
}
6161
6262
&:active {
63-
background-color: ${Colors.AUTHENTIC_BLUE_50};
63+
background-color: ${getSemanticValue('background-tertiary-disabled')};
6464
}
6565
6666
&:checked {
67-
box-shadow: inset 0 0 0 0.3125rem ${Colors.AUTHENTIC_BLUE_50};
68-
background-color: ${Colors.WHITE};
67+
box-shadow: inset 0 0 0 0.3125rem ${getSemanticValue('background-tertiary-disabled')};
68+
background-color: ${getSemanticValue('background-primary-default')};
6969
}
7070
}
7171
`;

src/components/RadioButton/components/LabelWrapper.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import styled, { css } from 'styled-components';
22
import { compose, margin, MarginProps, variant } from 'styled-system';
33

4-
import { Colors } from '../../../essentials';
4+
import { getSemanticValue } from '../../../utils/cssVariables';
55
import { theme } from '../../../essentials/theme';
66
import { get } from '../../../utils/themeGet';
77
import { RadioButtonProps } from '../RadioButtonProps';
@@ -39,12 +39,12 @@ const hoverStyle = ({ disabled, error }: LabelWrapperProps) => {
3939
cursor: pointer;
4040
4141
& ${/* sc-selector */ TapArea}:not(:active) {
42-
background-color: ${error ? Colors.NEGATIVE_ORANGE_50 : Colors.ACTION_BLUE_50};
42+
background-color: ${getSemanticValue(error ? 'background-danger-default' : 'background-info-default')};
4343
}
4444
4545
& ${/* sc-selector */ Checkmark}:not(:checked) {
46-
box-shadow: inset 0 0 0 0.125rem ${error ? Colors.NEGATIVE_ORANGE_900 : Colors.ACTION_BLUE_900};
47-
background-color: ${Colors.WHITE};
46+
box-shadow: inset 0 0 0 0.125rem ${getSemanticValue(error ? 'border-danger-emphasized' : 'border-info-emphasized')};
47+
background-color: ${getSemanticValue('background-primary-default')};
4848
}
4949
`;
5050
};
@@ -55,7 +55,7 @@ const LabelWrapper = styled.label.attrs({ theme })<LabelWrapperProps>`
5555
position: relative;
5656
user-select: none;
5757
58-
color: ${props => (props.disabled ? Colors.AUTHENTIC_BLUE_350 : Colors.AUTHENTIC_BLUE_900)};
58+
color: ${props => getSemanticValue(props.disabled ? 'text-disabled' : 'text-primary')};
5959
6060
font-family: ${get('fonts.normal')};
6161
line-height: 1;

src/components/RadioButton/components/TapArea.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styled from 'styled-components';
2-
import { Colors } from '../../../essentials';
2+
import { getSemanticValue } from '../../../utils/cssVariables';
33

44
const TapArea = styled.div`
55
position: absolute;
@@ -12,7 +12,7 @@ const TapArea = styled.div`
1212
transition: background-color 125ms;
1313
1414
&:active {
15-
background-color: ${Colors.AUTHENTIC_BLUE_50};
15+
background-color: ${getSemanticValue('background-secondary-default')};
1616
}
1717
`;
1818

0 commit comments

Comments
 (0)