Skip to content

Commit d1ad91e

Browse files
authored
Merge pull request #46 from make-software/bugfix/fix-aligment-in-radio-button
fix aligment and add custom size in radio button
2 parents 0c4ef00 + bf9cd5e commit d1ad91e

6 files changed

Lines changed: 41 additions & 32 deletions

File tree

dist/cspr-design.es.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39685,6 +39685,7 @@ const Iv = be.div.withConfig({
3968539685
theme: e
3968639686
}) => ({
3968739687
display: "flex",
39688+
alignItems: "center",
3968839689
cursor: "pointer",
3968939690
userSelect: "none"
3969039691
})), Lv = be.div.withConfig({
@@ -39693,13 +39694,14 @@ const Iv = be.div.withConfig({
3969339694
})(({
3969439695
theme: e,
3969539696
disabled: o,
39696-
color: g = "contentBlue"
39697+
size: g,
39698+
color: C = "contentBlue"
3969739699
}) => ({
39698-
width: 24,
39699-
height: 24,
39700-
minWidth: 24,
39701-
minHeight: 24,
39702-
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]}`,
3970339705
borderRadius: "50%",
3970439706
display: "flex",
3970539707
justifyContent: "center",
@@ -39715,20 +39717,21 @@ const Iv = be.div.withConfig({
3971539717
color: C = "contentBlue"
3971639718
}) => ({
3971739719
borderRadius: "50%",
39718-
width: o ? 0 : 12,
39719-
height: o ? 0 : 12,
39720+
width: o ? 0 : "70%",
39721+
height: o ? 0 : "70%",
3972039722
backgroundColor: g ? e.styleguideColors.contentQuaternary : e.styleguideColors[C]
3972139723
})), R_ = ({
3972239724
selected: e,
3972339725
onChange: o,
3972439726
label: g,
3972539727
value: C,
3972639728
disabled: A,
39727-
color: x
39729+
color: x,
39730+
size: r = 24
3972839731
}) => /* @__PURE__ */ Pe(Nv, { onClick: () => {
3972939732
o && o(C);
3973039733
}, children: [
39731-
/* @__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 }) }),
3973239735
g
3973339736
] }), Bv = {
3973439737
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: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,43 @@ 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 }) => ({
1516
display: 'flex',
17+
alignItems: 'center',
1618
cursor: 'pointer',
1719
userSelect: 'none',
1820
}));
1921

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

3741
const InnerCircle = styled.div<{
3842
unslected: boolean;
3943
disabled?: boolean;
4044
color?: string;
4145
}>(({ theme, unslected, disabled, color = 'contentBlue' }) => ({
4246
borderRadius: '50%',
43-
width: unslected ? 0 : 12,
44-
height: unslected ? 0 : 12,
47+
width: unslected ? 0 : '70%',
48+
height: unslected ? 0 : '70%',
4549
backgroundColor: disabled
4650
? theme.styleguideColors.contentQuaternary
4751
: theme.styleguideColors[color],
@@ -54,14 +58,15 @@ export const RadioButton = ({
5458
value,
5559
disabled,
5660
color,
61+
size = 24,
5762
}: RadioButtonProps) => {
5863
return (
5964
<Container
6065
onClick={() => {
6166
onChange && onChange(value);
6267
}}
6368
>
64-
<OuterCircle disabled={disabled} color={color}>
69+
<OuterCircle disabled={disabled} color={color} size={size}>
6570
<InnerCircle
6671
unslected={value !== selected}
6772
disabled={disabled}

0 commit comments

Comments
 (0)