Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/topic create page #142

Merged
merged 22 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
40b1faf
fix: svg 수정으로 인한 icon 크기 수정
chaeyoung103 Jan 10, 2024
893eb11
feat: topiccreate -> topicsideselection으로 변경 및 topiccreate 추가
chaeyoung103 Jan 10, 2024
e5fc719
feat: 큰 아래화살표 아이콘 추가
chaeyoung103 Jan 11, 2024
e1ff6d1
fix: 아래 화살표 아이콘 크기에 따라 아이콘 추가 및 변경
chaeyoung103 Jan 11, 2024
34b3869
fix: 아이콘 변경 및 그림자 위치 수정
chaeyoung103 Jan 11, 2024
5ef9cf5
feat: 토픽 만들기 페이지 side에 따라 button ui 변경되는 로직 추가
chaeyoung103 Jan 11, 2024
cf2c7ed
feat: 뒤로가기 로직 변경, A,B사이드 공용 ui 생성
chaeyoung103 Jan 14, 2024
90592a3
Merge remote-tracking branch 'origin/dev' into feat/topic-create-page
chaeyoung103 Jan 16, 2024
4fbf028
feat: TopicCreateTextInput 컴포넌트 생성
chaeyoung103 Jan 21, 2024
d1d5f43
feat: input form에 topicTitle, aTopic, bTopic 추가
chaeyoung103 Jan 21, 2024
2bd446d
fix: 디자인 시스템 - color 수정
chaeyoung103 Jan 21, 2024
c2e7e0f
fix: input suppix 위치 조정
chaeyoung103 Jan 21, 2024
4466d64
fix: Text 컴포넌트에 style 지정 가능하도록 수정
chaeyoung103 Jan 21, 2024
3142b99
fix: color 추가
chaeyoung103 Jan 21, 2024
08cdc18
feat: Default버튼 공용컴포넌트 생성
chaeyoung103 Jan 23, 2024
bff5d73
feat: 토픽 생성화면 추가
chaeyoung103 Jan 23, 2024
0d6b081
feat: 토픽생성화면 A사이드인 경우 컴포넌트 추가
chaeyoung103 Jan 23, 2024
f67b934
feat: 토픽생성화면 B사이드인 경우 컴포넌트 추가
chaeyoung103 Jan 23, 2024
6d65d83
fix: color 사용 코드 변경
chaeyoung103 Jan 23, 2024
6647a2a
Merge branch 'dev' into feat/topic-create-page
Jinho1011 Jan 23, 2024
f4bd821
fix: remove duplicate exports
Jinho1011 Jan 23, 2024
0d0c015
fix: color theme key
Jinho1011 Jan 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/assets/icons/big-down-chevron.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions src/assets/icons/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions src/assets/icons/down-chevron.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/assets/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import AlarmIcon from './alarm-default.svg?react';
import NewAlarmIcon from './alarm-new.svg?react';
import AppleIcon from './apple.svg?react';
import BLogoIcon from './b-logo.svg?react';
import BigDownChevronIcon from './big-down-chevron.svg?react';
import ClockIcon from './clock.svg?react';
import CloseIcon from './close.svg?react';
import CommentIcon from './comment.svg?react';
Expand All @@ -22,6 +23,7 @@ import RefreshIcon from './refresh.svg?react';
import ReportIcon from './report.svg?react';
import RightChevronIcon from './right-chevron.svg?react';
import RightDoubleArrowIcon from './right-double-arrow.svg?react';
import RotateIcon from './rotate.svg?react';
import SizeUpIcon from './size-up.svg?react';
import ThumbsIcon from './thumbs.svg?react';
import TopicCreatBackgrounIcon from './topic-create-background.svg?react';
Expand Down Expand Up @@ -53,6 +55,12 @@ export {
RightDoubleArrowIcon,
SelectedHomeIcon,
SizeUpIcon,
CloseIcon,
DownChevronIcon,
BigDownChevronIcon,
ALogoIcon,
BLogoIcon,
RotateIcon,
ThumbsIcon,
TopicCreatBackgrounIcon,
WriteBoxIcon,
Expand Down
6 changes: 4 additions & 2 deletions src/assets/icons/right-chevron.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/rotate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 26 additions & 7 deletions src/assets/styles/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,29 @@ import { DefaultTheme } from 'styled-components/dist/types';

export const colors = {
purple: '#A46FF3',
sub_purple: '#624392',
sub_purple2: '#BE28F3',
purple_30: 'rgba(164, 111, 243, 0.30)',
purple_60: 'rgba(164, 111, 243, 0.60)',
purple2: '#BE28F3',
navy: '#242036',
navy_20: 'rgba(36, 32, 54, 0.20)',
navy_40: 'rgba(36, 32, 54, 0.40)',
navy_60: 'rgba(36, 32, 54, 0.60)',
navy_80: 'rgba(36, 32, 54, 0.80)',
navy2: '#4D3B7C',
sub_navy2: '#4D3B7C',
navy2_20: 'rgba(77, 59, 124, 0.20)',
navy2_40: 'rgba(77, 59, 124, 0.40)',
navy2_60: 'rgba(77, 59, 124, 0.60)',
navy2_80: 'rgba(77, 59, 124, 0.80)',
A: '#D04376',
sub_A: '#DF8AA9',
A_20: 'rgba(208, 67, 118, 0.20)',
A_40: 'rgba(208, 67, 118, 0.40)',
A_60: 'rgba(208, 67, 118, 0.60)',
A_80: 'rgba(208, 67, 118, 0.80)',
B: '#1498AA',
B_20: 'rgba(20, 152, 170, 0.20)',
B_40: 'rgba(20, 152, 170, 0.40)',
B_60: 'rgba(20, 152, 170, 0.60)',
B_80: 'rgba(20, 152, 170, 0.80)',
black: '#000000',
white: '#FFFFFF',
white_20: 'rgba(255, 255, 255, 0.20)',
Expand All @@ -20,6 +35,10 @@ export const colors = {
black_60: 'rgba(0, 0, 0, 0.60)',
white_80: 'rgba(255, 255, 255, 0.80)',
black_80: 'rgba(0, 0, 0, 0.80)',
navywhite_20: '#504D5E',
navywhite_40: '#7C7986',
navywhite_60: '#A7A6AF',
navywhite_80: '#D3D2D7',
};

export const zIndex = {
Expand All @@ -43,7 +62,7 @@ export const input = {
backgroundColor: '#342b52',
},
error: {
border: `1px solid ${colors.sub_purple2}`,
border: `1px solid ${colors.purple2}`,
backgroundColor: '#342b52',
},
},
Expand All @@ -54,7 +73,7 @@ export const input = {
lineHeight: '140%',
padding: '0 0 10px 0',
border: 'none',
borderBottom: `1px solid ${colors.sub_navy2}`,
borderBottom: `1px solid ${colors.navy2}`,
backgroundColor: 'transparent',
borderRadius: 0,
outline: 'none',
Expand All @@ -65,7 +84,7 @@ export const input = {
lineHeight: '140%',
padding: '0 0 10px 0',
border: 'none',
borderBottom: `1px solid ${colors.sub_purple2}`,
borderBottom: `1px solid ${colors.purple2}`,
borderRadius: 0,
backgroundColor: 'transparent',
outline: 'none',
Expand Down
11 changes: 7 additions & 4 deletions src/components/Home/TopicSwiper/TopicSwiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import SwiperCore from 'swiper';
import { Navigation } from 'swiper/modules';
import { Swiper, SwiperSlide } from 'swiper/react';

import { colors } from '@styles/theme';

import { RightChevronIcon } from '@icons/index';

SwiperCore.use([Navigation]);
Expand All @@ -27,7 +29,7 @@ const TopicSwiper = ({ children }: TopicSwiperProps) => {
setNextDisabled(false);
}}
>
<RightChevronIcon style={{ transform: 'rotate(180deg)' }} />
<RightChevronIcon style={{ transform: 'rotate(180deg)' }} stroke={colors.white_40} />
</PrevButton>
<Swiper
allowTouchMove={false}
Expand All @@ -51,16 +53,17 @@ const TopicSwiper = ({ children }: TopicSwiperProps) => {
setPrevDisabled(false);
}}
>
<RightChevronIcon />
<RightChevronIcon stroke={colors.white_40} />
</NextButton>
</React.Fragment>
);
};

