-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: input 컴포넌트 구현 * feat: input 컴포넌트 스토리북 구현 * chore: git merge develop 후 후순위 이슈로 잠정적 중단 * chore: pr fail 해결 * feat: input 컴포넌트 80% 완성 * input 컴포넌트 완성 * App.tsx 파일 최신화 * chore: 코드리뷰 반영 * feat: input 완성 * chore: base 폰트 추가 * chore: 트렌지션 수정
- Loading branch information
Showing
11 changed files
with
163 additions
and
9 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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,12 @@ | ||
import type { SVGProps } from 'react'; | ||
const SvgIcFormDot = (props: SVGProps<SVGSVGElement>) => ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 20 20" | ||
{...props} | ||
> | ||
<circle cx={10} cy={10} r={1.5} fill="#454545" /> | ||
</svg> | ||
); | ||
export default SvgIcFormDot; |
This file contains 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,13 @@ | ||
import type { SVGProps } from 'react'; | ||
const SvgIcFormDotdot = (props: SVGProps<SVGSVGElement>) => ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 10 20" | ||
{...props} | ||
> | ||
<circle cx={5} cy={7} r={1} fill="#454545" /> | ||
<circle cx={5} cy={13} r={1} fill="#454545" /> | ||
</svg> | ||
); | ||
export default SvgIcFormDotdot; |
This file contains 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 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,49 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
import { recipe } from '@vanilla-extract/recipes'; | ||
|
||
import { flexGenerator } from '@styles/generator.css'; | ||
import { vars } from '@styles/theme.css'; | ||
|
||
export const inputContainer = style([ | ||
flexGenerator('column', 'center', 'flex-start'), | ||
{ | ||
gap: '0.4rem', | ||
}, | ||
]); | ||
|
||
export const inputTitle = style([ | ||
flexGenerator(), | ||
vars.fonts.body05_m_14, | ||
{ | ||
color: vars.colors.gray700, | ||
}, | ||
]); | ||
|
||
export const inputStyle = recipe({ | ||
base: [ | ||
vars.fonts.body07_r_14, | ||
{ | ||
width: '100%', | ||
backgroundColor: vars.colors.white, | ||
border: `1px solid ${vars.colors.gray300}`, | ||
borderRadius: '8px', | ||
padding: '1.4rem 2rem', | ||
selectors: { | ||
'&:focus': { | ||
border: `1px solid ${vars.colors.gray500}`, | ||
}, | ||
}, | ||
}, | ||
], | ||
variants: { | ||
state: { | ||
default: { color: vars.colors.gray400 }, | ||
active: { | ||
color: vars.colors.gray900, | ||
}, | ||
}, | ||
}, | ||
defaultVariants: { | ||
state: 'default', | ||
}, | ||
}); |
This file contains 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,31 @@ | ||
import { IcFormDot, IcFormDotdot } from '@svgs'; | ||
|
||
import { inputTitle, inputContainer, inputStyle } from './Input.css'; | ||
|
||
type InputProps = { | ||
inputLabel?: string; | ||
value: string; | ||
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void; | ||
placeholder?: string; | ||
}; | ||
|
||
const Input = ({ inputLabel, value, onChange, placeholder }: InputProps) => { | ||
return ( | ||
<div className={inputContainer}> | ||
<label htmlFor={value} className={inputTitle}> | ||
<IcFormDot width={20} height={20} /> | ||
{inputLabel} <IcFormDotdot width={10} height={20} /> | ||
</label> | ||
<input | ||
className={inputStyle({ state: value ? 'active' : 'default' })} | ||
type="text" | ||
id={value} | ||
value={value} | ||
onChange={onChange} | ||
placeholder={placeholder} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Input; |
This file contains 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 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,30 @@ | ||
import { Input } from '@components'; | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
const meta: Meta<typeof Input> = { | ||
title: 'Components/Input', | ||
component: Input, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
inputLabel: { control: 'text' }, | ||
value: { control: 'text' }, | ||
onChange: { action: 'changed' }, | ||
placeholder: { control: 'text' }, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
inputLabel: '픽업 날짜/요일/시간(30분 단위로)', | ||
value: '', | ||
onChange: () => {}, | ||
placeholder: '예: 01.03/금/16:30', | ||
}, | ||
}; |