diff --git a/src/routes/Topic/BTopicCreate.tsx b/src/routes/Topic/BTopicCreate.tsx deleted file mode 100644 index d52fda9..0000000 --- a/src/routes/Topic/BTopicCreate.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import React, { useState } from 'react'; -import { FormProvider, useForm } from 'react-hook-form'; -import { CONFIG, INPUT_TYPE } from 'src/constants/form'; - -import { Col } from '@components/commons/Flex/Flex'; -import Text from '@components/commons/Text/Text'; -import TextInput from '@components/commons/TextInput/TextInput'; -import { theme2 } from '@components/commons/TextInput/theme'; - -import { colors } from '@styles/theme'; - -import { Container } from './ATopicCreate.styles'; - -interface TopicCreateDTO { - topicTitle: string; - ATopic: string; - BTopic: string; -} - -const BTopicCreate = () => { - const methods = useForm({ mode: 'onChange' }); - - const titleProgress = methods.watch(INPUT_TYPE.TOPICTITLE) - ? `${methods.watch(INPUT_TYPE.TOPICTITLE)?.length}/20` - : '0/20'; - - return ( - - - - - - 어떤 주제로 물어볼까요? - - ( - - {titleProgress} - - )} - /> - - - - 토픽의 카테고리를 알려주세요 - - - - - - ); -}; - -export default BTopicCreate; diff --git a/src/routes/Topic/Create/BSide/BTopicCreateStep1.styles.tsx b/src/routes/Topic/Create/BSide/BTopicCreateStep1.styles.tsx new file mode 100644 index 0000000..0543aba --- /dev/null +++ b/src/routes/Topic/Create/BSide/BTopicCreateStep1.styles.tsx @@ -0,0 +1,45 @@ +import { styled } from 'styled-components'; + +import { colors } from '@styles/theme'; + +export const Container = styled.div` + position: relative; + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: flex-start; + width: 100%; + height: 100%; + padding: 54px 0 0; + background-color: ${colors.navy}; +`; + +export const CategoryChipContainer = styled.div` + display: flex; + flex-direction: row; + gap: 5px; + align-items: center; + justify-content: flex-start; + padding-right: 20px; + overflow-x: scroll; + background-color: ${colors.navy}; + + &::-webkit-scrollbar { + display: none; + } +`; + +export const CategoryChip = styled.button` + display: flex; + align-items: center; + justify-content: center; + padding: 5px 16px; + font-size: 14px; + font-weight: 600; + color: ${colors.purple}; + text-align: center; + white-space: nowrap; + background-color: ${colors.navy}; + border: 1px solid ${colors.navy2}; + border-radius: 23px; +`; diff --git a/src/routes/Topic/Create/BSide/BTopicCreateStep1.tsx b/src/routes/Topic/Create/BSide/BTopicCreateStep1.tsx new file mode 100644 index 0000000..6d3b93a --- /dev/null +++ b/src/routes/Topic/Create/BSide/BTopicCreateStep1.tsx @@ -0,0 +1,98 @@ +import React from 'react'; +import { useFormContext } from 'react-hook-form'; +import { CONFIG, INPUT_TYPE } from 'src/constants/form'; + +import { Col } from '@components/commons/Flex/Flex'; +import Text from '@components/commons/Text/Text'; +import TextInput from '@components/commons/TextInput/TextInput'; +import { theme2, theme3 } from '@components/commons/TextInput/theme'; + +import { colors } from '@styles/theme'; + +import { CategoryChip, CategoryChipContainer, Container } from './BTopicCreateStep1.styles'; + +interface BTopicCreareProps { + onKeyDown?: (e: React.KeyboardEvent) => void; +} + +const BTopicCreateStep1 = () => { + const methods = useFormContext(); + const titleProgress = methods.watch(INPUT_TYPE.TOPICTITLE) + ? `${methods.watch(INPUT_TYPE.TOPICTITLE)?.length}/20` + : '0/20'; + + const categoryProgress = methods.watch(INPUT_TYPE.TOPICCATEGORY) + ? `${methods.watch(INPUT_TYPE.TOPICCATEGORY)?.length}/6` + : '0/6'; + + const categoryChipList = ['스포츠', '연예방송', '일상다반사', '게임', '일상']; + + const handleCategoryChipClick = (categoryChip: string) => { + methods.setValue(INPUT_TYPE.TOPICCATEGORY, categoryChip); + methods.clearErrors(INPUT_TYPE.TOPICCATEGORY); + }; + + return ( + + + + + 어떤 주제로 물어볼까요? + + ( + + {titleProgress} + + )} + /> + + + + + 토픽의 카테고리를 알려주세요 + + ( + + {categoryProgress} + + )} + /> + + + + 추천 키워드 + + + {categoryChipList.map((categoryChip, index) => ( + { + handleCategoryChipClick(categoryChip); + }} + key={index} + > + {categoryChip} + + ))} + + + 비속어를 포함한 부적절한 단어의 태그를 입력할 경우
+ 게시물 삭제 및 이용 제재를 받을 수 있어요. +
+ + + +
+ ); +}; + +export default BTopicCreateStep1;