const SlideButton = styled.button<{ disabled: boolean }>`
z-index: 100;
width: 40px;
height: 40px;
width: 32px;
height: 32px;
padding: 4.8px 10.4px;
cursor: pointer;
background-color: transparent;

Expand Down
69 changes: 69 additions & 0 deletions src/components/TopicCreate/TopicCreateTextInput.styles.tsx
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%);
`;
91 changes: 91 additions & 0 deletions src/components/TopicCreate/TopicCreateTextInput.tsx
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;
31 changes: 31 additions & 0 deletions src/components/commons/Button/DefaultButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { styled } from 'styled-components';

import { colors } from '@styles/theme';

interface DefaultButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
onClick: () => void;
disabled: boolean;
title: string;
}

const DefaultButton = ({ onClick, disabled, title }: DefaultButtonProps) => {
return (
<StyledButton onClick={onClick} disabled={disabled}>
{title}
</StyledButton>
);
};

const StyledButton = styled.button<{ disabled: boolean }>`
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 52px;
color: ${(props) => (props.disabled ? colors.navywhite_40 : colors.white)};
cursor: pointer;
background-color: ${(props) => (props.disabled ? colors.navywhite_20 : colors.purple)};
border-radius: 10px;
`;

export default DefaultButton;
3 changes: 2 additions & 1 deletion src/components/commons/Header/CloseButton/CloseButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const CloseButton = ({ onClick }: CloseButtonProps) => {

const handleCloseButtonClick = () => {
navigate(-1);
}
};

return (
<Button onClick={onClick ? onClick : handleCloseButtonClick}>
Expand All @@ -27,6 +27,7 @@ const Button = styled.button`
align-items: center;
width: 24px;
height: 24px;
padding: 5px;
cursor: pointer;
`;

Expand Down
Loading
Loading