Skip to content

Commit 9ffe795

Browse files
authored
Merge pull request #359 from indianaPoly/feat-checkbox
feat: checkbox
2 parents a3a1e7d + e1e827c commit 9ffe795

File tree

8 files changed

+927
-0
lines changed

8 files changed

+927
-0
lines changed

.changeset/shaky-ideas-roll.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@devup-ui/components": patch
3+
---
4+
5+
Checkbox component has been implemented.

packages/components/src/__tests__/index.browser.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ describe('export', () => {
2020
SelectContext: expect.any(Object),
2121
useSelect: expect.any(Function),
2222
Toggle: expect.any(Function),
23+
Checkbox: expect.any(Function),
2324
})
2425
})
2526
})
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { SVGProps } from 'react'
2+
3+
type CheckIconProps = SVGProps<SVGSVGElement> & {
4+
color?: string
5+
}
6+
7+
export function CheckIcon({ color, ...props }: CheckIconProps) {
8+
return (
9+
<svg
10+
height="10"
11+
viewBox="0 0 12 10"
12+
width="12"
13+
xmlns="http://www.w3.org/2000/svg"
14+
{...props}
15+
>
16+
<path
17+
clipRule="evenodd"
18+
d="M11.6474 0.807113C12.0992 1.23373 12.1195 1.94575 11.6929 2.39745L5.31789 9.14745C5.10214 9.37589 4.80069 9.50369 4.48649 9.49992C4.1723 9.49615 3.874 9.36114 3.6638 9.12759L0.288803 5.37759C-0.126837 4.91576 -0.0893993 4.20444 0.372424 3.7888C0.834247 3.37315 1.54557 3.41059 1.96121 3.87242L4.51994 6.71544L10.0571 0.852551C10.4837 0.400843 11.1957 0.3805 11.6474 0.807113Z"
19+
fill={color}
20+
fillRule="evenodd"
21+
/>
22+
</svg>
23+
)
24+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { Meta, StoryObj } from '@storybook/react-vite'
2+
3+
import { Checkbox } from './index'
4+
5+
type Story = StoryObj<typeof meta>
6+
7+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
8+
const meta: Meta<typeof Checkbox> = {
9+
title: 'Devfive/Checkbox',
10+
component: Checkbox,
11+
decorators: [
12+
(Story, context) => {
13+
const theme =
14+
context.parameters.theme || context.globals.theme || 'default'
15+
const isDark = theme === 'dark'
16+
17+
return (
18+
<div
19+
data-theme={theme}
20+
style={{
21+
padding: '20px',
22+
backgroundColor: isDark ? '#1a1a1a' : '#ffffff',
23+
color: isDark ? '#ffffff' : '#000000',
24+
minHeight: '200px',
25+
}}
26+
>
27+
<Story />
28+
</div>
29+
)
30+
},
31+
],
32+
}
33+
34+
export const Default: Story = {
35+
args: {
36+
children: 'Checkbox',
37+
disabled: false,
38+
checked: true,
39+
},
40+
}
41+
42+
export default meta

packages/components/src/components/Checkbox/__tests__/__snapshots__/index.browser.test.tsx.snap

Lines changed: 303 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)