-
Notifications
You must be signed in to change notification settings - Fork 2
[#47] ✨ 공통 컴포넌트 Label 구현 #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0af637a
[#47] 🌱 Initialize Label component creation
yongb2n 0f5fbf0
[#47] ✨ Implement Label component
yongb2n 6c4ae8e
[#47] ✅ Add Storybook for Label component
yongb2n 13ef0b7
Merge branch 'dev' of https://github.com/DevFDev/frontend into feat/c…
yongb2n 0242963
[#47] ♻️ Apply Highlight component to required prop in Label
yongb2n 89cb3a3
[#47] 🐛 Fix build error by defining explicit return type
yongb2n 7b83741
[#47] ♻️ resolve build warnings (imported multiple times)
yongb2n 62ae4fb
[#47] 🐛 Fix build error by replacing 'any' with precise type definition
yongb2n cfe74ae
[#47] ♻️ Update folder paths to use absolute imports
yongb2n d6248ee
[#47] ♻️ Add layout prop to Label component for row and col
yongb2n 6edf067
[#47] ✅ Add Storybook examples for Label component with layout prop
yongb2n File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import clsx from 'clsx' | ||
|
|
||
| import { Highlight } from '../text' | ||
|
|
||
| export interface LabelProps | ||
| extends React.LabelHTMLAttributes<HTMLLabelElement> { | ||
| required?: boolean | ||
| labelText?: string | ||
| } | ||
|
|
||
| export const Label = ({ | ||
| required = false, | ||
| labelText, | ||
| htmlFor, | ||
| children, | ||
| className = '', | ||
| }: LabelProps): JSX.Element => { | ||
| const labelClass = clsx('flex flex-col text-body3 font-medium', className) | ||
|
|
||
| return ( | ||
| <label htmlFor={htmlFor} className={labelClass}> | ||
| <div className='mb-4 flex items-center'> | ||
| <span className='font-medium text-gray-600'>{labelText}</span> | ||
| {required && <Highlight>*</Highlight>} | ||
| </div> | ||
| {children} | ||
| </label> | ||
| ) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { Meta, StoryObj } from '@storybook/react' | ||
|
|
||
| import { TextInput } from '@/components/common/input/TextInput' | ||
| import { Label, LabelProps } from '@/components/common/label/Label' | ||
|
|
||
| const meta: Meta<typeof Label> = { | ||
| title: 'Common/Label/Label', | ||
| component: Label, | ||
| parameters: { | ||
| layout: 'centered', | ||
| }, | ||
| args: { | ||
| required: false, | ||
| labelText: '라벨 제목', | ||
| }, | ||
| } | ||
|
|
||
| export default meta | ||
|
|
||
| type Story = StoryObj<typeof Label> | ||
|
|
||
| export const Default: Story = { | ||
| args: { | ||
| labelText: '이름', | ||
| required: false, | ||
| }, | ||
| render: (args: LabelProps) => ( | ||
| <Label {...args}> | ||
| <TextInput placeholder='이름을 입력하세요' /> | ||
| </Label> | ||
| ), | ||
| } | ||
|
|
||
| export const RequiredLabel: Story = { | ||
| args: { | ||
| labelText: '이메일', | ||
| required: true, | ||
| }, | ||
| render: (args: LabelProps) => ( | ||
| <Label {...args}> | ||
| <TextInput placeholder='이메일을 입력하세요' /> | ||
| </Label> | ||
| ), | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
절대 경로로 바꿔 주세요 !
@/components/common/text
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
변경 완료!