From d27998a05c918bd07161822580a45e7ed0708822 Mon Sep 17 00:00:00 2001 From: geckotang Date: Mon, 3 Feb 2025 16:02:25 +0900 Subject: [PATCH 01/14] update checkbox style --- src/components/Checkbox/Checkbox.stories.tsx | 52 +++++++++++++++----- src/components/Checkbox/Checkbox.tsx | 4 ++ src/components/Checkbox/styled.ts | 10 +++- 3 files changed, 51 insertions(+), 15 deletions(-) diff --git a/src/components/Checkbox/Checkbox.stories.tsx b/src/components/Checkbox/Checkbox.stories.tsx index 991c385f9..d34bca7c5 100755 --- a/src/components/Checkbox/Checkbox.stories.tsx +++ b/src/components/Checkbox/Checkbox.stories.tsx @@ -7,6 +7,11 @@ export default { title: "Components/Inputs/Checkbox", component: Checkbox, argTypes: { + checkBoxSize: { + type: "select", + options: ["small", "medium"], + }, + disabled: { control: "boolean" }, onChange: { action: "changed" }, }, }; @@ -17,18 +22,39 @@ export const Example: StoryObj = { export const DesignSamples: StoryObj = { render: () => ( - - Not checked - Checked - - Checked(indeterminate) - - - Not checked(disabled) - - - Checked(disabled) - - + <> + + + + Not checked + + + Checked + + + Checked(indeterminate) + + + Not checked(disabled) + + + Checked(disabled) + + + + Not checked + Checked + + Checked(indeterminate) + + + Not checked(disabled) + + + Checked(disabled) + + + + ), }; diff --git a/src/components/Checkbox/Checkbox.tsx b/src/components/Checkbox/Checkbox.tsx index e5636b36e..d850792ac 100644 --- a/src/components/Checkbox/Checkbox.tsx +++ b/src/components/Checkbox/Checkbox.tsx @@ -5,6 +5,8 @@ export type CheckBoxProps = React.ComponentPropsWithoutRef<"input"> & { indeterminate?: boolean; error?: boolean; inputRef?: React.Ref; + disabled?: boolean; + checkBoxSize?: "small" | "medium"; }; const Checkbox = React.forwardRef( @@ -15,6 +17,7 @@ const Checkbox = React.forwardRef( error = false, disabled = false, inputRef, + checkBoxSize = "medium", ...rest }, ref, @@ -31,6 +34,7 @@ const Checkbox = React.forwardRef( {...rest} /> ` opacity: 0; -webkit-appearance: none; @@ -33,6 +35,7 @@ export const Container = styled.label<{ disabled: boolean }>` `; export const Span = styled.span<{ + checkBoxSize: string; hasChild: boolean; indeterminate: boolean; error: boolean; @@ -43,11 +46,14 @@ export const Span = styled.span<{ error ? ({ theme }) => theme.palette.danger.main : ({ theme }) => theme.palette.black}; + font-size: ${({ checkBoxSize }) => + checkBoxSize === "small" ? `${fontSize.sm}px` : `${fontSize.md}px`}; &::before { flex-shrink: 0; content: ""; - width: 18px; - height: 18px; + aspect-ratio: 1; + width: ${({ checkBoxSize }) => + checkBoxSize === "small" ? "16px" : "18px"}; border: 1px solid ${({ error, theme }) => error ? theme.palette.danger.main : theme.palette.divider}; From 21e328236ba11dc05ae197c2a7980484b5cf150b Mon Sep 17 00:00:00 2001 From: geckotang Date: Mon, 3 Feb 2025 16:12:17 +0900 Subject: [PATCH 02/14] add changeset --- .changeset/smooth-bees-tickle.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/smooth-bees-tickle.md diff --git a/.changeset/smooth-bees-tickle.md b/.changeset/smooth-bees-tickle.md new file mode 100644 index 000000000..af4ecc95c --- /dev/null +++ b/.changeset/smooth-bees-tickle.md @@ -0,0 +1,5 @@ +--- +"ingred-ui": minor +--- + +update checkbox style From 6fce86746b7f51f859e138de6f1c967751d92624 Mon Sep 17 00:00:00 2001 From: geckotang Date: Mon, 3 Feb 2025 16:26:14 +0900 Subject: [PATCH 03/14] update snapshot --- .../__snapshots__/Checkbox.test.tsx.snap | 6 +- .../__snapshots__/DualListBox.test.tsx.snap | 152 +++++++++--------- 2 files changed, 79 insertions(+), 79 deletions(-) diff --git a/src/components/Checkbox/__tests__/__snapshots__/Checkbox.test.tsx.snap b/src/components/Checkbox/__tests__/__snapshots__/Checkbox.test.tsx.snap index 5b4831887..307ca7465 100644 --- a/src/components/Checkbox/__tests__/__snapshots__/Checkbox.test.tsx.snap +++ b/src/components/Checkbox/__tests__/__snapshots__/Checkbox.test.tsx.snap @@ -3,15 +3,15 @@ exports[`Checkbox component testing Checkbox 1`] = ` diff --git a/src/components/DualListBox/__tests__/__snapshots__/DualListBox.test.tsx.snap b/src/components/DualListBox/__tests__/__snapshots__/DualListBox.test.tsx.snap index 111246a99..0e7958905 100644 --- a/src/components/DualListBox/__tests__/__snapshots__/DualListBox.test.tsx.snap +++ b/src/components/DualListBox/__tests__/__snapshots__/DualListBox.test.tsx.snap @@ -14,18 +14,18 @@ exports[`DualListBox component testing DualListBox 1`] = ` orientation="vertical" />

@@ -35,7 +35,7 @@ exports[`DualListBox component testing DualListBox 1`] = `

@@ -58,15 +58,15 @@ exports[`DualListBox component testing DualListBox candidateItems 1`] = ` display="flex" >