Skip to content

Commit 6d76ce3

Browse files
authored
Merge pull request #49 from make-software/task/adjust-checkbox-and-radiobutton-to-design
update inactive styles for checkbox and radio button
2 parents e1658ea + 117057b commit 6d76ce3

7 files changed

Lines changed: 58 additions & 28 deletions

File tree

dist/cspr-design.es.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35734,7 +35734,7 @@ const k8 = (e, o) => ({
3573435734
fill: o && !g ? e.styleguideColors.backgroundPrimary : o && g ? e.styleguideColors.contentQuaternary : "none"
3573535735
},
3573635736
rect: {
35737-
stroke: g ? e.styleguideColors.contentQuaternary : A || e.styleguideColors.contentBlue
35737+
stroke: g ? e.styleguideColors.contentQuaternary : A || e.styleguideColors.contentQuaternary
3573835738
}
3573935739
},
3574035740
span: {
@@ -39693,15 +39693,16 @@ const Iv = be.div.withConfig({
3969339693
componentId: "sc-1c62lye-1"
3969439694
})(({
3969539695
theme: e,
39696-
disabled: o,
39697-
size: g,
39698-
color: C = "contentBlue"
39696+
unselected: o,
39697+
disabled: g,
39698+
size: C,
39699+
color: A = "contentBlue"
3969939700
}) => ({
39700-
width: g,
39701-
height: g,
39702-
minWidth: g,
39703-
minHeight: g,
39704-
border: o ? `2px solid ${e.styleguideColors.contentQuaternary}` : `2px solid ${e.styleguideColors[C]}`,
39701+
width: C,
39702+
height: C,
39703+
minWidth: C,
39704+
minHeight: C,
39705+
border: g || o ? `2px solid ${e.styleguideColors.contentQuaternary}` : `2px solid ${e.styleguideColors[A]}`,
3970539706
borderRadius: "50%",
3970639707
display: "flex",
3970739708
justifyContent: "center",
@@ -39731,7 +39732,7 @@ const Iv = be.div.withConfig({
3973139732
}) => /* @__PURE__ */ Pe(Nv, { onClick: () => {
3973239733
o && o(C);
3973339734
}, children: [
39734-
/* @__PURE__ */ $(Lv, { disabled: A, color: x, size: r, children: /* @__PURE__ */ $(Rv, { unslected: C !== e, disabled: A, color: x }) }),
39735+
/* @__PURE__ */ $(Lv, { disabled: A, unselected: C !== e, color: x, size: r, children: /* @__PURE__ */ $(Rv, { unslected: C !== e, disabled: A, color: x }) }),
3973539736
g
3973639737
] }), Bv = {
3973739738
keybase: Jf,

dist/cspr-design.umd.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/lib/components/radio-button/radio-button.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/components/checkbox/checkbox.stories.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ const Template: StoryFn<typeof Checkbox> = (args) => (
2222
<FlexColumn itemsSpacing={10}>
2323
<Checkbox checked disabled label="disabled" />
2424
</FlexColumn>
25+
<FlexColumn itemsSpacing={10}>
26+
<Checkbox checked={false} label="case 1" />
27+
<Checkbox checked={true} label="case 2" />
28+
<Checkbox checked={false} label="case 3" />
29+
</FlexColumn>
2530
</FlexRow>
2631
);
2732

src/lib/components/checkbox/checkbox.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,30 @@ const StyledFlexRow = styled(FlexRow)<{
2626
checked && !disabled && customCheckedColor
2727
? customCheckedColor
2828
: checked && !disabled
29-
? theme.styleguideColors.contentBlue
30-
: 'none',
29+
? theme.styleguideColors.contentBlue
30+
: 'none',
3131
path: {
3232
fill:
3333
checked && !disabled
3434
? theme.styleguideColors.backgroundPrimary
3535
: checked && disabled
36-
? theme.styleguideColors.contentQuaternary
37-
: 'none',
36+
? theme.styleguideColors.contentQuaternary
37+
: 'none',
3838
},
3939
rect: {
4040
stroke: disabled
4141
? theme.styleguideColors.contentQuaternary
4242
: customUncheckedColor
43-
? customUncheckedColor
44-
: theme.styleguideColors.contentBlue,
43+
? customUncheckedColor
44+
: theme.styleguideColors.contentQuaternary,
4545
},
4646
},
4747
span: {
4848
color: disabled
4949
? theme.styleguideColors.contentQuaternary
5050
: theme.styleguideColors.contentPrimary,
5151
},
52-
})
52+
}),
5353
);
5454

5555
export enum CheckboxFontSize {
@@ -107,16 +107,16 @@ export function Checkbox({
107107
disabled={disabled}
108108
onClick={handleClick}
109109
onKeyDown={(ev) => {
110-
if(ev.key === 'Enter'){
111-
handleClick(ev)
110+
if (ev.key === 'Enter') {
111+
handleClick(ev);
112112
}
113113
}}
114114
customCheckedColor={customCheckedColor}
115115
customUncheckedColor={customUncheckedColor}
116116
role="checkbox"
117117
aria-checked={checked}
118118
aria-disabled={disabled}
119-
aria-label={checked ? "Checked" : "Not checked"}
119+
aria-label={checked ? 'Checked' : 'Not checked'}
120120
tabIndex={0}
121121
>
122122
<SvgIcon src={iconSrc} />

src/lib/components/radio-button/radio-button.stories.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ const Template: StoryFn<typeof RadioButton> = (args) => (
3131
<FlexColumn itemsSpacing={20}>
3232
<RadioButton {...args} />
3333
<RadioButton {...args} label={'Mainnet'} size={12} />
34+
<RadioButton {...args} label={'Mainnet'} size={12} disabled />
35+
</FlexColumn>
36+
<FlexColumn>
37+
<RadioButton
38+
value={'1'}
39+
selected={'2'}
40+
disabled={false}
41+
label={'case 1'}
42+
size={12}
43+
/>
44+
<RadioButton
45+
value={'2'}
46+
selected={'2'}
47+
disabled={false}
48+
label={'case 2'}
49+
size={12}
50+
/>
3451
</FlexColumn>
3552
</FlexRow>
3653
);

src/lib/components/radio-button/radio-button.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@ const OuterCircle = styled.div<{
2323
disabled?: boolean;
2424
color?: string;
2525
size: number;
26-
}>(({ theme, disabled, size, color = 'contentBlue' }) => ({
26+
unselected?: boolean;
27+
}>(({ theme, unselected, disabled, size, color = 'contentBlue' }) => ({
2728
width: size,
2829
height: size,
2930
minWidth: size,
3031
minHeight: size,
31-
border: disabled
32-
? `2px solid ${theme.styleguideColors.contentQuaternary}`
33-
: `2px solid ${theme.styleguideColors[color]}`,
32+
border:
33+
disabled || unselected
34+
? `2px solid ${theme.styleguideColors.contentQuaternary}`
35+
: `2px solid ${theme.styleguideColors[color]}`,
3436
borderRadius: '50%',
3537
display: 'flex',
3638
justifyContent: 'center',
@@ -66,7 +68,12 @@ export const RadioButton = ({
6668
onChange && onChange(value);
6769
}}
6870
>
69-
<OuterCircle disabled={disabled} color={color} size={size}>
71+
<OuterCircle
72+
disabled={disabled}
73+
unselected={value !== selected}
74+
color={color}
75+
size={size}
76+
>
7077
<InnerCircle
7178
unslected={value !== selected}
7279
disabled={disabled}

0 commit comments

Comments
 (0)