Skip to content

Commit

Permalink
Formatting: #24 타입명 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Seok93 committed Jun 25, 2024
1 parent 4200f76 commit 955dcf0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Empty file removed src/assets/.gitkeep
Empty file.
12 changes: 6 additions & 6 deletions src/components/modal/ModalTodoStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { IoIosClose } from 'react-icons/io';
import { RiProhibited2Fill, RiProhibited2Line } from 'react-icons/ri';
import { SubmitHandler, useForm } from 'react-hook-form';
import { STATUS_VALIDATION_RULES } from '@constants/formValidationRules';
import type { TodoStatus, TodoStatusFormValues } from '@/types/TodoStatusType';
import type { ColorInfo, TodoStatus, TodoStatusForm } from '@/types/TodoStatusType';

type TodoProps = {
type TodoStatusProps = {
todoStatus: TodoStatus[];
onClose: () => void;
};
Expand All @@ -22,7 +22,7 @@ const DEFAULT_TODO_COLORS = Object.freeze({
});

// 색상 정보 취득
function getTodoColors(todoStatus: TodoStatus[]) {
function getTodoColors(todoStatus: TodoStatus[]): ColorInfo[] {
const colorMap = new Map();

Object.values(DEFAULT_TODO_COLORS).forEach((color) =>
Expand All @@ -39,13 +39,13 @@ function getTodoColors(todoStatus: TodoStatus[]) {
return [...colorMap.values()];
}

export default function ModalTodoStatus({ todoStatus, onClose }: TodoProps) {
export default function ModalTodoStatus({ todoStatus, onClose }: TodoStatusProps) {
const {
register,
watch,
handleSubmit,
formState: { errors },
} = useForm<TodoStatusFormValues>({
} = useForm<TodoStatusForm>({
mode: 'onChange',
defaultValues: {
name: '',
Expand All @@ -66,7 +66,7 @@ export default function ModalTodoStatus({ todoStatus, onClose }: TodoProps) {
console.log(`${color} 삭제`);
};

const onSubmit: SubmitHandler<TodoStatusFormValues> = async (data) => {
const onSubmit: SubmitHandler<TodoStatusForm> = async (data) => {
// ToDo: 색상 생성을 위한 네트워크 로직 추가
console.log(data);
};
Expand Down
8 changes: 7 additions & 1 deletion src/types/TodoStatusType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ export type TodoStatus = {
color: string;
};

export type TodoStatusFormValues = {
export type TodoStatusForm = {
name: string;
color: string;
};

export type ColorInfo = {
color: string;
isDefault: boolean;
isUsable: boolean;
};

0 comments on commit 955dcf0

Please sign in to comment.