From 690b2e433d4198ac1c0087b338fe7ba2e59fa851 Mon Sep 17 00:00:00 2001 From: gominzip Date: Sun, 25 Aug 2024 00:07:39 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=B6=A9=EB=8F=8C=20=ED=95=B4=EA=B2=B0?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20=ED=8C=8C=EC=9D=BC=20=EB=B0=8F?= =?UTF-8?q?=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=9D=B4=EB=A6=84=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/selectOption/SelectBtn.tsx | 4 ++-- ...n.styled.ts => SelectOptionList.styled.ts} | 2 +- ...{SelectOption.tsx => SelectOptionList.tsx} | 8 +++---- src/components/onboarding/SelectLevel.tsx | 4 ++-- src/type/selectList.d.ts | 24 +++++++++++++++++++ src/type/selectOption.d.ts | 24 ++++--------------- 6 files changed, 37 insertions(+), 29 deletions(-) rename src/components/common/selectOption/{SelectOption.styled.ts => SelectOptionList.styled.ts} (94%) rename src/components/common/selectOption/{SelectOption.tsx => SelectOptionList.tsx} (86%) create mode 100644 src/type/selectList.d.ts diff --git a/src/components/common/selectOption/SelectBtn.tsx b/src/components/common/selectOption/SelectBtn.tsx index 43ef0a7..20961a2 100644 --- a/src/components/common/selectOption/SelectBtn.tsx +++ b/src/components/common/selectOption/SelectBtn.tsx @@ -1,5 +1,5 @@ -import { SelectBtnProps } from "@type/selectOption"; -import * as S from "./SelectOption.styled"; +import { SelectBtnProps } from "@type/selectList"; +import * as S from "./SelectOptionList.styled"; import { colorSets } from "@utils/defaultData"; const SelectBtn = (props: SelectBtnProps) => { diff --git a/src/components/common/selectOption/SelectOption.styled.ts b/src/components/common/selectOption/SelectOptionList.styled.ts similarity index 94% rename from src/components/common/selectOption/SelectOption.styled.ts rename to src/components/common/selectOption/SelectOptionList.styled.ts index c189603..3762fb1 100644 --- a/src/components/common/selectOption/SelectOption.styled.ts +++ b/src/components/common/selectOption/SelectOptionList.styled.ts @@ -1,4 +1,4 @@ -import { ColorSet } from "@type/selectOption"; +import { ColorSet } from "@type/selectList"; import styled from "styled-components"; export const SelectOptionContainer = styled.div<{ width?: string }>` diff --git a/src/components/common/selectOption/SelectOption.tsx b/src/components/common/selectOption/SelectOptionList.tsx similarity index 86% rename from src/components/common/selectOption/SelectOption.tsx rename to src/components/common/selectOption/SelectOptionList.tsx index 3e22450..a3aa50a 100644 --- a/src/components/common/selectOption/SelectOption.tsx +++ b/src/components/common/selectOption/SelectOptionList.tsx @@ -1,9 +1,9 @@ -import { SelectOptionProps } from "@type/selectOption"; +import { SelectListProps } from "@type/selectList"; import SelectBtn from "./SelectBtn"; -import * as S from "./SelectOption.styled"; +import * as S from "./SelectOptionList.styled"; import { useState } from "react"; -const SelectOption = (props: SelectOptionProps) => { +const SelectOptionList = (props: SelectListProps) => { const [selectedValue, setSelectedValue] = useState( null ); @@ -54,4 +54,4 @@ const SelectOption = (props: SelectOptionProps) => { ); }; -export default SelectOption; +export default SelectOptionList; diff --git a/src/components/onboarding/SelectLevel.tsx b/src/components/onboarding/SelectLevel.tsx index d3dc94e..52a5b5e 100644 --- a/src/components/onboarding/SelectLevel.tsx +++ b/src/components/onboarding/SelectLevel.tsx @@ -1,7 +1,7 @@ -import SelectOption from "@components/common/selectOption/SelectOption"; import * as S from "./onboarding.styled"; import useSelectLevel from "@hooks/useSelectLevel"; import { nationElements } from "@utils/defaultData"; +import SelectOptionList from "@common/selectOption/SelectOptionList"; interface SelectLevelProps { languageId: number | string; @@ -23,7 +23,7 @@ const SelectLevel = ({ languageId, setter }: SelectLevelProps) => { {language?.text}를 얼마나 알고 계신가요? - ({ text: option.text, value: option.value, diff --git a/src/type/selectList.d.ts b/src/type/selectList.d.ts new file mode 100644 index 0000000..62e5112 --- /dev/null +++ b/src/type/selectList.d.ts @@ -0,0 +1,24 @@ +export interface ColorSet { + background: string; + border: string; + color: string; +} + +export interface SelectListProps { + selectList: SelectOptionElement[]; + setter: (value: string | number | null) => void; + width?: string; +} + +export interface SelectListElement { + text: string; + state: "correct" | "wrong" | "selected" | "default"; + value: string | number; +} + +export interface SelectBtnProps { + text: string; + colorName: string; + imgURL?: string; + onClick: () => void; +} diff --git a/src/type/selectOption.d.ts b/src/type/selectOption.d.ts index fe61828..62c2296 100644 --- a/src/type/selectOption.d.ts +++ b/src/type/selectOption.d.ts @@ -1,24 +1,8 @@ -export interface ColorSet { - background: string; - border: string; - color: string; -} - -export interface SelectOptionProps { - selectList: SelectOptionElement[]; - setter: (value: string | number | null) => void; - width?: string; -} - -export interface SelectOptionElement { +export interface SelectOptionProps extends InputImgProps { + imgURL: string; text: string; - state: "correct" | "wrong" | "selected" | "default"; - value: string | number; } -export interface SelectBtnProps { - text: string; - colorName: string; - imgURL?: string; - onClick: () => void; +export interface InputImgProps { + setIsLoading?: React.Dispatch>; }