Skip to content

Commit bf9cd5e

Browse files
committed
add custom size for radio button
Signed-off-by: Evgeniy Bilov <eugenebelov@users.noreply.github.com>
1 parent 91a3e97 commit bf9cd5e

6 files changed

Lines changed: 39 additions & 32 deletions

File tree

dist/cspr-design.es.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39694,13 +39694,14 @@ const Iv = be.div.withConfig({
3969439694
})(({
3969539695
theme: e,
3969639696
disabled: o,
39697-
color: g = "contentBlue"
39697+
size: g,
39698+
color: C = "contentBlue"
3969839699
}) => ({
39699-
width: 24,
39700-
height: 24,
39701-
minWidth: 24,
39702-
minHeight: 24,
39703-
border: o ? `2px solid ${e.styleguideColors.contentQuaternary}` : `2px solid ${e.styleguideColors[g]}`,
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]}`,
3970439705
borderRadius: "50%",
3970539706
display: "flex",
3970639707
justifyContent: "center",
@@ -39716,20 +39717,21 @@ const Iv = be.div.withConfig({
3971639717
color: C = "contentBlue"
3971739718
}) => ({
3971839719
borderRadius: "50%",
39719-
width: o ? 0 : 12,
39720-
height: o ? 0 : 12,
39720+
width: o ? 0 : "70%",
39721+
height: o ? 0 : "70%",
3972139722
backgroundColor: g ? e.styleguideColors.contentQuaternary : e.styleguideColors[C]
3972239723
})), R_ = ({
3972339724
selected: e,
3972439725
onChange: o,
3972539726
label: g,
3972639727
value: C,
3972739728
disabled: A,
39728-
color: x
39729+
color: x,
39730+
size: r = 24
3972939731
}) => /* @__PURE__ */ Pe(Nv, { onClick: () => {
3973039732
o && o(C);
3973139733
}, children: [
39732-
/* @__PURE__ */ $(Lv, { disabled: A, color: x, children: /* @__PURE__ */ $(Rv, { unslected: C !== e, disabled: A, color: x }) }),
39734+
/* @__PURE__ */ $(Lv, { disabled: A, color: x, size: r, children: /* @__PURE__ */ $(Rv, { unslected: C !== e, disabled: A, color: x }) }),
3973339735
g
3973439736
] }), Bv = {
3973539737
keybase: Jf,

dist/cspr-design.umd.js

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

dist/lib/components/confirmation-window/confirmation-window.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.

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/radio-button/radio-button.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const Template: StoryFn<typeof RadioButton> = (args) => (
3030
<FlexRow itemsSpacing={30}>
3131
<FlexColumn itemsSpacing={20}>
3232
<RadioButton {...args} />
33+
<RadioButton {...args} label={'Mainnet'} size={12} />
3334
</FlexColumn>
3435
</FlexRow>
3536
);

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

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface RadioButtonProps extends BaseProps {
99
value: string;
1010
color?: string;
1111
disabled?: boolean;
12+
size: number;
1213
}
1314

1415
const Container = styled.div(({ theme }) => ({
@@ -18,31 +19,33 @@ const Container = styled.div(({ theme }) => ({
1819
userSelect: 'none',
1920
}));
2021

21-
const OuterCircle = styled.div<{ disabled?: boolean; color?: string }>(
22-
({ theme, disabled, color = 'contentBlue' }) => ({
23-
width: 24,
24-
height: 24,
25-
minWidth: 24,
26-
minHeight: 24,
27-
border: disabled
28-
? `2px solid ${theme.styleguideColors.contentQuaternary}`
29-
: `2px solid ${theme.styleguideColors[color]}`,
30-
borderRadius: '50%',
31-
display: 'flex',
32-
justifyContent: 'center',
33-
alignItems: 'center',
34-
marginRight: 12,
35-
}),
36-
);
22+
const OuterCircle = styled.div<{
23+
disabled?: boolean;
24+
color?: string;
25+
size: number;
26+
}>(({ theme, disabled, size, color = 'contentBlue' }) => ({
27+
width: size,
28+
height: size,
29+
minWidth: size,
30+
minHeight: size,
31+
border: disabled
32+
? `2px solid ${theme.styleguideColors.contentQuaternary}`
33+
: `2px solid ${theme.styleguideColors[color]}`,
34+
borderRadius: '50%',
35+
display: 'flex',
36+
justifyContent: 'center',
37+
alignItems: 'center',
38+
marginRight: 12,
39+
}));
3740

3841
const InnerCircle = styled.div<{
3942
unslected: boolean;
4043
disabled?: boolean;
4144
color?: string;
4245
}>(({ theme, unslected, disabled, color = 'contentBlue' }) => ({
4346
borderRadius: '50%',
44-
width: unslected ? 0 : 12,
45-
height: unslected ? 0 : 12,
47+
width: unslected ? 0 : '70%',
48+
height: unslected ? 0 : '70%',
4649
backgroundColor: disabled
4750
? theme.styleguideColors.contentQuaternary
4851
: theme.styleguideColors[color],
@@ -55,14 +58,15 @@ export const RadioButton = ({
5558
value,
5659
disabled,
5760
color,
61+
size = 24,
5862
}: RadioButtonProps) => {
5963
return (
6064
<Container
6165
onClick={() => {
6266
onChange && onChange(value);
6367
}}
6468
>
65-
<OuterCircle disabled={disabled} color={color}>
69+
<OuterCircle disabled={disabled} color={color} size={size}>
6670
<InnerCircle
6771
unslected={value !== selected}
6872
disabled={disabled}

0 commit comments

Comments
 (0)