Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions dist/cspr-design.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -39685,6 +39685,7 @@ const Iv = be.div.withConfig({
theme: e
}) => ({
display: "flex",
alignItems: "center",
cursor: "pointer",
userSelect: "none"
})), Lv = be.div.withConfig({
Expand All @@ -39693,13 +39694,14 @@ const Iv = be.div.withConfig({
})(({
theme: e,
disabled: o,
color: g = "contentBlue"
size: g,
color: C = "contentBlue"
}) => ({
width: 24,
height: 24,
minWidth: 24,
minHeight: 24,
border: o ? `2px solid ${e.styleguideColors.contentQuaternary}` : `2px solid ${e.styleguideColors[g]}`,
width: g,
height: g,
minWidth: g,
minHeight: g,
border: o ? `2px solid ${e.styleguideColors.contentQuaternary}` : `2px solid ${e.styleguideColors[C]}`,
borderRadius: "50%",
display: "flex",
justifyContent: "center",
Expand All @@ -39715,20 +39717,21 @@ const Iv = be.div.withConfig({
color: C = "contentBlue"
}) => ({
borderRadius: "50%",
width: o ? 0 : 12,
height: o ? 0 : 12,
width: o ? 0 : "70%",
height: o ? 0 : "70%",
backgroundColor: g ? e.styleguideColors.contentQuaternary : e.styleguideColors[C]
})), R_ = ({
selected: e,
onChange: o,
label: g,
value: C,
disabled: A,
color: x
color: x,
size: r = 24
}) => /* @__PURE__ */ Pe(Nv, { onClick: () => {
o && o(C);
}, children: [
/* @__PURE__ */ $(Lv, { disabled: A, color: x, children: /* @__PURE__ */ $(Rv, { unslected: C !== e, disabled: A, color: x }) }),
/* @__PURE__ */ $(Lv, { disabled: A, color: x, size: r, children: /* @__PURE__ */ $(Rv, { unslected: C !== e, disabled: A, color: x }) }),
g
] }), Bv = {
keybase: Jf,
Expand Down
2 changes: 1 addition & 1 deletion dist/cspr-design.umd.js

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/lib/components/radio-button/radio-button.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/lib/components/radio-button/radio-button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const Template: StoryFn<typeof RadioButton> = (args) => (
<FlexRow itemsSpacing={30}>
<FlexColumn itemsSpacing={20}>
<RadioButton {...args} />
<RadioButton {...args} label={'Mainnet'} size={12} />
</FlexColumn>
</FlexRow>
);
Expand Down
43 changes: 24 additions & 19 deletions src/lib/components/radio-button/radio-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,43 @@ export interface RadioButtonProps extends BaseProps {
value: string;
color?: string;
disabled?: boolean;
size: number;
}

const Container = styled.div(({ theme }) => ({
display: 'flex',
alignItems: 'center',
cursor: 'pointer',
userSelect: 'none',
}));

const OuterCircle = styled.div<{ disabled?: boolean; color?: string }>(
({ theme, disabled, color = 'contentBlue' }) => ({
width: 24,
height: 24,
minWidth: 24,
minHeight: 24,
border: disabled
? `2px solid ${theme.styleguideColors.contentQuaternary}`
: `2px solid ${theme.styleguideColors[color]}`,
borderRadius: '50%',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
marginRight: 12,
}),
);
const OuterCircle = styled.div<{
disabled?: boolean;
color?: string;
size: number;
}>(({ theme, disabled, size, color = 'contentBlue' }) => ({
width: size,
height: size,
minWidth: size,
minHeight: size,
border: disabled
? `2px solid ${theme.styleguideColors.contentQuaternary}`
: `2px solid ${theme.styleguideColors[color]}`,
borderRadius: '50%',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
marginRight: 12,
}));

const InnerCircle = styled.div<{
unslected: boolean;
disabled?: boolean;
color?: string;
}>(({ theme, unslected, disabled, color = 'contentBlue' }) => ({
borderRadius: '50%',
width: unslected ? 0 : 12,
height: unslected ? 0 : 12,
width: unslected ? 0 : '70%',
height: unslected ? 0 : '70%',
backgroundColor: disabled
? theme.styleguideColors.contentQuaternary
: theme.styleguideColors[color],
Expand All @@ -54,14 +58,15 @@ export const RadioButton = ({
value,
disabled,
color,
size = 24,
}: RadioButtonProps) => {
return (
<Container
onClick={() => {
onChange && onChange(value);
}}
>
<OuterCircle disabled={disabled} color={color}>
<OuterCircle disabled={disabled} color={color} size={size}>
<InnerCircle
unslected={value !== selected}
disabled={disabled}
Expand Down
Loading