Skip to content

Commit 4e53ac9

Browse files
committed
feat: UI primitives/hooks 계약 스캐폴드 추가
1 parent f11c222 commit 4e53ac9

13 files changed

Lines changed: 111 additions & 3 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export type ButtonVariant = "primary" | "secondary" | "danger";
2+
3+
export interface ButtonProps {
4+
label: string;
5+
disabled?: boolean;
6+
variant?: ButtonVariant;
7+
onClick: () => void;
8+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export interface CardProps {
2+
title?: string;
3+
description?: string;
4+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export interface DatePickerProps {
2+
value: Date | null;
3+
minDate?: Date;
4+
maxDate?: Date;
5+
onChange: (value: Date | null) => void;
6+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface FormProps {
2+
id: string;
3+
disabled?: boolean;
4+
onSubmit: () => Promise<void>;
5+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export interface InputProps {
2+
name: string;
3+
value: string;
4+
placeholder?: string;
5+
disabled?: boolean;
6+
onChange: (value: string) => void;
7+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface ModalProps {
2+
title: string;
3+
isOpen: boolean;
4+
onClose: () => void;
5+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export interface SelectOption {
2+
label: string;
3+
value: string;
4+
}
5+
6+
export interface SelectProps {
7+
name: string;
8+
value: string;
9+
options: SelectOption[];
10+
disabled?: boolean;
11+
onChange: (value: string) => void;
12+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export interface TableHeader {
2+
id: string;
3+
label: string;
4+
}
5+
6+
export interface TableProps<TItem> {
7+
headers: TableHeader[];
8+
rows: TItem[];
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export * from "./Button";
2+
export * from "./Input";
3+
export * from "./Select";
4+
export * from "./Modal";
5+
export * from "./Card";
6+
export * from "./Table";
7+
export * from "./Form";
8+
export * from "./DatePicker";
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export type FormErrors = Record<string, string | undefined>;
2+
3+
export interface UseFormOptions<TValues> {
4+
initialValues: TValues;
5+
validate?: (values: TValues) => FormErrors;
6+
}
7+
8+
export interface UseFormState<TValues> {
9+
values: TValues;
10+
errors: FormErrors;
11+
setFieldValue: <TKey extends keyof TValues>(key: TKey, value: TValues[TKey]) => void;
12+
reset: () => void;
13+
submit: () => Promise<boolean>;
14+
}

0 commit comments

Comments
 (0)