-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from team-offonoff/feat/topic-create-page
Feat/topic create page
- Loading branch information
Showing
29 changed files
with
759 additions
and
111 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
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
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
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
69 changes: 69 additions & 0 deletions
69
src/components/TopicCreate/TopicCreateTextInput.styles.tsx
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,69 @@ | ||
import { styled } from 'styled-components'; | ||
|
||
import { colors } from '@styles/theme'; | ||
|
||
export const ReplaceButton = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
gap: 6px; | ||
align-items: center; | ||
justify-content: space-between; | ||
width: 111px; | ||
height: 18px; | ||
`; | ||
|
||
export const ReplaceIcon = styled.div` | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
width: 14px; | ||
height: 14px; | ||
`; | ||
|
||
export const TextInputContainer = styled.div` | ||
position: relative; | ||
box-sizing: border-box; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
width: 100%; | ||
height: 57px; | ||
overflow: hidden; | ||
background-color: transparent; | ||
border-radius: 10px; | ||
`; | ||
|
||
export const TextInputTextContainer = styled.div` | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
transform: translate(-50%, -50%); | ||
`; | ||
|
||
export const Input = styled.input` | ||
width: 100%; | ||
height: 100%; | ||
padding: 16px; | ||
font-size: 1.8rem; | ||
font-weight: 500; | ||
line-height: 1.4; | ||
color: ${colors.white}; | ||
background-color: rgb(77 59 124 / 40%); | ||
border: none; | ||
border-radius: 10px; | ||
outline: none; | ||
&::placeholder { | ||
color: ${colors.purple}; | ||
} | ||
`; | ||
|
||
export const InputSuffix = styled.div` | ||
position: absolute; | ||
top: 50%; | ||
right: 16px; | ||
transform: translateY(-50%); | ||
`; |
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,91 @@ | ||
import { Register } from '@tanstack/react-query'; | ||
import React from 'react'; | ||
import { RegisterOptions, useFormContext } from 'react-hook-form'; | ||
import { CONFIG, INPUT_TYPE, InputType } from 'src/constants/form'; | ||
|
||
import { Col, Row } from '@components/commons/Flex/Flex'; | ||
import Text from '@components/commons/Text/Text'; | ||
|
||
import { colors } from '@styles/theme'; | ||
|
||
import { RotateIcon } from '@icons/index'; | ||
|
||
import { | ||
Input, | ||
ReplaceButton, | ||
ReplaceIcon, | ||
TextInputContainer, | ||
TextInputTextContainer, | ||
InputSuffix, | ||
} from './TopicCreateTextInput.styles'; | ||
|
||
interface TopicCreareProps { | ||
topic: 'A' | 'B'; | ||
topicContent: string; | ||
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void; | ||
} | ||
|
||
const TopicCreateTextInput = ({ topic, topicContent }: TopicCreareProps) => { | ||
const { register, watch } = useFormContext(); | ||
const ATopicProgress = watch(INPUT_TYPE.ATOPIC) | ||
? `${watch(INPUT_TYPE.ATOPIC)?.length}/25` | ||
: '0/25'; | ||
const BTopicProgress = watch(INPUT_TYPE.BTOPIC) | ||
? `${watch(INPUT_TYPE.BTOPIC)?.length}/25` | ||
: '0/25'; | ||
return ( | ||
<Col gap={16}> | ||
<Row gap={83} justifyContent="space-between"> | ||
<Text size={16} weight={400} color={colors.white_60} align="start"> | ||
어떤 선택지가 있나요? | ||
</Text> | ||
<ReplaceButton> | ||
<ReplaceIcon> | ||
<RotateIcon opacity="0.3" /> | ||
</ReplaceIcon> | ||
<Text style={{ opacity: 0.3 }} size={13} weight={400} color={colors.purple} align="start"> | ||
AB 선택지 바꾸기 | ||
</Text> | ||
</ReplaceButton> | ||
</Row> | ||
<Col gap={8}> | ||
<TextInputContainer> | ||
<TextInputTextContainer> | ||
<Text style={{ opacity: 0.2 }} size={128} weight={900} color={colors.A}> | ||
A | ||
</Text> | ||
</TextInputTextContainer> | ||
<Input | ||
type="text" | ||
{...register(INPUT_TYPE.ATOPIC, CONFIG.ATOPIC.options)} | ||
placeholder="A 선택지를 입력해주세요." | ||
/> | ||
<InputSuffix> | ||
<Text size={15} weight={400} color={colors.purple_60}> | ||
{ATopicProgress} | ||
</Text> | ||
</InputSuffix> | ||
</TextInputContainer> | ||
<TextInputContainer> | ||
<TextInputTextContainer> | ||
<Text style={{ opacity: 0.2 }} size={128} weight={900} color={colors.B}> | ||
B | ||
</Text> | ||
</TextInputTextContainer> | ||
<Input | ||
type="text" | ||
{...register(INPUT_TYPE.BTOPIC, CONFIG.BTOPIC.options)} | ||
placeholder="B 선택지를 입력해주세요." | ||
/> | ||
<InputSuffix> | ||
<Text size={15} weight={400} color={colors.purple_60}> | ||
{BTopicProgress} | ||
</Text> | ||
</InputSuffix> | ||
</TextInputContainer> | ||
</Col> | ||
</Col> | ||
); | ||
}; | ||
|
||
export default TopicCreateTextInput; |
Oops, something went wrong.