diff --git a/README.md b/README.md index ff8cfbe4..71f42573 100644 --- a/README.md +++ b/README.md @@ -150,3 +150,19 @@ const box = // Same const box = ``` + +## How to Contribute + +### Requirements +- Rust compiler installed +- pnpm package manager installed + +### Development Setup +To set up the development environment, install the following packages: +```sh +pnpm i +pnpm build +cargo install cargo-tarpaulin +cargo install wasm-pack +``` +After installation, run pnpm test to ensure everything works correctly. \ No newline at end of file diff --git a/README_ko.md b/README_ko.md index 900e52e5..5bacbeee 100644 --- a/README_ko.md +++ b/README_ko.md @@ -144,3 +144,19 @@ const box = // Same const box = ``` + +## 기여 방법 + +### 요구 사항 +- Rust 컴파일러 설치 +- pnpm 패키지 매니저 설치 + +### 개발용 설치 +개발 환경을 위해 아래 패키지들을 설치합니다. +```sh +pnpm i +pnpm build +cargo install cargo-tarpaulin +cargo install wasm-pack +``` +설치 후 pnpm test를 실행하여 문제가 없는지 확인합니다. \ No newline at end of file diff --git a/packages/components/src/components/Button/index.tsx b/packages/components/src/components/Button/index.tsx index 299555b5..4115cc1a 100644 --- a/packages/components/src/components/Button/index.tsx +++ b/packages/components/src/components/Button/index.tsx @@ -7,7 +7,7 @@ import { } from '@devup-ui/react' import { clsx } from 'clsx' -type ButtonProps = React.ButtonHTMLAttributes & { +interface ButtonProps extends React.ButtonHTMLAttributes { variant?: 'primary' | 'default' colors?: { primary?: string @@ -105,6 +105,7 @@ export function Button({ }, }[variant] } + // Q. how to use dark theme? _themeDark={{ _active: { primary: { diff --git a/packages/components/src/components/Label/Label.stories.tsx b/packages/components/src/components/Label/Label.stories.tsx new file mode 100644 index 00000000..3abc00ea --- /dev/null +++ b/packages/components/src/components/Label/Label.stories.tsx @@ -0,0 +1,28 @@ +import { css } from '@devup-ui/react' +import { Meta, StoryObj } from '@storybook/react-vite' +import { useState } from 'react' +import { Label } from './index' + +type Story = StoryObj + +// use the same blueprint with button. +const meta: Meta = { + title: 'Devfive/Label', + component: Label, + decorators: [ + (Story) => ( +
+ +
+ ) + ] +} + +export const Default: Story = { + args: { + children: 'Label Text', + disabled: false, + } +} + +export default meta; \ No newline at end of file diff --git a/packages/components/src/components/Label/index.tsx b/packages/components/src/components/Label/index.tsx new file mode 100644 index 00000000..bf995ba4 --- /dev/null +++ b/packages/components/src/components/Label/index.tsx @@ -0,0 +1,61 @@ +import { type DevupThemeTypography, Text as DevupText } from '@devup-ui/react' +import { clsx } from 'clsx' + +interface LabelProps extends React.LabelHTMLAttributes { + // our custom properties. + colors?: { + text?: string + error?: string + disabled?: string + } + typography?: keyof DevupThemeTypography + ellipsis?: boolean + required?: boolean + disabled?: boolean + tooltip?: string +} + +export function Label({ + form, + htmlFor, + colors, + typography, + ellipsis = false, + required = false, + disabled = false, + tooltip, + children, + className, + ...props +}: LabelProps): React.ReactElement { + return ( + + {children} + {required && ( + + * + + )} + + ) +}