From 9f02e04f01739b9b3856440524118bc1d9263481 Mon Sep 17 00:00:00 2001 From: JiyoungHyun Date: Fri, 6 Aug 2021 08:23:11 +0900 Subject: [PATCH 01/80] =?UTF-8?q?Fix:=20=EB=B2=84=ED=8A=BC=EC=9D=84=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=EC=9C=BC=EB=A1=9C=20=EA=B0=90=EC=8B=B8?= =?UTF-8?q?=EB=8A=94=20=EB=AC=B8=EC=A0=9C=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/CategoryButton/style.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/CategoryButton/style.ts b/src/components/molecules/CategoryButton/style.ts index b643d011..44453cd2 100644 --- a/src/components/molecules/CategoryButton/style.ts +++ b/src/components/molecules/CategoryButton/style.ts @@ -8,7 +8,7 @@ export const CategoryBtn = Styled(Button)<{ isCategoryClicked?: boolean; readMor ${theme('font.subhead3')}; `; -export const CategoryButtonWrapper = Styled(Button)<{ isCategoryClicked?: boolean; readMore?: boolean }>` +export const CategoryButtonWrapper = Styled.div<{ isCategoryClicked?: boolean; readMore?: boolean }>` height: 46px; border-radius: 60px; padding: 12px 30px; From d217bc2355aab6da5219d5dfb63d24c3d36d18c8 Mon Sep 17 00:00:00 2001 From: JiyoungHyun Date: Fri, 6 Aug 2021 08:35:51 +0900 Subject: [PATCH 02/80] =?UTF-8?q?Refactor:=20Notice=20Molecules=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/Concert/index.tsx | 16 ++- src/components/molecules/Notice/index.tsx | 54 ---------- src/components/molecules/Notice/style.ts | 99 ------------------- src/components/molecules/index.ts | 1 - .../organisms/ConcertList/index.tsx | 2 +- src/components/organisms/NoticeList/index.tsx | 6 +- 6 files changed, 15 insertions(+), 163 deletions(-) delete mode 100644 src/components/molecules/Notice/index.tsx delete mode 100644 src/components/molecules/Notice/style.ts diff --git a/src/components/molecules/Concert/index.tsx b/src/components/molecules/Concert/index.tsx index 12dd85ea..936ccd12 100644 --- a/src/components/molecules/Concert/index.tsx +++ b/src/components/molecules/Concert/index.tsx @@ -11,7 +11,7 @@ interface IProps { title: string; text: string; commentNum: number; - likes: number; + likeNum?: number; onClickFunc: () => void; } @@ -23,7 +23,7 @@ function Concert({ title, text, commentNum, - likes, + likeNum, onClickFunc, }: IProps): React.ReactElement { const interestDivide = interestList?.join(' | '); @@ -40,11 +40,17 @@ function Concert({

- + - -

{likes}

+ {likeNum === undefined ? ( +
+ ) : ( + <> + +

{likeNum}

+ + )}

{commentNum}

diff --git a/src/components/molecules/Notice/index.tsx b/src/components/molecules/Notice/index.tsx deleted file mode 100644 index 26b403f3..00000000 --- a/src/components/molecules/Notice/index.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { ThumbnailCommentIcon } from 'assets/images'; -import dayjs from 'dayjs'; -import React from 'react'; -import { Content, Info, NoticeWrapper, ThumbnailContainer, ThumbnailInfo, ThumbnailOverlay } from './style'; - -interface IProps { - imgThumbnail: string; - authorNickname: string; - interestList: string[]; - createdAt: string; - title: string; - text: string; - commentNum: number; - onClickFunc: () => void; -} - -function Notice({ - imgThumbnail, - authorNickname, - interestList, - createdAt, - title, - text, - commentNum, - onClickFunc, -}: IProps): React.ReactElement { - const interestDivide = interestList?.join(' | '); - return ( - <> - - -

{authorNickname}

-

{interestDivide}

-

{`${dayjs(createdAt).format('YY.MM.DD')}`}

-
- -

{title}

-

- - - - - - -

{commentNum}

- - - -
- - ); -} - -export default Notice; diff --git a/src/components/molecules/Notice/style.ts b/src/components/molecules/Notice/style.ts deleted file mode 100644 index f97fc815..00000000 --- a/src/components/molecules/Notice/style.ts +++ /dev/null @@ -1,99 +0,0 @@ -import Styled from 'styled-components'; -import { palette, theme } from 'styled-tools'; - -export const Info = Styled.div` - display: flex; - flex-direction: column; - width: 111px; - height: 84px; - color: #404040; - ${theme('font.body1')}; - & p:nth-of-type(1) { - margin: 0 38px 12px 0; - width: 100px; - ${theme('font.subhead3')}; - } - :hover{ - cursor:pointer; - } -`; - -export const Content = Styled.div` - display: flex; - flex-direction: column; - width: 524px; - height: 84px; - color: ${palette('grayscale', 9)}; - ${theme('font.subhead3')}; - & p:nth-of-type(2) { - display: -webkit-box; - margin-top: 12px; - width: 524px; - height: 2.79em; - overflow: hidden; - text-align: left; - text-overflow: ellipsis; - white-space:normal; - word-wrap: break-word; - color: ${palette('grayscale', 7)}; - ${theme('font.body2')}; - -webkit-line-clamp: 3; - -webkit-box-orient: vertical; - } - :hover{ - cursor:pointer; - } -`; - -export const ThumbnailContainer = Styled.div` - position: relative; - img { - width: 170px; - height: 84px; - object-fit: cover; - } - :hover{ - cursor:pointer; - } -`; - -export const ThumbnailOverlay = Styled.div` - position: absolute; - bottom: 0; - transition: .5s ease; - opacity:0; - background: rgb(0, 0, 0); - width: 100%; - height: 100%; - :hover { - opacity:0.6; - } -`; - -export const ThumbnailInfo = Styled.div` - display: flex; - position:absolute; - top: 50%; - left: 50%; - align-items:center; - transform: translate(-50%, -50%); - color: ${palette('grayscale', 0)}; - ${theme('font.body2_eng')}; - img { - margin-right:5px; - width: 20px; - height: 20px; - } - p { - margin-right:10px; - } -`; - -export const NoticeWrapper = Styled.div` - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-around; - border-bottom: 1px solid #DFDFDF; - height: 144px; -`; diff --git a/src/components/molecules/index.ts b/src/components/molecules/index.ts index 5f449f32..30f09c3f 100644 --- a/src/components/molecules/index.ts +++ b/src/components/molecules/index.ts @@ -33,7 +33,6 @@ export { default as LoginModal } from './LoginModal'; export { default as MyPageConcertCard } from './MyPageConcertCard'; export { default as MyPageSection } from './MyPageSection'; export { default as MyPageSlider } from './MyPageSlider'; -export { default as Notice } from './Notice'; export { default as NoticeSingleComment } from './NoticeSingleComment'; export { default as RegisterHeader } from './RegisterHeader'; export { default as ChallengeReCommentList, default as ReplyComment } from './ReplyComment'; diff --git a/src/components/organisms/ConcertList/index.tsx b/src/components/organisms/ConcertList/index.tsx index 9982339c..5971683e 100644 --- a/src/components/organisms/ConcertList/index.tsx +++ b/src/components/organisms/ConcertList/index.tsx @@ -60,7 +60,7 @@ function ConcertList({ concertData, totalConcertNum, currentPage, setCurrentPage title={card.title} text={card.text} commentNum={card.commentNum} - likes={card.likes} + likeNum={card.likes} key={card._id} onClickFunc={() => history.push(`/concert/${card._id}`)} > diff --git a/src/components/organisms/NoticeList/index.tsx b/src/components/organisms/NoticeList/index.tsx index 70e3f2db..c68125c6 100644 --- a/src/components/organisms/NoticeList/index.tsx +++ b/src/components/organisms/NoticeList/index.tsx @@ -1,6 +1,6 @@ import { SmallLeftArrowIcon, SmallRightArrowIcon } from 'assets/images'; import { Icon } from 'components/atoms'; -import { Notice } from 'components/molecules'; +import { Concert } from 'components/molecules'; import React, { useState } from 'react'; import { useHistory } from 'react-router'; import { INotice } from 'types/notice.type'; @@ -51,7 +51,7 @@ function NoticeList({ noticeList, totalNoticeNum, currentPage, setCurrentPage }: {noticeList?.map( (notice: INotice) => notice && ( - history.push(`/notice/${notice._id}`)} - > + > ), )} From 98eb0c7da6be6237c97bc14de517925f98c92279 Mon Sep 17 00:00:00 2001 From: JiyoungHyun Date: Fri, 6 Aug 2021 09:10:45 +0900 Subject: [PATCH 03/80] =?UTF-8?q?Etc:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/SingleComment/index.tsx | 2 +- src/components/organisms/CommentList/index.tsx | 1 - src/components/organisms/NoticeCommentList/index.tsx | 3 --- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/components/molecules/SingleComment/index.tsx b/src/components/molecules/SingleComment/index.tsx index de342eed..aa629eb3 100644 --- a/src/components/molecules/SingleComment/index.tsx +++ b/src/components/molecules/SingleComment/index.tsx @@ -79,7 +79,7 @@ function SingleComment({ _id, userID, childrenComment, text, concertID }: IProps return ( - + {userID?.nickname} {text} {isOpenReply ? '접기' : '답글보기'} diff --git a/src/components/organisms/CommentList/index.tsx b/src/components/organisms/CommentList/index.tsx index 26600e91..7312496b 100644 --- a/src/components/organisms/CommentList/index.tsx +++ b/src/components/organisms/CommentList/index.tsx @@ -37,7 +37,6 @@ function CommentList({ commentList, concertID, reLoadComment }: IProps): React.R <> From f4f41bf1a66d7881c8df8bb5050f1a496ad36cde Mon Sep 17 00:00:00 2001 From: JiyoungHyun Date: Fri, 6 Aug 2021 10:34:49 +0900 Subject: [PATCH 04/80] =?UTF-8?q?Etc:=20Notice=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Notice/index.tsx | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/pages/Notice/index.tsx b/src/pages/Notice/index.tsx index 49071474..fef208fe 100644 --- a/src/pages/Notice/index.tsx +++ b/src/pages/Notice/index.tsx @@ -1,4 +1,4 @@ -import { getNoticeListData, getNoticeSearchData } from 'apis'; +import { getNoticeSearchData } from 'apis'; import { NoticeHeader, NoticeList, SearchForm } from 'components/organisms'; import React, { useEffect, useState } from 'react'; import { INotice } from 'types/notice.type'; @@ -10,16 +10,6 @@ function Notice(): React.ReactElement { const [currentPage, setCurrentPage] = useState(1); const [totalNoticeNum, setTotalNoticeNum] = useState(0); - useEffect(() => { - const getNoticeList = async (pageIndex: number) => { - const LIMIT_PER_PAGE = 8; - const data = await getNoticeListData({ offset: (pageIndex - 1) * LIMIT_PER_PAGE }); - data && setnoticeList(data.notices); - data && setTotalNoticeNum(data.totalNoticeNum); - }; - getNoticeList(currentPage); - }, [currentPage]); - useEffect(() => { const getNoticeSearchList = async (pageIndex: number) => { const LIMIT_PER_PAGE = 8; @@ -39,7 +29,7 @@ function Notice(): React.ReactElement { const keywordChange = () => { setCurrentPage(1); }; - const noticeListNum = noticeList?.length; + return ( <> @@ -47,7 +37,7 @@ function Notice(): React.ReactElement { {noticeList && ( From 15556a2def0aeda744448f44408a5c799bc28116 Mon Sep 17 00:00:00 2001 From: Subin Date: Fri, 6 Aug 2021 00:14:59 +0900 Subject: [PATCH 05/80] =?UTF-8?q?Refactor:=20StyledInput=20style=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/atoms/StyledInput/index.tsx | 30 ++----- src/components/atoms/StyledInput/style.ts | 100 ++++++++++++--------- 2 files changed, 63 insertions(+), 67 deletions(-) diff --git a/src/components/atoms/StyledInput/index.tsx b/src/components/atoms/StyledInput/index.tsx index 6a88020a..b15bdbb1 100644 --- a/src/components/atoms/StyledInput/index.tsx +++ b/src/components/atoms/StyledInput/index.tsx @@ -1,6 +1,6 @@ import { ErrorIcon } from 'assets/images'; import React, { useState } from 'react'; -import { SStyledInput } from './style'; +import { ErrorImage, ErrorMsg, Input, InputContainer, SStyledInput } from './style'; export interface IProps { name?: string; @@ -14,18 +14,6 @@ export interface IProps { isPw?: boolean; margin?: string; } -const conditionMetStyle = { - border: 'double 1px transparent', - backgroundImage: 'linear-gradient(white, white), linear-gradient(to right, #36c8f5,#13e2dd)', - backgroundOrigin: 'border-box', - backgroundClip: 'content-box, border-box', -}; -const conditionNotMetStyle = { - border: 'solid 1px #f66436', -}; -const defaultStyle = { - border: 'solid 1px #c1c1c1', -}; function StyledInput({ name, @@ -41,13 +29,9 @@ function StyledInput({ const [isFocused, setIsfocused] = useState(false); return ( - -
- + + { @@ -61,9 +45,9 @@ function StyledInput({ // }} type={isPw ? 'password' : 'text'} /> - {isFocused && !isConditionMet && } -
- {isFocused && !isConditionMet &&
{errorMsg}
} + {isFocused && !isConditionMet && } + + {isFocused && !isConditionMet && {errorMsg}}
); } diff --git a/src/components/atoms/StyledInput/style.ts b/src/components/atoms/StyledInput/style.ts index e953d79c..b3a91f50 100644 --- a/src/components/atoms/StyledInput/style.ts +++ b/src/components/atoms/StyledInput/style.ts @@ -1,53 +1,65 @@ import Styled from 'styled-components'; +import { theme } from 'styled-tools'; + +export const Input = Styled.input` + border : none; + ${theme('font.body1')}; + font-size: 16px; + color : #0d0d0d; + text-align: left; + width : 100%; + height : 100%; + padding: 18px 20px; + border-radius: 4px; + font-style: AppleSDGothicNeo; + :placeholder{ + color : #c1c1c1; + } + :focus{ + outline : none; + } +`; + +export const InputContainer = Styled.div<{ width: string; height: string; condition: number }>` + /* condition + -1 : 기본 + 0 : 컨디션 X + 1 : 컨디션 O */ + border : ${(props) => + props.condition == -1 + ? 'solid 1px #c1c1c1' + : props.condition == 1 + ? 'double 1px transparent' + : 'solid 1px #f66436'}; + background-image : ${(props) => + props.condition == 1 && 'linear-gradient(white, white), linear-gradient(to right, #36c8f5,#13e2dd)'}; + background-origin : ${(props) => props.condition == 1 && 'border-box'}; + background-clip : ${(props) => props.condition == 1 && 'content-box, border-box'}; + border-radius : 4px; + display : flex; + align-items : center; + width : ${(props) => props.width}; + height : ${(props) => props.height}; + margin-bottom : 5px; +`; + +export const ErrorImage = Styled.img` + width : 24px; + height : 24px; + margin-right : 15px; +`; + +export const ErrorMsg = Styled.div` + ${theme('font.body2')}; + text-align : left; + text-align: left; + color: #f66436; +`; export const SStyledInput = Styled.div<{ - isConditionMet: boolean; - isFocused: boolean; - width: string; - height: string; margin?: string; }>` display : flex; flex-direction : column; margin : ${(props) => props.margin}; - .input{ - border : none; - font-size : 16px; - color : #0d0d0d; - letter-spacing: -0.5px; - text-align: left; - width : 100%; - height : 100%; - padding: 18px 20px; - border-radius: 4px; - font-style: AppleSDGothicNeo; - - :placeholder{ - color : #c1c1c1; - } - :focus{ - outline : none; - } - &__container{ - border-radius : 4px; - display : flex; - align-items : center; - width : ${(props) => props.width}; - height : ${(props) => props.height}; - margin-bottom : 5px; - } - &__image--error{ - width : 24px; - height : 24px; - margin-right : 15px; - } - &__msg--error{ - text-align : left; - font-size: 14px; - line-height: 1.5; - letter-spacing: -0.5px; - text-align: left; - color: #f66436; - } - } `; From 355262785cf165f41bb8276b2679a895e2d27560 Mon Sep 17 00:00:00 2001 From: Subin Date: Fri, 6 Aug 2021 09:45:17 +0900 Subject: [PATCH 06/80] =?UTF-8?q?Refactor:=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20classname=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/atoms/StyledInput/index.tsx | 2 +- .../molecules/AdminChallengeCard/index.tsx | 24 +++++++-------- .../molecules/AdminChallengeCard/style.ts | 3 ++ .../AdminChallengeOpenForm/index.tsx | 14 ++++----- .../molecules/AdminChallengeOpenForm/style.ts | 5 +++- .../molecules/AdminWriteForm/index.tsx | 29 +++++++------------ .../molecules/AdminWriteForm/style.ts | 5 ++++ src/components/molecules/JoinForm/index.tsx | 1 - src/components/molecules/LoginForm/index.tsx | 5 +--- src/components/organisms/Login/index.tsx | 2 +- 10 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/components/atoms/StyledInput/index.tsx b/src/components/atoms/StyledInput/index.tsx index b15bdbb1..45bcae25 100644 --- a/src/components/atoms/StyledInput/index.tsx +++ b/src/components/atoms/StyledInput/index.tsx @@ -47,7 +47,7 @@ function StyledInput({ /> {isFocused && !isConditionMet && } - {isFocused && !isConditionMet && {errorMsg}} + {isFocused && !isConditionMet && {errorMsg}} ); } diff --git a/src/components/molecules/AdminChallengeCard/index.tsx b/src/components/molecules/AdminChallengeCard/index.tsx index 5190ff4e..abbea19a 100644 --- a/src/components/molecules/AdminChallengeCard/index.tsx +++ b/src/components/molecules/AdminChallengeCard/index.tsx @@ -20,34 +20,34 @@ function AdminChallengeCard({ challengeData }: IProps): React.ReactElement { 오투 회고 챌린지 {challengeData.generation}기 - - {changeDatetoString(challengeData.createdDT, true)} + + {changeDatetoString(challengeData.createdDT, true)} - - + + {changeDatetoString(challengeData.challengeStartDT, true)} ~{' '} {changeDatetoString(challengeData.challengeEndDT, false)} - - + + {changeDatetoString(challengeData.registerStartDT, true)} ~{' '} {changeDatetoString(challengeData.registerEndDT, false)} - - {challengeData.applyNum}명 + + {challengeData.applyNum}명 - - {challengeData.participants}명 + + {challengeData.participants}명 - - {challengeData.postNum}개 + + {challengeData.postNum}개 diff --git a/src/components/molecules/AdminChallengeCard/style.ts b/src/components/molecules/AdminChallengeCard/style.ts index 93c78ccf..b9ead194 100644 --- a/src/components/molecules/AdminChallengeCard/style.ts +++ b/src/components/molecules/AdminChallengeCard/style.ts @@ -1,11 +1,14 @@ import Styled from 'styled-components'; +import { theme } from 'styled-tools'; export const Label = Styled.div` + ${theme('font.body3')}; margin-right : 41px; width : 90px; color:#6f6f6f; `; export const Exp = Styled.div` + ${theme('font.subhead3')}; color : #6f6f6f; `; export const RowContainer = Styled.div` diff --git a/src/components/molecules/AdminChallengeOpenForm/index.tsx b/src/components/molecules/AdminChallengeOpenForm/index.tsx index 21e5d117..fdefbd4a 100644 --- a/src/components/molecules/AdminChallengeOpenForm/index.tsx +++ b/src/components/molecules/AdminChallengeOpenForm/index.tsx @@ -64,7 +64,7 @@ function AdminChallengeOpenForm({ return ( - 챌린지 제목 + 챌린지 제목 - 챌린지 기간 + 챌린지 기간 - ~ + ~ - 챌린지 신청 기간 + 챌린지 신청 기간 - ~ + ~ - 제한 인원 수 + 제한 인원 수 - 명 + 명 ); diff --git a/src/components/molecules/AdminChallengeOpenForm/style.ts b/src/components/molecules/AdminChallengeOpenForm/style.ts index daa7ea3c..759f5c1a 100644 --- a/src/components/molecules/AdminChallengeOpenForm/style.ts +++ b/src/components/molecules/AdminChallengeOpenForm/style.ts @@ -1,7 +1,9 @@ import { Label } from 'components/atoms'; import Styled from 'styled-components'; +import { theme } from 'styled-tools'; export const WriteLabel = Styled(Label)` + ${theme('font.subhead4')}; width : 100%; color: #0d0d0d; margin-bottom : 8px; @@ -21,7 +23,8 @@ export const PeopleContainer = Styled.div` align-items : flex-start; `; -export const Text = Styled.div` +export const Text = Styled.div<{ style: string }>` + ${theme(`font.style`)}; line-height : 60px; color : #8b8b8b; `; diff --git a/src/components/molecules/AdminWriteForm/index.tsx b/src/components/molecules/AdminWriteForm/index.tsx index 85b7d57a..6209aba6 100644 --- a/src/components/molecules/AdminWriteForm/index.tsx +++ b/src/components/molecules/AdminWriteForm/index.tsx @@ -153,7 +153,7 @@ function AdminWriteForm({ - 제목 + 제목 - 연사 닉네임 + 연사 닉네임
- 메뉴 + 메뉴
- 카테고리 + 카테고리 - 동영상 업로드 + 동영상 업로드 - + - 동영상 업로드하기 + 동영상 업로드하기 - 썸네일 업로드 + 썸네일 업로드 - 썸네일 이미지 업로드하기 + 썸네일 이미지 업로드하기 - 해시태그 + 해시태그 {writeData.hashtag.length >= 0 && writeData.hashtag.map((hashtag, id) => { - return ( - hashtag != '' && ( - - #{hashtag} - - ) - ); + return hashtag != '' && #{hashtag}; })} diff --git a/src/components/molecules/AdminWriteForm/style.ts b/src/components/molecules/AdminWriteForm/style.ts index b40e85ad..d24b184f 100644 --- a/src/components/molecules/AdminWriteForm/style.ts +++ b/src/components/molecules/AdminWriteForm/style.ts @@ -1,7 +1,9 @@ import { Input, Label } from 'components/atoms'; import Styled from 'styled-components'; +import { theme } from 'styled-tools'; export const UploadDescription = Styled.div` + ${theme('font.subhead3')}; color : #a5a5a5; text-align: center; margin-top :4px; @@ -63,6 +65,7 @@ export const TopRowContainer = Styled.div` justify-content : space-between; `; export const HashTagInput = Styled(Input)` + ${theme('font.body2')}; width : 100%; height : 100%; border-radius:4px; @@ -88,11 +91,13 @@ export const HashTagContainer = Styled.div` margin-bottom : 130px; `; export const WriteLabel = Styled(Label)` + ${theme('font.subhead4')}; width : 100%; color: #0d0d0d; margin-bottom : 8px; `; export const HashTag = Styled.div` + ${theme('font.body2')}; padding : 5px 10px; background-color: #f5f5f5; color : #a5a5a5; diff --git a/src/components/molecules/JoinForm/index.tsx b/src/components/molecules/JoinForm/index.tsx index ea17e6b9..2b3dd1cc 100644 --- a/src/components/molecules/JoinForm/index.tsx +++ b/src/components/molecules/JoinForm/index.tsx @@ -125,7 +125,6 @@ function JoinForm({ isConditionMet, userData, setUserData, setIsConditionMet }: /> 성별 - - 로그인 - + 로그인 ); } diff --git a/src/components/organisms/Login/index.tsx b/src/components/organisms/Login/index.tsx index 2810685e..d991aecb 100644 --- a/src/components/organisms/Login/index.tsx +++ b/src/components/organisms/Login/index.tsx @@ -7,7 +7,7 @@ import { ButtonWrapper, FindPwdBtn, JoinBtn, Line, LoginContainer, LoginLabel } function CLogin(): React.ReactElement { return ( - 로그인 + 로그인 From d414f990e9f83b98aadaeddeb9de9715f2acbfa8 Mon Sep 17 00:00:00 2001 From: Subin Date: Fri, 6 Aug 2021 10:37:48 +0900 Subject: [PATCH 07/80] =?UTF-8?q?Refactor:=20=EB=9E=9C=EB=94=A9=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20style=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Home/index.tsx | 452 ++++++++++++--------------------------- src/pages/Home/style.ts | 251 ++++++++++++++++++++++ 2 files changed, 386 insertions(+), 317 deletions(-) create mode 100644 src/pages/Home/style.ts diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index 9efcf9e6..385aac16 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -20,12 +20,50 @@ import { UsefulLearnMyselfFillIcon, WelcomeToO2FillIcon, } from 'assets/images'; -import { Button } from 'components/atoms'; import { BadgeCard } from 'components/molecules'; import React, { useEffect, useState } from 'react'; import Reveal from 'react-awesome-reveal'; import { Link } from 'react-router-dom'; import Styled from 'styled-components'; +import { + BadgeWrapper, + ChallengeBtn, + ChallengeCard, + ChallengeCardWrapper, + ChallengeWrapper, + ConcertContent, + ConcertExpContainer1, + ConcertExpContainer2, + ConcertExpType, + ConcertImage1, + ConcertImage2, + ConcertTitle, + ConcertWrapper, + ConcertWrapper1, + ConcertWrapper2, + LinkBtn, + LinkCardWrapper, + LinkExp, + LinkTitle, + LinkWrapper, + MiddleExp, + MiddleSubTitle, + MiddleTitle, + O2BadgeSubTitle, + O2BadgeTitle, + O2BadgeWrapper, + O2SpaekerExp, + O2SpeakerBadgeImage, + O2SpeakerInnerWrapper, + O2SpeakerOuterWrapper, + O2SpeakerSubTitle, + O2SpeakerTitle, + O2SpeakerWrapper, + O2Title, + TopExp, + TopSubTitle, + TopWrapper, +} from './style'; const moveUp = keyframes` from { @@ -50,78 +88,78 @@ function Home(): React.ReactElement { }, []); return ( - + -
-

O2

-

+ + O2 + 함께 성장하는 공간,
창업가들이 마시는 산소 -

-

답답한 창업 여정에 시원한 산소 한 모금

+ + 답답한 창업 여정에 시원한 산소 한 모금 - + 챌린지 보러가기 -
+
-
+ -

Learn Myself

-

나에게 배우다, 나를 배우다.

-

+ Learn Myself + 나에게 배우다, 나를 배우다. + 오늘의 잘한 점과 못한 점, 배운 점을 기록해요.
배운 점을 적용하며 더 성장한 내일의 나를 만들어요. -

+
-
    - - - - -
+ + + + + +
-
-
+ + -

Share Together

-

경험을 나누다, 함께 성장하다.

-

+ Share Together + 경험을 나누다, 함께 성장하다. + 누구나 O2 Speaker가 될 수 있어요.
O2 People 앞에서 당신의 이야기를 나눠주세요. -

+
-
- -
+ + + -

Share Together 인기글

-

+ Share Together 인기글 + 내가 힘들 때 버틸 수 있었던
3가지 -

-

+ + 창업을 하다보면 정말 생각하지 못했던 어려운 일들이
많이 일어나는건 누구나 알고계실거라 생각합니다.
중간에 포기하고 싶어지는 순간에 앵엘님의
[내가 힘들 때 버틸 수 있었던 3가지] 강연으로 나만의
버팀목도 한번 만들어보세요. -

+
-
-
-
-
+ + + + -

Share Together 인기글

-

+ Share Together 인기글 + CEO라는 꿈.
정말 나를 위한 유일한 길일까? -

-

+ + 여러분은 자신의 꿈에 얼마나 큰 확신을 가지고있나요?
아마 꿈을 향해 나아가면서도 끊임없이 ‘내가 잘 하고 있는 것인가?‘,
‘이게 정말 나를 위한 길인가?’ 이런 생각이 드실거라 생각합니다.
@@ -129,50 +167,50 @@ function Home(): React.ReactElement {
하기만 CEO라는 꿈을 어떻게 이룰 수 있었는지,
깡토님의 실제 스토리를 여러분들께 들려드립니다. -

+
-
- -
-
-
+ + + + + -

To Be an O2 Speaker

-

뱃지를 모아 O2 Speaker가 되어보세요!

+ To Be an O2 Speaker + 뱃지를 모아 O2 Speaker가 되어보세요!
-
    -
  • - -

    + + + + 챌린지 개수를 주당
    3개 이상으로 설정 -

    -
  • -
  • - -

    + + + + + 런마쎌을 80%이상 작성 후
    챌린지뱃지를 획득 -

    -
  • -
  • - -

    + + + + + 챌린지뱃지 3개 + 활동뱃지 12개
    얻을 시 연사가능 -

    -
  • -
+ + +
-
-
+ + -

O2 Badge

-

열심히 활동하면 멋진 오투의 뱃지들을 받을 수 있어요.

+ O2 Badge + 열심히 활동하면 멋진 오투의 뱃지들을 받을 수 있어요.
-
    + } /> -
+
-
-
-
-

+ + + + Learn Myself
Register -

-

+ + Learn Myself에
참여해 보세요! -

+ - + More -
-
-

Learn Myself

-

+ + + Learn Myself + 나만의
챌린지를 시작해 보세요 -

+ - + More -
-
-

Share Together

-

+ + + Share Together + O2 People의 이야기를
들어보세요! -

+ - + More -
-
-
+ + + ); } -const JoinWrap = Styled.div` +const HomeContainer = Styled.div` display : flex; flex-direction : column; align-items : center; @@ -318,226 +356,6 @@ const JoinWrap = Styled.div` margin : 0; padding : 0; } - /* @keyframes moveUp { - from { - transform: translateY(8%); - opacity: 0; - } - to { - transform: translateY(0); - opacity: 1; - } - } */ - .linkTo{ - width : 100%; - padding-top : 208px; - margin-top : 150px; - padding-bottom : 187px; - background-color : #2f3438; - display : flex; - justify-content : center; - align-items : center; - gap : 110px; - &__container--card{ - display : flex; - flex-direction : column; - } - &__title{ - color : #ffffff; - height : 68px; - } - &__exp{ - color : #dfdfdf; - margin : 31px 0; - } - &__button{ - width: 200px; - height: 60px; - background-color : #36c8f5; - color : #ffffff; - } - } - .o2badge{ - padding-top : 150px; - display : flex; - flex-direction: column; - align-items : center; - &__title{ - color : #0d0d0d; - margin-bottom : 20px; - } - &__subtitle{ - color : #6f6f6f; - margin-bottom : 150px; - } - &__container--badge{ - display : grid; - grid-template-columns: repeat(2, 1fr); - grid-column-gap: 468px; - grid-row-gap: 100px; - } - } - .o2speaker{ - width : 100vw; - background-color : #2f3438; - display : flex; - flex-direction : column; - align-items : center; - padding : 120px 0; - &__title{ - color : #ffffff; - } - &__subtitle{ - color : #a5a5a5; - margin-top : 20px; - margin-bottom : 138px; - } - &__exp{ - color : #ffffff; - text-align: center; - margin-top : 48px; - } - &__container{ - &--outer{ - width : 1100px; - display : flex; - flex-direction : row; - justify-content : space-between; - } - &--inner{ - display : flex; - flex-direction : column; - align-items : center; - } - } - &__image--badge{ - width: 260px; - height: 260px; - } - } - .top{ - padding-top : 178px; - width : 1109px; - /* animation-name: moveUp; - animation-duration: 1.5s; */ - &__title{ - &--O2{ - font-size: 90px; - font-weight: bold; - line-height: 0.62; - letter-spacing: -0.5px; - font-family: HomepageBaukasten; - margin-bottom : 50px; - color : #0d0d0d; - } - &--subtitle{ - color : #0d0d0d; - } - } - &__exp{ - margin-top : 20px; - margin-bottom : 30px; - color : #3d3d3d; - } - &__button{ - width : 164px; - height : 40px; - color : #ffffff; - background-color : #3d3d3d; - border-radius: 50px; - } - } - .middle{ - &__title{ - &--title{ - color : #0d0d0d; - } - &--subtitle{ - color : #6f6f6f; - margin-top : 20px; - margin-bottom : 40px; - } - } - &__exp{ - color : #8b8b8b; - } - } - .learnMyself{ - padding-top : 435px; - width : 1109px; - &__container--card{ - margin-top :80px; - display : flex; - width : 1109px; - justify-content : space-between; - } - &__img--card{ - width : 254px; - height : 259px; - width: 254px; - height: 259px; - } - } - .shareTogether{ - width : 1109px; - padding-top : 270px; - padding-bottom : 151px; - &__title{ - color : #3d3d3d; - margin-top : 10px; - } - &__container{ - &--photo1{ - margin-top : 90px; - display : flex; - flex-direction : row; - } - &--photo2{ - margin-top : 153px; - display : flex; - flex-direction : row; - justify-content : space-between; - } - &--exp1{ - display : flex; - flex-direction: column; - align-items : flex-start; - padding-top : 58px; - } - &--exp2{ - display : flex; - flex-direction: column; - align-items : flex-start; - padding-top : 141px; - } - } - &__image1{ - width : 672px; - height : 449px; - margin-right : 93px; - } - &__image2{ - width: 464px; - height: 745px; - } - &__exp{ - &--type{ - color : #8b8b8b; - } - } - &__content{ - margin-top : 32px; - font-family: AppleSDGothicNeo; - font-size: 14px; - font-weight: normal; - font-stretch: normal; - font-style: normal; - line-height: 1.79; - letter-spacing: -0.5px; - color : #555555; - } - } - `; export default Home; diff --git a/src/pages/Home/style.ts b/src/pages/Home/style.ts new file mode 100644 index 00000000..6da0a486 --- /dev/null +++ b/src/pages/Home/style.ts @@ -0,0 +1,251 @@ +import { Button } from 'components/atoms'; +import Styled from 'styled-components'; +import { theme } from 'styled-tools'; + +export const TopWrapper = Styled.div` + padding-top : 178px; + width : 1109px; +`; + +export const O2Title = Styled.h1` + font-size: 90px; + font-weight: bold; + line-height: 0.62; + letter-spacing: -0.5px; + font-family: HomepageBaukasten; + margin-bottom : 50px; + color : #0d0d0d; +`; + +export const TopSubTitle = Styled.h2` + ${theme('font.dp2')}; + color : #0d0d0d; +`; + +export const TopExp = Styled.p` + ${theme('font.body4')}; + margin-top : 20px; + margin-bottom : 30px; + color : #3d3d3d; +`; + +export const ChallengeBtn = Styled(Button)` + ${theme('font.subhead2')}; + width : 164px; + height : 40px; + color : #ffffff; + background-color : #3d3d3d; + border-radius: 50px; +`; + +export const ChallengeWrapper = Styled.div` + padding-top : 435px; + width : 1109px; +`; + +export const MiddleTitle = Styled.h2` + ${theme('font.dp1_eng')}; + color : #0d0d0d; +`; + +export const MiddleSubTitle = Styled.h3` + ${theme('font.h1')}; + color : #6f6f6f; + margin-top : 20px; + margin-bottom : 40px; +`; + +export const MiddleExp = Styled.p` + ${theme('font.body4')}; + color : #8b8b8b; +`; + +export const ChallengeCardWrapper = Styled.ul` + margin-top :80px; + display : flex; + width : 1109px; + justify-content : space-between; +`; + +export const ChallengeCard = Styled.img` + width : 254px; + height : 259px; + width: 254px; + height: 259px; +`; + +export const ConcertWrapper = Styled.div` + width : 1109px; + padding-top : 270px; + padding-bottom : 151px; +`; + +export const ConcertWrapper1 = Styled.div` + margin-top : 90px; + display : flex; + flex-direction : row; +`; + +export const ConcertWrapper2 = Styled.div` + margin-top : 153px; + display : flex; + flex-direction : row; + justify-content : space-between; +`; + +export const ConcertImage1 = Styled.img` + width : 672px; + height : 449px; + margin-right : 93px; +`; + +export const ConcertImage2 = Styled.img` + width: 464px; + height: 745px; +`; + +export const ConcertExpContainer1 = Styled.div` + display : flex; + flex-direction: column; + align-items : flex-start; + padding-top : 58px; +`; + +export const ConcertExpContainer2 = Styled.div` + display : flex; + flex-direction: column; + align-items : flex-start; + padding-top : 141px; +`; + +export const ConcertExpType = Styled.p` + ${theme('font.body3')}; + color : #8b8b8b; +`; + +export const ConcertTitle = Styled.h1` + ${theme('font.h1')}; + color : #3d3d3d; + margin-top : 10px; +`; + +export const ConcertContent = Styled.p` + margin-top : 32px; + font-family: AppleSDGothicNeo; + font-size: 14px; + font-weight: normal; + font-stretch: normal; + font-style: normal; + line-height: 1.79; + letter-spacing: -0.5px; + color : #555555; +`; + +export const O2SpeakerWrapper = Styled.div` + width : 100vw; + background-color : #2f3438; + display : flex; + flex-direction : column; + align-items : center; + padding : 120px 0; +`; + +export const O2SpeakerTitle = Styled.h1` + ${theme('font.dp1_eng')}; + color : #ffffff; +`; + +export const O2SpeakerSubTitle = Styled.h2` + ${theme('font.subhead4')}; + color : #a5a5a5; + margin-top : 20px; + margin-bottom : 138px; +`; + +export const O2SpeakerOuterWrapper = Styled.ul` + width : 1100px; + display : flex; + flex-direction : row; + justify-content : space-between; +`; + +export const O2SpeakerInnerWrapper = Styled.li` + display : flex; + flex-direction : column; + align-items : center; +`; + +export const O2SpeakerBadgeImage = Styled.img` + width: 260px; + height: 260px; +`; + +export const O2SpaekerExp = Styled.p` + ${theme('font.body4')}; + color : #ffffff; + text-align: center; + margin-top : 48px; +`; + +export const O2BadgeWrapper = Styled.div` + padding-top : 150px; + display : flex; + flex-direction: column; + align-items : center; +`; + +export const O2BadgeTitle = Styled.h1` + ${theme('font.dp1_eng')}; + color : #0d0d0d; + margin-bottom : 20px; +`; + +export const O2BadgeSubTitle = Styled.h2` + ${theme('font.subhead4')}; + color : #6f6f6f; + margin-bottom : 150px; +`; + +export const BadgeWrapper = Styled.ul` + display : grid; + grid-template-columns: repeat(2, 1fr); + grid-column-gap: 468px; + grid-row-gap: 100px; +`; + +export const LinkWrapper = Styled.div` + width : 100%; + padding-top : 208px; + margin-top : 150px; + padding-bottom : 187px; + background-color : #2f3438; + display : flex; + justify-content : center; + align-items : center; + gap : 110px; +`; + +export const LinkCardWrapper = Styled.div` + display : flex; + flex-direction : column; +`; + +export const LinkTitle = Styled.h1` + ${theme('font.h1_eng')}; + color : #ffffff; + height : 68px; +`; + +export const LinkExp = Styled.p` + ${theme('font.body4')}; + color : #dfdfdf; + margin : 31px 0; +`; + +export const LinkBtn = Styled(Button)` + ${theme('font.subhead4_eng')}; + width: 200px; + height: 60px; + background-color : #36c8f5; + color : #ffffff; +`; From 3144c2245e04b268b9e531f773ecb2b8395fa182 Mon Sep 17 00:00:00 2001 From: Subin Date: Fri, 6 Aug 2021 10:47:28 +0900 Subject: [PATCH 08/80] =?UTF-8?q?Refactor:=20reveal=EC=86=8D=EC=84=B1=20?= =?UTF-8?q?=EC=A3=BC=EC=84=9D=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Home/index.tsx | 236 +++++++++++++++++++-------------------- 1 file changed, 118 insertions(+), 118 deletions(-) diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index 385aac16..70f4e326 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -112,14 +112,14 @@ function Home(): React.ReactElement { 배운 점을 적용하며 더 성장한 내일의 나를 만들어요. - - - - - - - - + {/* */} + + + + + + + {/* */} @@ -178,122 +178,122 @@ function Home(): React.ReactElement { To Be an O2 Speaker 뱃지를 모아 O2 Speaker가 되어보세요! - - - - - - 챌린지 개수를 주당
- 3개 이상으로 설정 -
-
- - - - 런마쎌을 80%이상 작성 후
- 챌린지뱃지를 획득 -
-
- - - - 챌린지뱃지 3개 + 활동뱃지 12개
- 얻을 시 연사가능 -
-
-
-
+ {/* */} + + + + + 챌린지 개수를 주당
+ 3개 이상으로 설정 +
+
+ + + + 런마쎌을 80%이상 작성 후
+ 챌린지뱃지를 획득 +
+
+ + + + 챌린지뱃지 3개 + 활동뱃지 12개
+ 얻을 시 연사가능 +
+
+
+ {/*
*/} O2 Badge 열심히 활동하면 멋진 오투의 뱃지들을 받을 수 있어요. - - - - 첫 회원가입을 했을 때
- 받을 수 있는 뱃지예요. - - } - /> - - 타인의 Learn Myself를 처음 스크랩 -
- 했을 때 받을 수 있는 뱃지에요. - - } - /> - - 타인의 Learn Myself에 댓글 5개를
- 작성할 시 받을 수 있는 뱃지에요. - - } - /> - - 타인의 글의 좋아요를 처음
- 눌렀을 때 받을 수 있는 뱃지에요. - - } - /> - - 타인의 글에 댓글을 처음
- 달았을 때 받을 수 있는 뱃지에요. - - } - /> - - 오투에 3일 연속 로그인
- 했을 때 받을 수 있는 뱃지에요. - - } - /> - - Learn Myself 첫 작성 시
- 받을 수 있는 뱃지에요. - - } - /> - - 타인의 댓글의 답글을 처음 달았을 때
- 받을 수 있는 뱃지에요. - - } - /> -
-
+ {/* */} + + + 첫 회원가입을 했을 때
+ 받을 수 있는 뱃지예요. + + } + /> + + 타인의 Learn Myself를 처음 스크랩 +
+ 했을 때 받을 수 있는 뱃지에요. + + } + /> + + 타인의 Learn Myself에 댓글 5개를
+ 작성할 시 받을 수 있는 뱃지에요. + + } + /> + + 타인의 글의 좋아요를 처음
+ 눌렀을 때 받을 수 있는 뱃지에요. + + } + /> + + 타인의 글에 댓글을 처음
+ 달았을 때 받을 수 있는 뱃지에요. + + } + /> + + 오투에 3일 연속 로그인
+ 했을 때 받을 수 있는 뱃지에요. + + } + /> + + Learn Myself 첫 작성 시
+ 받을 수 있는 뱃지에요. + + } + /> + + 타인의 댓글의 답글을 처음 달았을 때
+ 받을 수 있는 뱃지에요. + + } + /> +
+ {/*
*/}
From a8b5d7fd68ee6d5b998eec68df071088e490ea8d Mon Sep 17 00:00:00 2001 From: Subin Date: Fri, 6 Aug 2021 10:52:11 +0900 Subject: [PATCH 09/80] =?UTF-8?q?Refactor:=20BadgeCard=20style=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/BadgeCard/index.tsx | 27 +++---------------- src/components/molecules/BadgeCard/style.ts | 28 ++++++++++++++++++++ 2 files changed, 32 insertions(+), 23 deletions(-) create mode 100644 src/components/molecules/BadgeCard/style.ts diff --git a/src/components/molecules/BadgeCard/index.tsx b/src/components/molecules/BadgeCard/index.tsx index e0ab4a19..8f59964b 100644 --- a/src/components/molecules/BadgeCard/index.tsx +++ b/src/components/molecules/BadgeCard/index.tsx @@ -1,5 +1,6 @@ import React from 'react'; import Styled from 'styled-components'; +import { Exp, Image, SBadgeCard, Title } from './style'; export interface IProps { className?: string; @@ -11,31 +12,11 @@ export interface IProps { function BadgeCard({ title, explain, img }: IProps): React.ReactElement { return ( - -

{title}

-

{explain}

+ + {title} + {explain}
); } -const SBadgeCard = Styled.div` - display : flex; - flex-direction : column; - align-items : center; - .image{ - width : 130px; - height : 130px; - } - .title{ - margin-top: 10px; - margin-bottom : 15px; - color : #555555; - } - .explain{ - text-align : center; - white-space : nowrap; - color : #555555; - } -`; - export default BadgeCard; diff --git a/src/components/molecules/BadgeCard/style.ts b/src/components/molecules/BadgeCard/style.ts new file mode 100644 index 00000000..8c3ea97a --- /dev/null +++ b/src/components/molecules/BadgeCard/style.ts @@ -0,0 +1,28 @@ +import { Button } from 'components/atoms'; +import Styled from 'styled-components'; +import { theme } from 'styled-tools'; + +export const Image = Styled.img` + width : 130px; + height : 130px; +`; + +export const Title = Styled.h1` + ${theme('font.subhead4')}; + margin-top: 10px; + margin-bottom : 15px; + color : #555555; +`; + +export const Exp = Styled.p` + ${theme('font.body3')}; + text-align : center; + white-space : nowrap; + color : #555555; +`; + +export const SBadgeCard = Styled.div` + display : flex; + flex-direction : column; + align-items : center; +`; From 84d1c58d50cc51d6c2f7e02c42fbe485a7c123fb Mon Sep 17 00:00:00 2001 From: Subin Date: Fri, 6 Aug 2021 11:04:31 +0900 Subject: [PATCH 10/80] =?UTF-8?q?Refactor:=20o2=EC=8A=A4=ED=94=BC=EC=BB=A4?= =?UTF-8?q?=EC=84=A4=EB=AA=85=20=EB=AA=A8=EB=93=88=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/BadgeCard/style.ts | 1 - .../molecules/SpeakerExpCard/index.tsx | 22 ++++++++++++ .../molecules/SpeakerExpCard/style.ts | 20 +++++++++++ src/components/molecules/index.ts | 1 + src/pages/Home/index.tsx | 35 ++++--------------- src/pages/Home/style.ts | 20 +---------- 6 files changed, 51 insertions(+), 48 deletions(-) create mode 100644 src/components/molecules/SpeakerExpCard/index.tsx create mode 100644 src/components/molecules/SpeakerExpCard/style.ts diff --git a/src/components/molecules/BadgeCard/style.ts b/src/components/molecules/BadgeCard/style.ts index 8c3ea97a..a63ffb4e 100644 --- a/src/components/molecules/BadgeCard/style.ts +++ b/src/components/molecules/BadgeCard/style.ts @@ -1,4 +1,3 @@ -import { Button } from 'components/atoms'; import Styled from 'styled-components'; import { theme } from 'styled-tools'; diff --git a/src/components/molecules/SpeakerExpCard/index.tsx b/src/components/molecules/SpeakerExpCard/index.tsx new file mode 100644 index 00000000..1895fdcd --- /dev/null +++ b/src/components/molecules/SpeakerExpCard/index.tsx @@ -0,0 +1,22 @@ +import React from 'react'; +import { Exp, Image, SSpeakerExpCard } from './style'; + +export interface IProps { + exp1: string; + exp2: string; + img: string; +} + +function SpeakerExpCard({ exp1, exp2, img }: IProps): React.ReactElement { + return ( + + + + {exp1}
+ {exp2} +
+
+ ); +} + +export default SpeakerExpCard; diff --git a/src/components/molecules/SpeakerExpCard/style.ts b/src/components/molecules/SpeakerExpCard/style.ts new file mode 100644 index 00000000..68aad87a --- /dev/null +++ b/src/components/molecules/SpeakerExpCard/style.ts @@ -0,0 +1,20 @@ +import Styled from 'styled-components'; +import { theme } from 'styled-tools'; + +export const Image = Styled.img` + width: 260px; + height: 260px; +`; + +export const Exp = Styled.p` + ${theme('font.body4')}; + color : #ffffff; + text-align: center; + margin-top : 48px; +`; + +export const SSpeakerExpCard = Styled.div` + display : flex; + flex-direction : column; + align-items : center; +`; diff --git a/src/components/molecules/index.ts b/src/components/molecules/index.ts index 30f09c3f..b4484074 100644 --- a/src/components/molecules/index.ts +++ b/src/components/molecules/index.ts @@ -38,3 +38,4 @@ export { default as RegisterHeader } from './RegisterHeader'; export { default as ChallengeReCommentList, default as ReplyComment } from './ReplyComment'; export { default as SearchBar } from './SearchBar'; export { default as SingleComment } from './SingleComment'; +export { default as SpeakerExpCard } from './SpeakerExpCard'; diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index 70f4e326..70e1c33b 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -20,7 +20,7 @@ import { UsefulLearnMyselfFillIcon, WelcomeToO2FillIcon, } from 'assets/images'; -import { BadgeCard } from 'components/molecules'; +import { BadgeCard, SpeakerExpCard } from 'components/molecules'; import React, { useEffect, useState } from 'react'; import Reveal from 'react-awesome-reveal'; import { Link } from 'react-router-dom'; @@ -52,10 +52,7 @@ import { O2BadgeSubTitle, O2BadgeTitle, O2BadgeWrapper, - O2SpaekerExp, - O2SpeakerBadgeImage, - O2SpeakerInnerWrapper, - O2SpeakerOuterWrapper, + O2SpeakerCardWrapper, O2SpeakerSubTitle, O2SpeakerTitle, O2SpeakerWrapper, @@ -179,29 +176,11 @@ function Home(): React.ReactElement { 뱃지를 모아 O2 Speaker가 되어보세요! {/* */} - - - - - 챌린지 개수를 주당
- 3개 이상으로 설정 -
-
- - - - 런마쎌을 80%이상 작성 후
- 챌린지뱃지를 획득 -
-
- - - - 챌린지뱃지 3개 + 활동뱃지 12개
- 얻을 시 연사가능 -
-
-
+ + + + + {/*
*/} diff --git a/src/pages/Home/style.ts b/src/pages/Home/style.ts index 6da0a486..ff24e476 100644 --- a/src/pages/Home/style.ts +++ b/src/pages/Home/style.ts @@ -162,31 +162,13 @@ export const O2SpeakerSubTitle = Styled.h2` margin-bottom : 138px; `; -export const O2SpeakerOuterWrapper = Styled.ul` +export const O2SpeakerCardWrapper = Styled.ul` width : 1100px; display : flex; flex-direction : row; justify-content : space-between; `; -export const O2SpeakerInnerWrapper = Styled.li` - display : flex; - flex-direction : column; - align-items : center; -`; - -export const O2SpeakerBadgeImage = Styled.img` - width: 260px; - height: 260px; -`; - -export const O2SpaekerExp = Styled.p` - ${theme('font.body4')}; - color : #ffffff; - text-align: center; - margin-top : 48px; -`; - export const O2BadgeWrapper = Styled.div` padding-top : 150px; display : flex; From 4620628fe193be768ecee27156c911ece99cda29 Mon Sep 17 00:00:00 2001 From: Subin Date: Fri, 6 Aug 2021 12:00:15 +0900 Subject: [PATCH 11/80] =?UTF-8?q?Style:=20=ED=8C=94=EB=A0=88=ED=8A=B8=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/atoms/StyledInput/style.ts | 15 +++--- .../molecules/AdminChallengeCard/style.ts | 10 ++-- .../molecules/AdminChallengeOpenForm/style.ts | 6 +-- .../molecules/AdminWriteForm/style.ts | 14 +++--- src/components/molecules/BadgeCard/style.ts | 6 +-- src/components/molecules/DropDown/style.ts | 17 ++++--- .../molecules/DropDownMulti/style.ts | 25 +++++----- src/components/molecules/HamDropDown/style.ts | 12 ++--- src/components/molecules/JoinCheck/style.ts | 10 ++-- src/components/molecules/LoginForm/style.ts | 5 +- .../molecules/SpeakerExpCard/style.ts | 4 +- .../organisms/AdminChallengeList/style.ts | 10 ++-- .../organisms/AdminChallengeOpen/style.ts | 22 +++++---- src/components/organisms/AdminWrite/style.ts | 14 +++--- src/components/organisms/Hamburger/style.ts | 30 ++++++------ src/components/organisms/Header/style.ts | 3 +- src/components/organisms/Join/style.ts | 49 ++++++++++--------- src/components/organisms/Login/style.ts | 7 +-- src/pages/Home/style.ts | 40 +++++++-------- 19 files changed, 157 insertions(+), 142 deletions(-) diff --git a/src/components/atoms/StyledInput/style.ts b/src/components/atoms/StyledInput/style.ts index b3a91f50..5935408f 100644 --- a/src/components/atoms/StyledInput/style.ts +++ b/src/components/atoms/StyledInput/style.ts @@ -1,11 +1,11 @@ import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const Input = Styled.input` border : none; ${theme('font.body1')}; font-size: 16px; - color : #0d0d0d; + color : ${palette('grayscale', 10)}; text-align: left; width : 100%; height : 100%; @@ -13,7 +13,7 @@ export const Input = Styled.input` border-radius: 4px; font-style: AppleSDGothicNeo; :placeholder{ - color : #c1c1c1; + color : ${palette('grayscale', 2)} } :focus{ outline : none; @@ -27,12 +27,13 @@ export const InputContainer = Styled.div<{ width: string; height: string; condit 1 : 컨디션 O */ border : ${(props) => props.condition == -1 - ? 'solid 1px #c1c1c1' + ? `solid 1px ${palette('grayscale', 2)}` : props.condition == 1 ? 'double 1px transparent' - : 'solid 1px #f66436'}; + : `solid 1px ${palette('primary', 6)}`}; background-image : ${(props) => - props.condition == 1 && 'linear-gradient(white, white), linear-gradient(to right, #36c8f5,#13e2dd)'}; + props.condition == 1 && + `linear-gradient(white, white), linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)})`}; background-origin : ${(props) => props.condition == 1 && 'border-box'}; background-clip : ${(props) => props.condition == 1 && 'content-box, border-box'}; border-radius : 4px; @@ -53,7 +54,7 @@ export const ErrorMsg = Styled.div` ${theme('font.body2')}; text-align : left; text-align: left; - color: #f66436; + color: ${palette('primary', 6)}; `; export const SStyledInput = Styled.div<{ diff --git a/src/components/molecules/AdminChallengeCard/style.ts b/src/components/molecules/AdminChallengeCard/style.ts index b9ead194..0f15221d 100644 --- a/src/components/molecules/AdminChallengeCard/style.ts +++ b/src/components/molecules/AdminChallengeCard/style.ts @@ -1,15 +1,15 @@ import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const Label = Styled.div` ${theme('font.body3')}; margin-right : 41px; width : 90px; - color:#6f6f6f; + color:${palette('grayscale', 5)};; `; export const Exp = Styled.div` ${theme('font.subhead3')}; - color : #6f6f6f; + color : ${palette('grayscale', 5)};; `; export const RowContainer = Styled.div` display : flex; @@ -35,7 +35,7 @@ export const Title = Styled.div` width : 322px; line-height: 1.31; letter-spacing: -0.5px; - color : #3d3d3d; + color : ${palette('grayscale', 7)};; font-size: 32px; font-weight: bold; `; @@ -45,7 +45,7 @@ export const SAdminChallengeCard = Styled.div` align-items : center; border-radius: 18px; box-shadow: 0 0 24px 0 rgba(13, 12, 63, 0.1); - background-color: #ffffff; + background-color: ${palette('grayscale', 0)};; cursor : pointer; width: 402px; height: 484px; diff --git a/src/components/molecules/AdminChallengeOpenForm/style.ts b/src/components/molecules/AdminChallengeOpenForm/style.ts index 759f5c1a..df1babe9 100644 --- a/src/components/molecules/AdminChallengeOpenForm/style.ts +++ b/src/components/molecules/AdminChallengeOpenForm/style.ts @@ -1,11 +1,11 @@ import { Label } from 'components/atoms'; import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const WriteLabel = Styled(Label)` ${theme('font.subhead4')}; width : 100%; - color: #0d0d0d; + color: ${palette('grayscale', 9)}; margin-bottom : 8px; `; @@ -26,7 +26,7 @@ export const PeopleContainer = Styled.div` export const Text = Styled.div<{ style: string }>` ${theme(`font.style`)}; line-height : 60px; - color : #8b8b8b; + color : ${palette('grayscale', 4)}; `; export const Wrapper = Styled.div` diff --git a/src/components/molecules/AdminWriteForm/style.ts b/src/components/molecules/AdminWriteForm/style.ts index d24b184f..67dfca5f 100644 --- a/src/components/molecules/AdminWriteForm/style.ts +++ b/src/components/molecules/AdminWriteForm/style.ts @@ -1,10 +1,10 @@ import { Input, Label } from 'components/atoms'; import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const UploadDescription = Styled.div` ${theme('font.subhead3')}; - color : #a5a5a5; + color : ${palette('grayscale', 3)}; text-align: center; margin-top :4px; margin-bottom : 20px; @@ -72,9 +72,11 @@ export const HashTagInput = Styled(Input)` padding : 18px 20px; `; export const HashTagInputContainer = Styled.div<{ isFocused: boolean }>` - border : ${(props) => (props.isFocused ? 'double 1px transparent' : '1px solid #c1c1c1')}; + border : ${(props) => (props.isFocused ? 'double 1px transparent' : `1px solid ${palette('grayscale', 2)}`)}; background-image : ${(props) => - props.isFocused ? 'linear-gradient(white, white), linear-gradient(to right, #36c8f5,#13e2dd)' : undefined}; + props.isFocused + ? `linear-gradient(white, white), linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)})` + : undefined}; background-origin : ${(props) => (props.isFocused ? 'border-box' : undefined)}; background-clip : ${(props) => (props.isFocused ? 'content-box, border-box' : undefined)}; width : 100%; @@ -93,14 +95,14 @@ export const HashTagContainer = Styled.div` export const WriteLabel = Styled(Label)` ${theme('font.subhead4')}; width : 100%; - color: #0d0d0d; + color: ${palette('grayscale', 9)}; margin-bottom : 8px; `; export const HashTag = Styled.div` ${theme('font.body2')}; padding : 5px 10px; background-color: #f5f5f5; - color : #a5a5a5; + color : ${palette('grayscale', 3)}; min-height : 31px; max-width : 100%; white-space : break-all; diff --git a/src/components/molecules/BadgeCard/style.ts b/src/components/molecules/BadgeCard/style.ts index a63ffb4e..70f7e4c5 100644 --- a/src/components/molecules/BadgeCard/style.ts +++ b/src/components/molecules/BadgeCard/style.ts @@ -1,5 +1,5 @@ import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const Image = Styled.img` width : 130px; @@ -10,14 +10,14 @@ export const Title = Styled.h1` ${theme('font.subhead4')}; margin-top: 10px; margin-bottom : 15px; - color : #555555; + color : ${palette('grayscale', 6)}; `; export const Exp = Styled.p` ${theme('font.body3')}; text-align : center; white-space : nowrap; - color : #555555; + color : ${palette('grayscale', 6)}; `; export const SBadgeCard = Styled.div` diff --git a/src/components/molecules/DropDown/style.ts b/src/components/molecules/DropDown/style.ts index bdaee3e3..b40dc3f8 100644 --- a/src/components/molecules/DropDown/style.ts +++ b/src/components/molecules/DropDown/style.ts @@ -1,12 +1,12 @@ import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const Item = Styled.span<{ page: string }>` ${theme('font.body1')}; font-size: 16px; width : 100%; display: block; - color:${(props) => (props.page === 'adminwrite' ? '#0d0d0d' : '#8b8b8b')}; + color:${(props) => (props.page === 'adminwrite' ? `${palette('grayscale', 9)}` : `${palette('grayscale', 4)}`)}; `; export const SummaryOuter = Styled.div<{ @@ -22,11 +22,12 @@ export const SummaryOuter = Styled.div<{ border-radius: 4px; display : flex; align-items : center; - border : ${(props) => (props.isOpen || props.isChecked ? 'double 1px transparent' : '1px solid #c1c1c1')}; + border : ${(props) => + props.isOpen || props.isChecked ? 'double 1px transparent' : `1px solid ${palette('grayscale', 1)}`}; background-image : ${(props) => props.isOpen || props.isChecked - ? 'linear-gradient(white, white), linear-gradient(to right, #36c8f5,#13e2dd)' + ? `linear-gradient(white, white), linear-gradient(to right, ${palette('primary', 3)},${palette('primary', 0)})` : undefined}; background-origin : ${(props) => (props.isOpen || props.isChecked ? 'border-box' : undefined)}; @@ -62,7 +63,7 @@ export const Line = Styled.div<{ page: string; isSetting?: boolean }>` padding : 0; width:${(props) => (props.isSetting ? '804px' : props.page === 'adminwrite' ? '100%' : '370px')}; height : 1px; - background-color : #dfdfdf; + background-color : ${palette('grayscale', 1)}; margin : 13px 0 14px 0 ; `; @@ -71,14 +72,14 @@ export const ListContainer = Styled.div<{ page: string; isSetting?: boolean }>` max-height:${(props) => (props.page === 'adminwrite' ? '220px' : undefined)}; overflow:${(props) => (props.page === 'adminwrite' ? 'scroll' : undefined)}; margin-top: 5px; - border: 1px solid #c1c1c1; + border: 1px solid ${palette('grayscale', 2)}; border-radius: 4px; display: flex; flex-direction: column; padding: 20px 18px; position:${(props) => (props.page === 'adminwrite' ? 'absolute' : undefined)}; z-index : 10; - background-color : #ffffff; + background-color : ${palette('grayscale', 0)}; `; export const Label = Styled.label` @@ -92,6 +93,6 @@ export const Input = Styled.input` visibility: hidden; position: absolute; :checked + span { - color: #36c8f5; + color: ${palette('primary', 3)}; } `; diff --git a/src/components/molecules/DropDownMulti/style.ts b/src/components/molecules/DropDownMulti/style.ts index b9ad69d8..1e3bb071 100644 --- a/src/components/molecules/DropDownMulti/style.ts +++ b/src/components/molecules/DropDownMulti/style.ts @@ -1,12 +1,12 @@ import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const Item = Styled.span` ${theme('font.body1')}; font-size: 16px; - width : 100%; + width: 100%; display: block; - color: #8b8b8b; + color: ${palette('grayscale', 4)}; `; export const SummaryOuter = Styled.div<{ @@ -20,11 +20,12 @@ export const SummaryOuter = Styled.div<{ border-radius: 4px; display : flex; align-items : center; - border : ${(props) => (props.isOpen || props.isChecked ? 'double 1px transparent' : '1px solid #c1c1c1')}; + border : ${(props) => + props.isOpen || props.isChecked ? 'double 1px transparent' : `1px solid ${palette('grayscale', 1)}`}; background-image : ${(props) => props.isOpen || props.isChecked - ? 'linear-gradient(white, white), linear-gradient(to right, #36c8f5,#13e2dd)' + ? `linear-gradient(white, white), linear-gradient(to right, ${palette('primary', 3)},${palette('primary', 0)})` : undefined}; background-origin : ${(props) => (props.isOpen || props.isChecked ? 'border-box' : undefined)}; @@ -44,7 +45,7 @@ export const SummaryInner = Styled.div` export const SummaryValue = Styled.div<{ state: string[] }>` ${theme('font.body1')}; font-size: 16px; - color: ${(props) => props.state.length === 0 && '#c1c1c1'}; + color: ${(props) => props.state.length === 0 && `${palette('grayscale', 2)}`}; `; export const Arrow = Styled.img` @@ -56,7 +57,7 @@ export const Line = Styled.div` padding : 0; width:804px; height : 1px; - background-color : #dfdfdf; + background-color : ${palette('grayscale', 1)}; margin : 13px 0 14px 0 ; `; @@ -64,13 +65,13 @@ export const ListContainer = Styled.div` width:844px; height: 212px; margin-top: 5px; - border: 1px solid #c1c1c1; + border: 1px solid ${palette('grayscale', 2)}; border-radius: 4px; display: flex; flex-direction: column; padding: 20px 18px; z-index : 10; - background-color : #ffffff; + background-color : ${palette('grayscale', 0)}; overflow-y: scroll; ::-webkit-scrollbar { width: 4px; @@ -82,12 +83,12 @@ export const ListContainer = Styled.div` } /* Handle */ ::-webkit-scrollbar-thumb { - background: #dfdfdf; + background: ${palette('grayscale', 1)}; border-radius: 20px; } /* Handle on hover */ ::-webkit-scrollbar-thumb:hover { - background: #c1c1c1; + background: ${palette('grayscale', 2)}; } `; @@ -102,6 +103,6 @@ export const Input = Styled.input` visibility: hidden; position: absolute; :checked + span { - color: #36c8f5; + color: ${palette('primary', 3)}; } `; diff --git a/src/components/molecules/HamDropDown/style.ts b/src/components/molecules/HamDropDown/style.ts index ce834d9c..07934abf 100644 --- a/src/components/molecules/HamDropDown/style.ts +++ b/src/components/molecules/HamDropDown/style.ts @@ -1,6 +1,6 @@ import { Button } from 'components/atoms'; import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const LabelIcon = Styled.img` width: 20px; @@ -25,7 +25,7 @@ export const Title = Styled(Button)` display : flex; align-items : center; justify-content : center; -color : #3d3d3d; +color : ${palette('grayscale', 7)}; `; export const Detail = Styled.div` @@ -57,12 +57,12 @@ width: 0.3rem; background: none; } ::-webkit-scrollbar-thumb { - background: #c1c1c1; + background: ${palette('grayscale', 2)}; border-radius: 0.5rem; box-sizing: border-box; } ::-webkit-scrollbar-thumb:hover { - background: #c1c1c1; + background: ${palette('grayscale', 2)}; } `; @@ -70,7 +70,7 @@ export const DetailBtn = Styled(Button)` ${theme('font.body2_eng')} height: 18px; margin: 5px 0; -color : #8b8b8b; +color : ${palette('grayscale', 4)}; white-space: nowrap; :hover{ ${theme('font.subhead2_eng')}; @@ -85,7 +85,7 @@ line-height : 30px; export const Hide = Styled.div` width : 100%; height : 36px; -background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0), #ffffff); +background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0), ${palette('grayscale', 0)}); position : absolute; bottom : 0px; `; diff --git a/src/components/molecules/JoinCheck/style.ts b/src/components/molecules/JoinCheck/style.ts index 05489ed3..6fd08c37 100644 --- a/src/components/molecules/JoinCheck/style.ts +++ b/src/components/molecules/JoinCheck/style.ts @@ -1,6 +1,6 @@ import { Button, CheckBox } from 'components/atoms'; import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const BiggerCheckBox = Styled(CheckBox)` display:none; @@ -25,7 +25,7 @@ export const PolicyCheck = Styled.div` export const Line = Styled.div` margin-top : 18px; - background-color: #c4c4c4; + background-color: ${palette('grayscale', 10)}; width: 406px; height: 2px; `; @@ -45,14 +45,14 @@ export const BiggerLabel = Styled.label` export const MoreBtn = Styled(Button)` ${theme('font.body2')}; - color : #a5a5a5; + color : ${palette('grayscale', 3)}; `; export const Titie = Styled.div` ${theme('font.h1')}; margin-bottom : 40px; text-align: left; - color : #0d0d0d; + color : ${palette('grayscale', 9)}; `; export const Content = Styled.p` @@ -88,7 +88,7 @@ export const ModalContainer = Styled.div` align-items : center; margin : auto; border-radius: 16px; - background-color : #ffffff; + background-color : ${palette('grayscale', 0)}; padding : 50px 50px 40px 40px; width : 600px; height : 730px; diff --git a/src/components/molecules/LoginForm/style.ts b/src/components/molecules/LoginForm/style.ts index 4a076dde..23206050 100644 --- a/src/components/molecules/LoginForm/style.ts +++ b/src/components/molecules/LoginForm/style.ts @@ -1,5 +1,6 @@ import { Button } from 'components/atoms'; import Styled from 'styled-components'; +import { palette } from 'styled-tools'; export const LoginformWrap = Styled.div` display : flex; @@ -9,10 +10,10 @@ export const LoginformWrap = Styled.div` export const LoginBtn = Styled(Button)` margin-top : 14px; border-radius: 4px; - background-image: linear-gradient(to right, #36c8f5,#13e2dd ); + background-image: linear-gradient(to right, ${palette('primary', 3)},${palette('primary', 0)} ); width: 406px; height: 60px; - color : #ffffff; + color : ${palette('grayscale', 0)}; font-size : 16px; font-weight : bold; `; diff --git a/src/components/molecules/SpeakerExpCard/style.ts b/src/components/molecules/SpeakerExpCard/style.ts index 68aad87a..b3acca20 100644 --- a/src/components/molecules/SpeakerExpCard/style.ts +++ b/src/components/molecules/SpeakerExpCard/style.ts @@ -1,5 +1,5 @@ import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const Image = Styled.img` width: 260px; @@ -8,7 +8,7 @@ export const Image = Styled.img` export const Exp = Styled.p` ${theme('font.body4')}; - color : #ffffff; + color : ${palette('grayscale', 0)}; text-align: center; margin-top : 48px; `; diff --git a/src/components/organisms/AdminChallengeList/style.ts b/src/components/organisms/AdminChallengeList/style.ts index dceb2644..baef0977 100644 --- a/src/components/organisms/AdminChallengeList/style.ts +++ b/src/components/organisms/AdminChallengeList/style.ts @@ -1,10 +1,10 @@ import { Label } from 'components/atoms'; import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const AddExp = Styled.div` ${theme('font.subhead5')} -color : #dfdfdf; +color : ${palette('grayscale', 1)}; `; export const AddImage = Styled.img` @@ -19,7 +19,7 @@ flex-direction : column; align-items : center; border-radius: 18px; box-shadow: 0 0 24px 0 rgba(13, 12, 63, 0.1); -background-color : #ffffff; +background-color : ${palette('grayscale', 0)}; width: 402px; height: 484px; height: 484px; @@ -37,7 +37,7 @@ export const PageLabel = Styled(Label)` margin-top : 60px; line-height: 1.5; letter-spacing: -0.5px; -color : #3d3d3d; +color : ${palette('grayscale', 7)}; font-size: 16px; `; @@ -45,7 +45,7 @@ export const Title = Styled(Label)` ${theme('font.dp4')} margin-top:10px; margin-bottom : 110px; -color:#3d3d3d; +color:${palette('grayscale', 7)}; `; export const Wrapper = Styled.div` diff --git a/src/components/organisms/AdminChallengeOpen/style.ts b/src/components/organisms/AdminChallengeOpen/style.ts index 79760df8..e81e05b5 100644 --- a/src/components/organisms/AdminChallengeOpen/style.ts +++ b/src/components/organisms/AdminChallengeOpen/style.ts @@ -1,15 +1,15 @@ import { Button, CheckBox, Label } from 'components/atoms'; import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const PhotoUploadBottomDesc = Styled.div` ${theme('font.body2_eng')} - color : #a5a5a5; + color : ${palette('grayscale', 3)}; `; export const PhotoUploadMiddleDesc = Styled.div` ${theme('font.subhead3')} - color : #a5a5a5; + color : ${palette('grayscale', 3)}; text-align: center; margin-top :4px; margin-bottom : 20px; @@ -32,7 +32,7 @@ export const PhotoUploadContainer = Styled.div` export const CheckExp = Styled.label` ${theme('font.body4')} - color : #8b8b8b; + color : ${palette('grayscale', 4)}; display : flex; align-items : center; `; @@ -51,7 +51,7 @@ export const PageLabel = Styled(Label)` margin-top : 60px; line-height: 1.5; letter-spacing: -0.5px; - color : #3d3d3d; + color : ${palette('grayscale', 7)}; font-size: 16px; `; @@ -59,7 +59,7 @@ export const Title = Styled(Label)` ${theme('font.dp4')} margin-top:10px; margin-bottom : 110px; - color:#3d3d3d; + color:${palette('grayscale', 7)}; `; export const UploadContainer = Styled.div` @@ -74,7 +74,7 @@ export const CheckContainer = Styled.div` `; export const ElementLabel = Styled(Label)` ${theme('font.subhead4')} - color: #0d0d0d; + color: ${palette('grayscale', 9)}; margin-bottom :11px; `; @@ -84,10 +84,12 @@ export const OpenButton = Styled(Button)<{ isButtonDisabled?: boolean }>` width: 406px; height: 60px; border-radius: 4px; - color : #ffffff; + color : ${palette('grayscale', 0)}; background-image : ${(props) => - !props.isButtonDisabled ? 'linear-gradient(to right, #36c8f5,#13e2dd )' : '#dfdfdf'}; - background-color : ${(props) => (props.isButtonDisabled ? '#dfdfdf' : undefined)}; + !props.isButtonDisabled + ? `linear-gradient(to right, ${palette('primary', 3)},${palette('primary', 0)} )` + : `${palette('grayscale', 1)}`}; + background-color : ${(props) => (props.isButtonDisabled ? `${palette('grayscale', 1)}` : undefined)}; margin-bottom : 304px; `; diff --git a/src/components/organisms/AdminWrite/style.ts b/src/components/organisms/AdminWrite/style.ts index 8466c53b..57f5e5d9 100644 --- a/src/components/organisms/AdminWrite/style.ts +++ b/src/components/organisms/AdminWrite/style.ts @@ -1,12 +1,12 @@ import { Button, Label } from 'components/atoms'; import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const PageLabel = Styled(Label)` margin-top : 60px; line-height: 1.5; letter-spacing: -0.5px; - color : #3d3d3d; + color : ${palette('grayscale', 7)}; font-size: 16px; `; @@ -14,7 +14,7 @@ export const Title = Styled(Label)` ${theme('font.dp4')} margin-top:10px; margin-bottom : 110px; - color:#3d3d3d; + color:${palette('grayscale', 7)}; `; export const WriteButton = Styled(Button)<{ isButtonDisabled?: boolean }>` @@ -23,10 +23,12 @@ export const WriteButton = Styled(Button)<{ isButtonDisabled?: boolean }>` width: 406px; height: 60px; border-radius: 4px; - color : #ffffff; - background-color : ${(props) => (props.isButtonDisabled ? '#dfdfdf' : undefined)}; + color : ${palette('grayscale', 0)}; + background-color : ${(props) => (props.isButtonDisabled ? `${palette('grayscale', 1)}` : undefined)}; background-image : ${(props) => - !props.isButtonDisabled ? 'linear-gradient(to right, #36c8f5,#13e2dd )' : undefined}; + !props.isButtonDisabled + ? `linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)} )` + : undefined}; margin-bottom : 304px; `; diff --git a/src/components/organisms/Hamburger/style.ts b/src/components/organisms/Hamburger/style.ts index c094d354..47f39415 100644 --- a/src/components/organisms/Hamburger/style.ts +++ b/src/components/organisms/Hamburger/style.ts @@ -1,6 +1,6 @@ import { Button } from 'components/atoms'; import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const HamburgerContainer = Styled.div` display : flex; @@ -9,7 +9,7 @@ export const HamburgerContainer = Styled.div` flex-direction:column; z-index : 999; box-shadow: 0 4px 40px 0 rgba(30, 37, 98, 0.1); - background-color : #ffffff; + background-color : ${palette('grayscale', 0)}; width: 282px; height : 100vh; animation : slideIn 0.5s; @@ -29,7 +29,7 @@ export const HamburgerContainer = Styled.div` export const LogOutBtn = Styled.div` ${theme('font.body2')} font-size: 16px; - color: #8b8b8b; + color: ${palette('grayscale', 4)}; margin-left: 8px; margin-right: 24px; `; @@ -37,7 +37,7 @@ export const LogOutBtn = Styled.div` export const SettingBtn = Styled.div` ${theme('font.body2')} font-size: 16px; - color: #3d3d3d; + color: ${palette('grayscale', 7)}; `; export const BottomContainer = Styled.div` @@ -66,11 +66,11 @@ export const MiddleContainer = Styled.div` ::-webkit-scrollbar-thumb { box-sizing: border-box; border-radius: 0.5rem; - background: #c1c1c1; + background: ${palette('grayscale', 2)}; } /* Handle on hover */ ::-webkit-scrollbar-thumb:hover { - background: #c1c1c1; + background: ${palette('grayscale', 2)}; } `; @@ -93,12 +93,12 @@ export const UserNameLabel = Styled.div` ${theme('font.body2')}; font-size : 16px; margin-top : 28px; - color : #3d3d3d; + color : ${palette('grayscale', 7)}; `; export const UserIcon = Styled.img` margin : 120px 91px 0 91px; - border : 1px solid #dfdfdf; + border : 1px solid ${palette('grayscale', 1)}; border-radius:50px; width : 100px; height : 100px; @@ -112,7 +112,7 @@ export const NoLoginSubTitle = Styled.div` margin-bottom : 30px; -webkit-background-clip: text; background-clip: text; - background-image:linear-gradient(to right, #34caf4, #13e2dd); + background-image:linear-gradient(to right, #34caf4, ${palette('primary', 0)}); text-align : center; -webkit-text-fill-color: transparent; `; @@ -129,7 +129,7 @@ export const UnChallengeUserSubTitle = Styled(Button)<{ color?: string }>` `; export const ChallengeEndUser = Styled(Button)` - color: #03b6ce; + color: ${palette('primary', 5)}; ${theme('font.subhead3_eng')}; margin-top : 30px; `; @@ -150,13 +150,13 @@ export const LoginButton = Styled(Button)` export const LoginExp = Styled.div` ${theme('font.subhead3')}; height: 18px; - color : #3d3d3d; + color : ${palette('grayscale', 7)}; `; export const TitleBtn = Styled(Button)` margin : 10px 0; height : 20px; - color : #3d3d3d; + color : ${palette('grayscale', 7)}; font-family : AppleSDGothicNeo; font-size : 16px; :hover { @@ -167,7 +167,7 @@ export const TitleBtn = Styled(Button)` export const EngTitleBtn = Styled(Button)` margin : 10px 0; height : 20px; - color : #3d3d3d; + color : ${palette('grayscale', 7)}; font-size : 16px; font-family : HomepageBaukasten; :hover { @@ -177,7 +177,7 @@ export const EngTitleBtn = Styled(Button)` export const Line = Styled.div` margin : 20px 0; - background-color: #c1c1c1; + background-color: ${palette('grayscale', 2)}; width :164px; height: 1px; `; @@ -190,7 +190,7 @@ export const Padding = Styled.div` export const Hide = Styled.div` position : absolute; top:-50px; - background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0), #ffffff); + background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0), ${palette('grayscale', 0)}); width : 100%; height : 50px; `; diff --git a/src/components/organisms/Header/style.ts b/src/components/organisms/Header/style.ts index 50545d4c..674e47c3 100644 --- a/src/components/organisms/Header/style.ts +++ b/src/components/organisms/Header/style.ts @@ -1,4 +1,5 @@ import Styled from 'styled-components'; +import { palette } from 'styled-tools'; export const ButtonWrapper = Styled.div` display : flex; @@ -17,7 +18,7 @@ position: fixed; top:0; left:0; z-index:999; -background-color : #242424; +background-color : ${palette('grayscale', 8)}; width : 100vw; height : 60px; `; diff --git a/src/components/organisms/Join/style.ts b/src/components/organisms/Join/style.ts index 84930981..264bfd0d 100644 --- a/src/components/organisms/Join/style.ts +++ b/src/components/organisms/Join/style.ts @@ -1,6 +1,6 @@ import { Button, Label } from 'components/atoms'; import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const InterestButtonWrapper = Styled.div` display : flex; @@ -13,34 +13,34 @@ export const InterestButton = Styled(Button)<{ order: number }>` ${theme('font.subhead4')} background-color : ${(props) => props.order == 0 - ? '#13E2DD' + ? `${palette('primary', 0)}` : props.order == 1 - ? '#36C8F5' + ? `${palette('primary', 3)}` : props.order == 2 - ? '#58E2FF' + ? `${palette('primary', 2)}` : props.order == 3 - ? '#03B6CE' + ? `${palette('primary', 5)}` : props.order == 4 - ? '#00BAFA' - : '#ffffff'}}; + ? `${palette('primary', 4)}` + : `${palette('grayscale', 0)}`}}; padding : 12px 30px; margin : 12px 5px; height : 48px; border-radius: 60px; - border: solid 1px #8b8b8b; + border: solid 1px ${palette('grayscale', 4)}; border-color : ${(props) => props.order == 0 - ? '#13E2DD' + ? `${palette('primary', 0)}` : props.order == 1 - ? '#36C8F5' + ? `${palette('primary', 3)}` : props.order == 2 - ? '#58E2FF' + ? `${palette('primary', 2)}` : props.order == 3 - ? '#03B6CE' + ? `${palette('primary', 5)}` : props.order == 4 - ? '#00BAFA' - : '#8b8b8b'}; - color : ${(props) => (props.order == -1 ? '#8b8b8b' : '#ffffff')} + ? `${palette('primary', 4)}` + : `${palette('grayscale', 0)}`}}; + color : ${(props) => (props.order == -1 ? `${palette('grayscale', 4)}` : `${palette('grayscale', 0)}`)} ; `; @@ -49,16 +49,17 @@ export const ModalButton = Styled(Button)<{ selectedInterest: string[] }>` height: 60px; padding: 19px 172px 19px 170px; border-radius: 4px; - background-color : #dfdfdf; + background-color : ${palette('grayscale', 1)}; ${theme('font.subhead3')} - color : #ffffff; + color : ${palette('grayscale', 0)}; margin-top : 38px; - background-color : ${(props) => (props.selectedInterest.length > 0 ? '#0d0d0d' : '#dfdfdf')}; + background-color : ${(props) => + props.selectedInterest.length > 0 ? `${palette('grayscale', 9)}` : `${palette('grayscale', 1)}`}; `; export const ModalLabel = Styled(Label)` ${theme('font.h1')} - color : #0d0d0d; + color : ${palette('grayscale', 9)}; margin-bottom : 38px; `; @@ -74,7 +75,7 @@ export const ModalWrapper = Styled.div` border-radius: 16px; padding: 40px 100px; box-shadow: -4px 11px 24px 0 rgba(13, 12, 63, 0.1); - background-color : #ffffff; + background-color : ${palette('grayscale', 0)}; display : flex; flex-direction : column; align-items : center; @@ -92,11 +93,13 @@ export const JoinButton = Styled(Button)<{ isButtonDisabled: boolean }>` border-radius: 4px; font-size : 16px; font-weight : bold; - color : #ffffff; + color : ${palette('grayscale', 0)}; margin-top : 60px; - background-color : ${(props) => (props.isButtonDisabled ? '#dfdfdf' : undefined)}; + background-color : ${(props) => (props.isButtonDisabled ? `${palette('grayscale', 1)}` : undefined)}; background-image : ${(props) => - !props.isButtonDisabled ? 'linear-gradient(to right, #36c8f5,#13e2dd )' : undefined}; + !props.isButtonDisabled + ? `linear-gradient(to right, ${palette('primary', 3)},${palette('primary', 0)} )` + : undefined}; `; export const JoinWrap = Styled.div` diff --git a/src/components/organisms/Login/style.ts b/src/components/organisms/Login/style.ts index 119595e6..ce08f4e9 100644 --- a/src/components/organisms/Login/style.ts +++ b/src/components/organisms/Login/style.ts @@ -1,8 +1,9 @@ import { Button, Label } from 'components/atoms'; import Styled from 'styled-components'; +import { palette } from 'styled-tools'; export const Line = Styled.img` -background-color : #8b8b8b; +background-color : ${palette('grayscale', 4)}; width : 1px; height : 16px; object-fit : contain; @@ -11,7 +12,7 @@ object-fit : contain; export const JoinBtn = Styled(Button)` margin-left : 15px; line-height : 1.5; -color : #8b8b8b; +color : ${palette('grayscale', 4)}; font-family: AppleSDGothicNeo; font-size : 16px; font-weight : bold; @@ -20,7 +21,7 @@ font-weight : bold; export const FindPwdBtn = Styled(Button)` margin-right : 15px; line-height : 1.5; -color : #8b8b8b; +color : ${palette('grayscale', 4)}; font-family: AppleSDGothicNeo; font-size : 16px; `; diff --git a/src/pages/Home/style.ts b/src/pages/Home/style.ts index ff24e476..55447337 100644 --- a/src/pages/Home/style.ts +++ b/src/pages/Home/style.ts @@ -1,6 +1,6 @@ import { Button } from 'components/atoms'; import Styled from 'styled-components'; -import { theme } from 'styled-tools'; +import { palette, theme } from 'styled-tools'; export const TopWrapper = Styled.div` padding-top : 178px; @@ -14,27 +14,27 @@ export const O2Title = Styled.h1` letter-spacing: -0.5px; font-family: HomepageBaukasten; margin-bottom : 50px; - color : #0d0d0d; + color : ${palette('grayscale', 9)}; `; export const TopSubTitle = Styled.h2` ${theme('font.dp2')}; - color : #0d0d0d; + color : ${palette('grayscale', 9)}; `; export const TopExp = Styled.p` ${theme('font.body4')}; margin-top : 20px; margin-bottom : 30px; - color : #3d3d3d; + color : ${palette('grayscale', 7)}; `; export const ChallengeBtn = Styled(Button)` ${theme('font.subhead2')}; width : 164px; height : 40px; - color : #ffffff; - background-color : #3d3d3d; + color : ${palette('grayscale', 0)}; + background-color : ${palette('grayscale', 7)}; border-radius: 50px; `; @@ -45,19 +45,19 @@ export const ChallengeWrapper = Styled.div` export const MiddleTitle = Styled.h2` ${theme('font.dp1_eng')}; - color : #0d0d0d; + color : ${palette('grayscale', 9)}; `; export const MiddleSubTitle = Styled.h3` ${theme('font.h1')}; - color : #6f6f6f; + color : ${palette('grayscale', 5)}; margin-top : 20px; margin-bottom : 40px; `; export const MiddleExp = Styled.p` ${theme('font.body4')}; - color : #8b8b8b; + color : ${palette('grayscale', 4)}; `; export const ChallengeCardWrapper = Styled.ul` @@ -120,12 +120,12 @@ export const ConcertExpContainer2 = Styled.div` export const ConcertExpType = Styled.p` ${theme('font.body3')}; - color : #8b8b8b; + color : ${palette('grayscale', 4)}; `; export const ConcertTitle = Styled.h1` ${theme('font.h1')}; - color : #3d3d3d; + color : ${palette('grayscale', 7)}; margin-top : 10px; `; @@ -138,7 +138,7 @@ export const ConcertContent = Styled.p` font-style: normal; line-height: 1.79; letter-spacing: -0.5px; - color : #555555; + color : ${palette('grayscale', 6)}; `; export const O2SpeakerWrapper = Styled.div` @@ -152,12 +152,12 @@ export const O2SpeakerWrapper = Styled.div` export const O2SpeakerTitle = Styled.h1` ${theme('font.dp1_eng')}; - color : #ffffff; + color : ${palette('grayscale', 0)}; `; export const O2SpeakerSubTitle = Styled.h2` ${theme('font.subhead4')}; - color : #a5a5a5; + color : ${palette('grayscale', 3)}; margin-top : 20px; margin-bottom : 138px; `; @@ -178,13 +178,13 @@ export const O2BadgeWrapper = Styled.div` export const O2BadgeTitle = Styled.h1` ${theme('font.dp1_eng')}; - color : #0d0d0d; + color : ${palette('grayscale', 9)}; margin-bottom : 20px; `; export const O2BadgeSubTitle = Styled.h2` ${theme('font.subhead4')}; - color : #6f6f6f; + color : ${palette('grayscale', 5)}; margin-bottom : 150px; `; @@ -214,13 +214,13 @@ export const LinkCardWrapper = Styled.div` export const LinkTitle = Styled.h1` ${theme('font.h1_eng')}; - color : #ffffff; + color : ${palette('grayscale', 0)}; height : 68px; `; export const LinkExp = Styled.p` ${theme('font.body4')}; - color : #dfdfdf; + color : ${palette('grayscale', 1)}; margin : 31px 0; `; @@ -228,6 +228,6 @@ export const LinkBtn = Styled(Button)` ${theme('font.subhead4_eng')}; width: 200px; height: 60px; - background-color : #36c8f5; - color : #ffffff; + background-color : ${palette('primary', 3)}; + color : ${palette('grayscale', 0)}; `; From a001bb390512809ffa90cc20ddf8e6d124b9874a Mon Sep 17 00:00:00 2001 From: JiyoungHyun Date: Fri, 6 Aug 2021 21:11:37 +0900 Subject: [PATCH 12/80] =?UTF-8?q?Refactor:=20=EB=8C=93=EA=B8=80=20?= =?UTF-8?q?=EC=A2=8B=EC=95=84=EC=9A=94=20=EC=8A=A4=ED=81=AC=EB=9E=A9=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/concert.api.ts | 31 +++++----- src/apis/notice.api.ts | 2 +- .../molecules/CommentWrite/index.tsx | 14 ++--- .../molecules/NoticeSingleComment/index.tsx | 45 ++++++-------- .../molecules/ReplyComment/index.tsx | 2 +- .../molecules/SingleComment/index.tsx | 45 ++++++-------- .../organisms/CommentList/index.tsx | 26 ++++----- .../organisms/NoticeCommentList/index.tsx | 26 ++++----- src/pages/ConcertDetail/index.tsx | 58 +++++++++++-------- src/pages/NoticeDetail/index.tsx | 29 +++++----- 10 files changed, 136 insertions(+), 142 deletions(-) diff --git a/src/apis/concert.api.ts b/src/apis/concert.api.ts index 288c6dc5..d27c3957 100644 --- a/src/apis/concert.api.ts +++ b/src/apis/concert.api.ts @@ -1,7 +1,8 @@ import { serverAxios } from 'libs/axios'; import { IConcert, IConcertList } from '../types/concert.type'; + interface IConcertCommentData { - parentID?: string; + parentID?: string | null; text: string; } @@ -121,7 +122,7 @@ export const postConcertComment = async ( } }; -export const postConcertLike = async (token: string, concertID: string) => { +export const postConcertLike = async (token: string, concertID: string): Promise => { try { const data = await serverAxios.post(`${PREFIX_URL}/like/${concertID}`, '', { headers: { @@ -129,19 +130,20 @@ export const postConcertLike = async (token: string, concertID: string) => { }, }); if (data.data.status === 200) { + return data.data.data; } else { - return null; + return false; } } catch (e) { if (e.response.data.status === 400) { return true; } alert(e.response.data.message); - return undefined; + return false; } }; -export const deleteConcertLike = async (token: string, concertID: string) => { +export const deleteConcertLike = async (token: string, concertID: string): Promise => { try { const data = await serverAxios.delete(`${PREFIX_URL}/like/${concertID}`, { headers: { @@ -149,16 +151,17 @@ export const deleteConcertLike = async (token: string, concertID: string) => { }, }); if (data.data.status === 200) { + return data.data.data; } else { - return null; + return false; } } catch (e) { alert(e.response.data.message); - return undefined; + return false; } }; -export const postConcertScrap = async (token: string, concertID: string) => { +export const postConcertScrap = async (token: string, concertID: string): Promise => { try { const data = await serverAxios.post(`${PREFIX_URL}/scrap/${concertID}`, '', { headers: { @@ -166,19 +169,20 @@ export const postConcertScrap = async (token: string, concertID: string) => { }, }); if (data.data.status === 200) { + return data.data.data; } else { - return null; + return false; } } catch (e) { if (e.response.data.message === '이미 스크랩 된 글입니다') { return true; } alert(e.response.data.message); - return undefined; + return false; } }; -export const deleteConcertScrap = async (token: string, concertID: string) => { +export const deleteConcertScrap = async (token: string, concertID: string): Promise => { try { const data = await serverAxios.delete(`${PREFIX_URL}/scrap/${concertID}`, { headers: { @@ -186,11 +190,12 @@ export const deleteConcertScrap = async (token: string, concertID: string) => { }, }); if (data.data.status === 200) { + return data.data.data; } else { - return null; + return false; } } catch (e) { alert(e.response.data.message); - return undefined; + return false; } }; diff --git a/src/apis/notice.api.ts b/src/apis/notice.api.ts index c8553d64..7b27b1d3 100644 --- a/src/apis/notice.api.ts +++ b/src/apis/notice.api.ts @@ -1,7 +1,7 @@ import { serverAxios } from 'libs/axios'; import { INoticeList, ISearchNoticeList } from '../types/notice.type'; interface INoticeCommentData { - parentID?: string; + parentID?: string | null; text: string; } diff --git a/src/components/molecules/CommentWrite/index.tsx b/src/components/molecules/CommentWrite/index.tsx index 3103a134..be218e12 100644 --- a/src/components/molecules/CommentWrite/index.tsx +++ b/src/components/molecules/CommentWrite/index.tsx @@ -2,26 +2,24 @@ import React from 'react'; import { CommentButton, CommentForm, CommentTextArea } from './style'; export interface IProps { - className?: string; value: string; isComment: boolean; - onChange: (e: React.ChangeEvent) => void; - onClick: (e: any) => void; - onSubmit: (e: React.FormEvent) => void; + handleChange: (e: React.ChangeEvent) => void; + handleSubmit: (e: React.MouseEvent) => void; } -function CommentWrite({ value, isComment, onChange, onClick, onSubmit }: IProps): React.ReactElement { +function CommentWrite({ value, isComment, handleChange, handleSubmit }: IProps): React.ReactElement { return ( -
+ - + {isComment ? '댓글 작성' : '답글 작성'} diff --git a/src/components/molecules/NoticeSingleComment/index.tsx b/src/components/molecules/NoticeSingleComment/index.tsx index 2239fcf8..6e41e566 100644 --- a/src/components/molecules/NoticeSingleComment/index.tsx +++ b/src/components/molecules/NoticeSingleComment/index.tsx @@ -2,7 +2,7 @@ import { postNoticeComment } from 'apis'; import { LoginModal, ReplyComment } from 'components/molecules'; import React, { useState } from 'react'; import { useRecoilValue } from 'recoil'; -import { userState, userStatusState } from 'stores/user'; +import { userStatusState } from 'stores/user'; import { IReply } from 'types/challenge.type'; import { CommentContainer, @@ -27,7 +27,7 @@ interface IProps { text?: string; }[]; isDeleted?: boolean; - _id: string; + parentCommentID: string; userID: { img: string; _id: string; @@ -35,14 +35,22 @@ interface IProps { }; text: string; noticeID?: string; + isRerender: boolean; + setIsRerender: (value: boolean) => void; } -function NoticeSingleComment({ _id, userID, childrenComment, text, noticeID }: IProps): React.ReactElement { +function NoticeSingleComment({ + parentCommentID, + userID, + childrenComment, + text, + noticeID, + isRerender, + setIsRerender, +}: IProps): React.ReactElement { const [isOpenReply, setIsOpenReply] = useState(false); const [replyValue, setReplyValue] = useState(''); - const [replyList, setReplyList] = useState(childrenComment); const userStatusData = useRecoilValue(userStatusState); - const userData = useRecoilValue(userState); const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); const onClickReplyOpen = () => { @@ -51,26 +59,12 @@ function NoticeSingleComment({ _id, userID, childrenComment, text, noticeID }: I const handleChange = (event: React.ChangeEvent) => { setReplyValue(event.currentTarget.value); }; - const onSubmit = async (event: React.FormEvent) => { + const handleSubmit = async (event: React.MouseEvent) => { event.preventDefault(); - const variables = { - parentID: _id, - text: replyValue, - }; if (userStatusData) { - await postNoticeComment(userStatusData.token, noticeID, variables); - userData && - setReplyList( - replyList.concat({ - text: variables.text, - userID: { - img: userData.img, - _id: userData._id, - nickname: userData.nickname, - }, - }), - ); + await postNoticeComment(userStatusData.token, noticeID, { parentID: parentCommentID, text: replyValue }); setReplyValue(''); + setIsRerender(!isRerender); } else { setIsLoginModalOpen(true); } @@ -89,13 +83,12 @@ function NoticeSingleComment({ _id, userID, childrenComment, text, noticeID }: I <> - {replyList.map((data: IReply, index) => ( + {childrenComment.map((data: IReply, index) => ( - + {nickname} {text} diff --git a/src/components/molecules/SingleComment/index.tsx b/src/components/molecules/SingleComment/index.tsx index aa629eb3..5e98c144 100644 --- a/src/components/molecules/SingleComment/index.tsx +++ b/src/components/molecules/SingleComment/index.tsx @@ -2,7 +2,7 @@ import { postConcertComment } from 'apis'; import { LoginModal, ReplyComment } from 'components/molecules'; import React, { useState } from 'react'; import { useRecoilValue } from 'recoil'; -import { userState, userStatusState } from 'stores/user'; +import { userStatusState } from 'stores/user'; import { IReply } from 'types/challenge.type'; import { CommentContainer, @@ -27,7 +27,7 @@ interface IProps { text?: string; }[]; isDeleted?: boolean; - _id: string; + parentCommentID: string; userID: { img: string; _id: string; @@ -35,14 +35,22 @@ interface IProps { }; text: string; concertID?: string; + isRerender: boolean; + setIsRerender: (value: boolean) => void; } -function SingleComment({ _id, userID, childrenComment, text, concertID }: IProps): React.ReactElement { +function SingleComment({ + parentCommentID, + userID, + childrenComment, + text, + concertID, + isRerender, + setIsRerender, +}: IProps): React.ReactElement { const [isOpenReply, setIsOpenReply] = useState(false); const [replyValue, setReplyValue] = useState(''); - const [replyList, setReplyList] = useState(childrenComment); const userStatusData = useRecoilValue(userStatusState); - const userData = useRecoilValue(userState); const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); const onClickReplyOpen = () => { @@ -51,26 +59,12 @@ function SingleComment({ _id, userID, childrenComment, text, concertID }: IProps const handleChange = (event: React.ChangeEvent) => { setReplyValue(event.currentTarget.value); }; - const onSubmit = async (event: React.FormEvent) => { + const handleSubmit = async (event: React.MouseEvent) => { event.preventDefault(); - const variables = { - parentID: _id, - text: replyValue, - }; if (userStatusData) { - await postConcertComment(userStatusData.token, concertID, variables); - userData && - setReplyList( - replyList.concat({ - text: variables.text, - userID: { - img: userData.img, - _id: userData._id, - nickname: userData.nickname, - }, - }), - ); + await postConcertComment(userStatusData.token, concertID, { parentID: parentCommentID, text: replyValue }); setReplyValue(''); + setIsRerender(!isRerender); } else { setIsLoginModalOpen(true); } @@ -89,13 +83,12 @@ function SingleComment({ _id, userID, childrenComment, text, concertID }: IProps <> - {replyList.map((data: IReply, index) => ( + {childrenComment.map((data: IReply, index) => ( ; concertID?: string; - reLoadComment: (newComment: IConcertNewComment) => void; + isRerender: boolean; + setIsRerender: (value: boolean) => void; } -function CommentList({ commentList, concertID, reLoadComment }: IProps): React.ReactElement { +function CommentList({ commentList, concertID, isRerender, setIsRerender }: IProps): React.ReactElement { const [commentValue, setCommentValue] = useState(''); const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); const userStatusData = useRecoilValue(userStatusState); @@ -20,38 +21,37 @@ function CommentList({ commentList, concertID, reLoadComment }: IProps): React.R const handleChange = (event: React.ChangeEvent) => { setCommentValue(event.currentTarget.value); }; - const onSubmit = async (event: React.FormEvent) => { + const handleSubmit = async (event: React.MouseEvent) => { event.preventDefault(); - const variables = { - text: commentValue, - }; if (userStatusData) { - await postConcertComment(userStatusData.token, concertID, variables); - reLoadComment(variables); + await postConcertComment(userStatusData.token, concertID, { parentID: null, text: commentValue }); setCommentValue(''); + setIsRerender(!isRerender); } else { setIsLoginModalOpen(true); } }; + return ( <> {commentList?.map((data: IConcertComment, index) => ( ))} diff --git a/src/components/organisms/NoticeCommentList/index.tsx b/src/components/organisms/NoticeCommentList/index.tsx index 53da2a76..c16988e0 100644 --- a/src/components/organisms/NoticeCommentList/index.tsx +++ b/src/components/organisms/NoticeCommentList/index.tsx @@ -3,16 +3,17 @@ import { CommentWrite, LoginModal, NoticeSingleComment } from 'components/molecu import React, { useState } from 'react'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; -import { INoticeComment, INoticeNewComment } from 'types/notice.type'; +import { INoticeComment } from 'types/notice.type'; import { CommentWriteContainer } from './style'; interface IProps { commentList: Array; noticeID?: string; - reLoadComment: (newComment: INoticeNewComment) => void; + isRerender: boolean; + setIsRerender: (value: boolean) => void; } -function NoticeCommentList({ commentList, noticeID, reLoadComment }: IProps): React.ReactElement { +function NoticeCommentList({ commentList, noticeID, isRerender, setIsRerender }: IProps): React.ReactElement { const [commentValue, setCommentValue] = useState(''); const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); const userStatusData = useRecoilValue(userStatusState); @@ -20,38 +21,37 @@ function NoticeCommentList({ commentList, noticeID, reLoadComment }: IProps): Re const handleChange = (event: React.ChangeEvent) => { setCommentValue(event.currentTarget.value); }; - const onSubmit = async (event: React.FormEvent) => { + const handleSubmit = async (event: React.MouseEvent) => { event.preventDefault(); - const variables = { - text: commentValue, - }; if (userStatusData) { - await postNoticeComment(userStatusData.token, noticeID, variables); - reLoadComment(variables); + await postNoticeComment(userStatusData.token, noticeID, { parentID: null, text: commentValue }); setCommentValue(''); + setIsRerender(!isRerender); } else { setIsLoginModalOpen(true); } }; + return ( <> {commentList?.map((data: INoticeComment, index) => ( ))} diff --git a/src/pages/ConcertDetail/index.tsx b/src/pages/ConcertDetail/index.tsx index 2ba1c4cf..b6e8d8c0 100644 --- a/src/pages/ConcertDetail/index.tsx +++ b/src/pages/ConcertDetail/index.tsx @@ -8,7 +8,7 @@ import { } from 'apis'; import { DetailTitle, LoginModal } from 'components/molecules'; import { CommentList, DetailContent } from 'components/organisms'; -import React, { useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useState } from 'react'; import { RouteComponentProps } from 'react-router'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; @@ -29,37 +29,38 @@ function ConcertDetail({ match }: RouteComponentProps): React.React const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); const [isUserLike, setIsUserLike] = useState(false); const [isUserScrap, setIsUserScrap] = useState(false); - useEffect(() => { - const getConcertList = async () => { - if (userStatusData) { - const data = await getConcertUserData(userStatusData.token, id); - data && setConcert(data); - data && setCommentList(data.comments); - data && setLikeNum(data.likes); - data && setScrapNum(data.scrapNum); - data && setIsUserLike(data.isLike); - data && setIsUserScrap(data.isScrap); - } else { - const data = await getConcertData(id); - data && setConcert(data); - data && setCommentList(data.comments); - data && setLikeNum(data.likes); - data && setScrapNum(data.scrapNum); - } - }; - getConcertList(); - }, [commentList, likeNum, scrapNum, id, userStatusData]); + const [isRerender, setIsRerender] = useState(false); - const reLoadComment = (newComment: any) => { - setCommentList(commentList?.concat(newComment)); - }; + const getConcertContent = useCallback(async () => { + if (userStatusData) { + const data = await getConcertUserData(userStatusData.token, id); + data && setConcert(data); + data && setCommentList(data.comments); + data && setLikeNum(data.likes); + data && setScrapNum(data.scrapNum); + data && setIsUserLike(data.isLike); + data && setIsUserScrap(data.isScrap); + } else { + const data = await getConcertData(id); + data && setConcert(data); + data && setCommentList(data.comments); + data && setLikeNum(data.likes); + data && setScrapNum(data.scrapNum); + } + }, [id, userStatusData]); + + useEffect(() => { + getConcertContent(); + }, [isRerender, getConcertContent]); const onLike = async () => { if (userStatusData) { const postLike = await postConcertLike(userStatusData.token, id); if (postLike === true) { await deleteConcertLike(userStatusData.token, id); + setIsRerender(!isRerender); } + setIsRerender(!isRerender); } else { setIsLoginModalOpen(true); } @@ -69,7 +70,9 @@ function ConcertDetail({ match }: RouteComponentProps): React.React const postScrap = await postConcertScrap(userStatusData.token, id); if (postScrap === true) { await deleteConcertScrap(userStatusData.token, id); + setIsRerender(!isRerender); } + setIsRerender(!isRerender); } else { setIsLoginModalOpen(true); } @@ -100,7 +103,12 @@ function ConcertDetail({ match }: RouteComponentProps): React.React isUserScrap={isUserScrap} > )} - + ); diff --git a/src/pages/NoticeDetail/index.tsx b/src/pages/NoticeDetail/index.tsx index 8cf16cc7..1ec429c4 100644 --- a/src/pages/NoticeDetail/index.tsx +++ b/src/pages/NoticeDetail/index.tsx @@ -1,10 +1,8 @@ import { getNoticeData } from 'apis'; import { DetailTitle } from 'components/molecules'; import { DetailContent, NoticeCommentList } from 'components/organisms'; -import React, { useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useState } from 'react'; import { RouteComponentProps } from 'react-router'; -import { useRecoilValue } from 'recoil'; -import { userStatusState } from 'stores/user'; import { INotice } from 'types/notice.type'; import { NoticeDetailWrapper } from './style'; @@ -16,19 +14,17 @@ function NoticeDetail({ match }: RouteComponentProps): React.ReactE const { id } = match.params; const [notice, setNotice] = useState(null); const [commentList, setCommentList] = useState([]); - const userStatusData = useRecoilValue(userStatusState); - useEffect(() => { - const getConcertList = async () => { - const data = await getNoticeData(id); - data[0] && setNotice(data[0]); - data[0] && setCommentList(data[0].comments); - }; - getConcertList(); - }, [commentList, userStatusData, id]); + const [isRerender, setIsRerender] = useState(false); + + const getNoticeContent = useCallback(async () => { + const data = await getNoticeData(id); + data[0] && setNotice(data[0]); + data[0] && setCommentList(data[0].comments); + }, [id]); - const reLoadComment = (newComment: any) => { - setCommentList(commentList?.concat(newComment)); - }; + useEffect(() => { + getNoticeContent(); + }, [isRerender, getNoticeContent]); return ( @@ -51,7 +47,8 @@ function NoticeDetail({ match }: RouteComponentProps): React.ReactE ); From fb34ff407812ca44d78bf978fedf9591ddced73e Mon Sep 17 00:00:00 2001 From: JiyoungHyun Date: Sat, 7 Aug 2021 16:11:01 +0900 Subject: [PATCH 13/80] =?UTF-8?q?Refactor:=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20=EB=B2=84=ED=8A=BC=20=EB=94=94=EC=9E=90=EC=9D=B8qa?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/images/index.ts | 1 + src/assets/images/prevCategoryButton.svg | 17 ++++++ .../organisms/CategoryList/index.tsx | 53 ++++++++++++++----- .../organisms/CategoryList/style.ts | 42 +++++++++++++-- 4 files changed, 98 insertions(+), 15 deletions(-) create mode 100644 src/assets/images/prevCategoryButton.svg diff --git a/src/assets/images/index.ts b/src/assets/images/index.ts index 927e59e1..2654a52e 100644 --- a/src/assets/images/index.ts +++ b/src/assets/images/index.ts @@ -63,6 +63,7 @@ export { default as NoticeHeaderIcon } from './noticeHeaderIcon.svg'; export { default as PlusIcon } from './plusIcon.svg'; export { default as GreyPlusIcon } from './plusIconGrey.svg'; export { default as GreydfPlusIcon } from './plusIcon_dfdfdf.svg'; +export { default as PrevIcon } from './prevCategoryButton.svg'; export { default as ScrapIcon } from './scrap.svg'; export { default as GrayScrapIcon } from './scrapIcon.svg'; export { default as ScrapFilledIcon } from './scrap_filled.svg'; diff --git a/src/assets/images/prevCategoryButton.svg b/src/assets/images/prevCategoryButton.svg new file mode 100644 index 00000000..0fd03541 --- /dev/null +++ b/src/assets/images/prevCategoryButton.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/components/organisms/CategoryList/index.tsx b/src/components/organisms/CategoryList/index.tsx index ef184b26..0d1054d9 100644 --- a/src/components/organisms/CategoryList/index.tsx +++ b/src/components/organisms/CategoryList/index.tsx @@ -1,8 +1,18 @@ -import { MoreClickedIcon, MoreIcon, NextIcon } from 'assets/images'; +import { MoreClickedIcon, MoreIcon, NextIcon, PrevIcon } from 'assets/images'; import { CategoryButton } from 'components/molecules'; import React, { useEffect, useRef, useState } from 'react'; import { interestList } from 'resources/string'; -import { CategoryListWrapper, Hashtag, HashtagContainer, Main, More, NextButton, Shadow } from './style'; +import { + CategoryListWrapper, + GradientLeft, + Hashtag, + HashtagContainer, + Main, + More, + NextButton, + PrevButton, + Shadow, +} from './style'; interface IProps { reRenderCategory?: (interest: string) => void; @@ -12,6 +22,8 @@ interface IProps { function CategoryList({ reRenderCategory, selectedCategory, categoryChange }: IProps): React.ReactElement { const totalSlide = 6; const [currentSlide, setCurrentSlide] = useState(0); + const [animation, setAnimation] = useState(false); + const [localVisible, setLocalVisible] = useState(!currentSlide); const slideRef = useRef(null); const [isOpenMore, setIsOpenMore] = useState(false); const [isMoreClicked, setIsMoreClicked] = useState(false); @@ -24,8 +36,14 @@ function CategoryList({ reRenderCategory, selectedCategory, categoryChange }: IP reRenderCategory && reRenderCategory(category); categoryChange && categoryChange(); }; - - const nextSlide = () => { + const handlePrev = () => { + if (currentSlide === 0) { + setCurrentSlide(totalSlide); + } else { + setCurrentSlide(currentSlide - 1); + } + }; + const handleNext = () => { if (currentSlide >= totalSlide) { setCurrentSlide(0); } else { @@ -38,18 +56,29 @@ function CategoryList({ reRenderCategory, selectedCategory, categoryChange }: IP slideRef.current.style.transform = `translateX(-${currentSlide * 15}%)`; } }, [currentSlide]); + useEffect(() => { + if ((localVisible && currentSlide) || (localVisible && !currentSlide)) { + setAnimation(true); + setTimeout(() => setAnimation(false), 500); + } + setLocalVisible(!currentSlide); + }, [localVisible, currentSlide]); return (
- - + {(!localVisible || animation) && ( + + )} + {(!localVisible || animation) && } + + {interestList.map((tag, index) => ( - +
diff --git a/src/components/organisms/CategoryList/style.ts b/src/components/organisms/CategoryList/style.ts index b367b775..c16afab0 100644 --- a/src/components/organisms/CategoryList/style.ts +++ b/src/components/organisms/CategoryList/style.ts @@ -1,14 +1,18 @@ -import Styled from 'styled-components'; +import { fadeIn, fadeOut } from 'assets/styles/animation'; +import Styled, { css } from 'styled-components'; export const Main = Styled.div` display: flex; align-items: center; width: 815px; + position: relative; `; -export const HashtagContainer = Styled.div` +export const HashtagContainer = Styled.div<{ disappear: boolean }>` display: flex; - width: 645px; + align-items: center; + width: ${({ disappear }) => (disappear ? '645px' : '726px')}; + margin-left: ${({ disappear }) => (disappear ? '65px' : '0')}; overflow: hidden; `; @@ -16,6 +20,38 @@ export const Hashtag = Styled.div` display: flex; `; +export const GradientLeft = Styled.div<{ disappear: boolean }>` + position: absolute; + margin-left: 45px; + background-image: linear-gradient(to right, #FFFFFF 33.87%, rgba(255, 255, 255, 0) 94.35%); + width: 81px; + height: 46px; + animation-name: ${fadeOut}; + animation-duration: 0.5s; + animation-timing-function: ease-out; + animation-fill-mode: forwards; + ${(props) => + props.disappear && + css` + animation-name: ${fadeIn}; + `} + z-index: 4; +`; + +export const PrevButton = Styled.img<{ disappear: boolean }>` + position: absolute; + animation-name: ${fadeOut}; + animation-duration: 0.5s; + animation-timing-function: ease-out; + animation-fill-mode: forwards; + ${(props) => + props.disappear && + css` + animation-name: ${fadeIn}; + `} + z-index: 5; +`; + export const Shadow = Styled.div` position: absolute; right: 120px; From bf50faa1e5035d9e6a128ce6e529cdf9a9fac1d4 Mon Sep 17 00:00:00 2001 From: JiyoungHyun Date: Sat, 7 Aug 2021 16:40:08 +0900 Subject: [PATCH 14/80] =?UTF-8?q?Style:=20Notice=20Page,=20Template?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Notice/index.tsx | 30 +++++----------- src/pages/Notice/template/index.tsx | 45 ++++++++++++++++++++++-- src/pages/Notice/{ => template}/style.ts | 0 3 files changed, 51 insertions(+), 24 deletions(-) rename src/pages/Notice/{ => template}/style.ts (100%) diff --git a/src/pages/Notice/index.tsx b/src/pages/Notice/index.tsx index fef208fe..83622563 100644 --- a/src/pages/Notice/index.tsx +++ b/src/pages/Notice/index.tsx @@ -1,8 +1,7 @@ import { getNoticeSearchData } from 'apis'; -import { NoticeHeader, NoticeList, SearchForm } from 'components/organisms'; import React, { useEffect, useState } from 'react'; import { INotice } from 'types/notice.type'; -import { NoticeWrapper } from './style'; +import NoticeTemplate from './template'; function Notice(): React.ReactElement { const [noticeList, setnoticeList] = useState(null); @@ -31,25 +30,14 @@ function Notice(): React.ReactElement { }; return ( - <> - - - - {noticeList && ( - - )} - - + ); } diff --git a/src/pages/Notice/template/index.tsx b/src/pages/Notice/template/index.tsx index f4aa2adc..7d34a719 100644 --- a/src/pages/Notice/template/index.tsx +++ b/src/pages/Notice/template/index.tsx @@ -1,7 +1,46 @@ +import { NoticeHeader, NoticeList, SearchForm } from 'components/organisms'; import React from 'react'; +import { INotice } from 'types/notice.type'; +import { NoticeWrapper } from './style'; -function Notice(): React.ReactElement { - return
Notice
; +interface IProps { + reRenderKeyword: (keyword: string) => void; + keywordChange: () => void; + noticeList: Array | null; + totalNoticeNum: number; + currentPage: number; + setCurrentPage: (value: number) => void; } -export default Notice; +function NoticeTemplate({ + reRenderKeyword, + keywordChange, + totalNoticeNum, + noticeList, + currentPage, + setCurrentPage, +}: IProps): React.ReactElement { + return ( + <> + + + + {noticeList && ( + + )} + + + ); +} + +export default NoticeTemplate; diff --git a/src/pages/Notice/style.ts b/src/pages/Notice/template/style.ts similarity index 100% rename from src/pages/Notice/style.ts rename to src/pages/Notice/template/style.ts From 89e72e055996805714f4c9f29b3933c9465f987f Mon Sep 17 00:00:00 2001 From: JiyoungHyun Date: Sat, 7 Aug 2021 17:14:23 +0900 Subject: [PATCH 15/80] =?UTF-8?q?Style:=20NoticeDetail=20Page,=20Template?= =?UTF-8?q?=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/NoticeDetail/index.tsx | 37 ++++------------ src/pages/NoticeDetail/template/index.tsx | 42 +++++++++++++++++-- .../NoticeDetail/{ => template}/style.ts | 0 3 files changed, 46 insertions(+), 33 deletions(-) rename src/pages/NoticeDetail/{ => template}/style.ts (100%) diff --git a/src/pages/NoticeDetail/index.tsx b/src/pages/NoticeDetail/index.tsx index 1ec429c4..3208cec4 100644 --- a/src/pages/NoticeDetail/index.tsx +++ b/src/pages/NoticeDetail/index.tsx @@ -1,11 +1,8 @@ import { getNoticeData } from 'apis'; -import { DetailTitle } from 'components/molecules'; -import { DetailContent, NoticeCommentList } from 'components/organisms'; import React, { useCallback, useEffect, useState } from 'react'; import { RouteComponentProps } from 'react-router'; import { INotice } from 'types/notice.type'; -import { NoticeDetailWrapper } from './style'; - +import NoticeDetailTemplate from './template'; interface MatchParams { id: string; } @@ -15,7 +12,7 @@ function NoticeDetail({ match }: RouteComponentProps): React.ReactE const [notice, setNotice] = useState(null); const [commentList, setCommentList] = useState([]); const [isRerender, setIsRerender] = useState(false); - + const getNoticeContent = useCallback(async () => { const data = await getNoticeData(id); data[0] && setNotice(data[0]); @@ -27,30 +24,12 @@ function NoticeDetail({ match }: RouteComponentProps): React.ReactE }, [isRerender, getNoticeContent]); return ( - - {notice && ( - - )} - {notice && ( - - )} - - + ); } diff --git a/src/pages/NoticeDetail/template/index.tsx b/src/pages/NoticeDetail/template/index.tsx index 83d7cf0d..be42f74f 100644 --- a/src/pages/NoticeDetail/template/index.tsx +++ b/src/pages/NoticeDetail/template/index.tsx @@ -1,7 +1,41 @@ +import { DetailTitle } from 'components/molecules'; +import { DetailContent, NoticeCommentList } from 'components/organisms'; import React from 'react'; - -function NoticeDetail(): React.ReactElement { - return
NoticeDetail
; +import { INotice, INoticeComment } from 'types/notice.type'; +import { NoticeDetailWrapper } from './style'; +interface IProps { + notice: INotice | null; + commentList: Array; + isRerender: boolean; + setIsRerender: (value: boolean) => void; +} +function NoticeDetailTemplate({ notice, commentList, isRerender, setIsRerender }: IProps): React.ReactElement { + return ( + + {notice && ( + + )} + {notice && ( + + )} + + + ); } -export default NoticeDetail; +export default NoticeDetailTemplate; diff --git a/src/pages/NoticeDetail/style.ts b/src/pages/NoticeDetail/template/style.ts similarity index 100% rename from src/pages/NoticeDetail/style.ts rename to src/pages/NoticeDetail/template/style.ts From 43da7c77e309b9216ceff82252d8e77b2c3f912f Mon Sep 17 00:00:00 2001 From: JiyoungHyun Date: Sat, 7 Aug 2021 17:32:15 +0900 Subject: [PATCH 16/80] =?UTF-8?q?Style:=20Concert=20Page,=20Template=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Concert/index.tsx | 37 +++++++----------- src/pages/Concert/template/index.tsx | 56 ++++++++++++++++++++++++++-- src/pages/Concert/template/style.ts | 9 +++++ 3 files changed, 75 insertions(+), 27 deletions(-) create mode 100644 src/pages/Concert/template/style.ts diff --git a/src/pages/Concert/index.tsx b/src/pages/Concert/index.tsx index 0e99fc7e..cfd70483 100644 --- a/src/pages/Concert/index.tsx +++ b/src/pages/Concert/index.tsx @@ -1,9 +1,7 @@ import { getConcertSearchData } from 'apis'; -import { ConcertTitle } from 'components/molecules'; -import { CategoryList, ConcertCardList, ConcertList, SearchForm } from 'components/organisms'; import React, { useEffect, useState } from 'react'; import { IConcert } from 'types/concert.type'; -import { ConcertWrapper } from './style'; +import ConcertTemplate from './template'; function Concert(): React.ReactElement { const [concertList, setConcertList] = useState(null); @@ -42,27 +40,18 @@ function Concert(): React.ReactElement { const concertData = concertList?.slice(3); return ( - - - - - - - + ); } diff --git a/src/pages/Concert/template/index.tsx b/src/pages/Concert/template/index.tsx index 238b58dd..c0e971ca 100644 --- a/src/pages/Concert/template/index.tsx +++ b/src/pages/Concert/template/index.tsx @@ -1,7 +1,57 @@ +import { ConcertTitle } from 'components/molecules'; +import { CategoryList, ConcertCardList, ConcertList, SearchForm } from 'components/organisms'; import React from 'react'; +import { IConcert } from 'types/concert.type'; +import { ConcertWrapper } from './style'; -function TConcert(): React.ReactElement { - return
ConcertTemplate
; +interface IProps { + reRenderCategory?: (interest: string) => void; + selectedCategory?: string; + categoryChange?: () => void; + reRenderKeyword?: (keyword: string) => void; + keywordChange?: () => void; + concertCardData: Array | undefined; + concertData: Array | undefined; + totalConcertNum: number; + currentPage: number; + setCurrentPage: (value: number) => void; } -export default TConcert; +function ConcertTemplate({ + reRenderCategory, + selectedCategory, + categoryChange, + reRenderKeyword, + keywordChange, + concertCardData, + concertData, + totalConcertNum, + currentPage, + setCurrentPage, +}: IProps): React.ReactElement { + return ( + + + + + + + + ); +} + +export default ConcertTemplate; diff --git a/src/pages/Concert/template/style.ts b/src/pages/Concert/template/style.ts new file mode 100644 index 00000000..6541a54b --- /dev/null +++ b/src/pages/Concert/template/style.ts @@ -0,0 +1,9 @@ +import Styled from 'styled-components'; + +export const ConcertWrapper = Styled.div` + display: flex; + flex-direction: column; + justify-content: center; + margin: 0 auto; + width: 845px; +`; From 2105082ddf47cb1d6f3b980ee00d54e30df79dd8 Mon Sep 17 00:00:00 2001 From: JiyoungHyun Date: Sat, 7 Aug 2021 17:54:48 +0900 Subject: [PATCH 17/80] =?UTF-8?q?Style:=20ConcertDetail=20Page,=20Template?= =?UTF-8?q?=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Concert/style.ts | 9 --- src/pages/ConcertDetail/index.tsx | 50 ++++--------- src/pages/ConcertDetail/template/index.tsx | 71 +++++++++++++++++-- .../ConcertDetail/{ => template}/style.ts | 0 4 files changed, 82 insertions(+), 48 deletions(-) delete mode 100644 src/pages/Concert/style.ts rename src/pages/ConcertDetail/{ => template}/style.ts (100%) diff --git a/src/pages/Concert/style.ts b/src/pages/Concert/style.ts deleted file mode 100644 index 6541a54b..00000000 --- a/src/pages/Concert/style.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Styled from 'styled-components'; - -export const ConcertWrapper = Styled.div` - display: flex; - flex-direction: column; - justify-content: center; - margin: 0 auto; - width: 845px; -`; diff --git a/src/pages/ConcertDetail/index.tsx b/src/pages/ConcertDetail/index.tsx index b6e8d8c0..fe6003de 100644 --- a/src/pages/ConcertDetail/index.tsx +++ b/src/pages/ConcertDetail/index.tsx @@ -6,14 +6,12 @@ import { postConcertLike, postConcertScrap, } from 'apis'; -import { DetailTitle, LoginModal } from 'components/molecules'; -import { CommentList, DetailContent } from 'components/organisms'; import React, { useCallback, useEffect, useState } from 'react'; import { RouteComponentProps } from 'react-router'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; import { IConcert } from 'types/concert.type'; -import { ConcertDetailWrapper } from './style'; +import ConcertDetailTemplate from './template'; interface MatchParams { id: string; @@ -79,38 +77,20 @@ function ConcertDetail({ match }: RouteComponentProps): React.React }; return ( - - {concert && ( - - )} - {concert && ( - - )} - - - + ); } diff --git a/src/pages/ConcertDetail/template/index.tsx b/src/pages/ConcertDetail/template/index.tsx index ad1b2c05..1e6499bf 100644 --- a/src/pages/ConcertDetail/template/index.tsx +++ b/src/pages/ConcertDetail/template/index.tsx @@ -1,7 +1,70 @@ +import { DetailTitle, LoginModal } from 'components/molecules'; +import { CommentList, DetailContent } from 'components/organisms'; import React from 'react'; - -function TConcertDetail(): React.ReactElement { - return
ConcertDetailTemplate
; +import { IConcert, IConcertComment } from 'types/concert.type'; +import { ConcertDetailWrapper } from './style'; +interface IProps { + concert: IConcert | null; + likeNum?: number; + scrapNum?: number; + onLike?: () => void; + onScrap?: () => void; + isUserLike?: boolean; + isUserScrap?: boolean; + commentList: Array; + isRerender: boolean; + setIsRerender: (value: boolean) => void; + isLoginModalOpen: boolean; + setIsLoginModalOpen: (value: boolean) => void; +} +function ConcertDetailTemplate({ + concert, + likeNum, + scrapNum, + onLike, + onScrap, + isUserLike, + isUserScrap, + commentList, + isRerender, + setIsRerender, + isLoginModalOpen, + setIsLoginModalOpen, +}: IProps): React.ReactElement { + return ( + + {concert && ( + + )} + {concert && ( + + )} + + + + ); } -export default TConcertDetail; +export default ConcertDetailTemplate; diff --git a/src/pages/ConcertDetail/style.ts b/src/pages/ConcertDetail/template/style.ts similarity index 100% rename from src/pages/ConcertDetail/style.ts rename to src/pages/ConcertDetail/template/style.ts From c8f1334b6eaa8f0fefc6bed809711c217f703f4c Mon Sep 17 00:00:00 2001 From: JiyoungHyun Date: Sat, 7 Aug 2021 18:25:24 +0900 Subject: [PATCH 18/80] =?UTF-8?q?Etc:=20=EB=A1=9C=EB=94=A9=20=EC=8B=9C=20c?= =?UTF-8?q?ategoryprevbutton=EC=9D=B4=20=EB=B3=B4=EC=9D=B4=EB=8A=94=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/organisms/CategoryList/style.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/components/organisms/CategoryList/style.ts b/src/components/organisms/CategoryList/style.ts index c16afab0..5422241a 100644 --- a/src/components/organisms/CategoryList/style.ts +++ b/src/components/organisms/CategoryList/style.ts @@ -27,8 +27,6 @@ export const GradientLeft = Styled.div<{ disappear: boolean }>` width: 81px; height: 46px; animation-name: ${fadeOut}; - animation-duration: 0.5s; - animation-timing-function: ease-out; animation-fill-mode: forwards; ${(props) => props.disappear && @@ -41,8 +39,6 @@ export const GradientLeft = Styled.div<{ disappear: boolean }>` export const PrevButton = Styled.img<{ disappear: boolean }>` position: absolute; animation-name: ${fadeOut}; - animation-duration: 0.5s; - animation-timing-function: ease-out; animation-fill-mode: forwards; ${(props) => props.disappear && From 0cd29431dd82ce98dc4d36ec4b93ae19de199ed3 Mon Sep 17 00:00:00 2001 From: Subin Date: Sat, 7 Aug 2021 20:43:45 +0900 Subject: [PATCH 19/80] =?UTF-8?q?Fix:=20styled=20input=20=ED=85=8C?= =?UTF-8?q?=EB=91=90=EB=A6=AC=20=EC=95=88=EB=B3=B4=EC=9E=84=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/atoms/StyledInput/style.ts | 27 ++++++++++++-------- src/components/molecules/BadgeCard/index.tsx | 1 - 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/components/atoms/StyledInput/style.ts b/src/components/atoms/StyledInput/style.ts index 5935408f..33ab8ff5 100644 --- a/src/components/atoms/StyledInput/style.ts +++ b/src/components/atoms/StyledInput/style.ts @@ -1,11 +1,11 @@ -import Styled from 'styled-components'; +import Styled, { css } from 'styled-components'; import { palette, theme } from 'styled-tools'; export const Input = Styled.input` border : none; ${theme('font.body1')}; font-size: 16px; - color : ${palette('grayscale', 10)}; + color : ${palette('grayscale', 9)}; text-align: left; width : 100%; height : 100%; @@ -25,17 +25,22 @@ export const InputContainer = Styled.div<{ width: string; height: string; condit -1 : 기본 0 : 컨디션 X 1 : 컨디션 O */ - border : ${(props) => + ${(props) => props.condition == -1 - ? `solid 1px ${palette('grayscale', 2)}` + ? css` + border: solid 1px ${palette('grayscale', 2)}; + ` : props.condition == 1 - ? 'double 1px transparent' - : `solid 1px ${palette('primary', 6)}`}; - background-image : ${(props) => - props.condition == 1 && - `linear-gradient(white, white), linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)})`}; - background-origin : ${(props) => props.condition == 1 && 'border-box'}; - background-clip : ${(props) => props.condition == 1 && 'content-box, border-box'}; + ? css` + border: double 1px transparent; + background-image: linear-gradient(white, white), + linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + background-origin: border-box; + background-clip: content-box, border-box; + ` + : css` + border: solid 1px ${palette('primary', 6)}; + `}; border-radius : 4px; display : flex; align-items : center; diff --git a/src/components/molecules/BadgeCard/index.tsx b/src/components/molecules/BadgeCard/index.tsx index 8f59964b..ad9b02ba 100644 --- a/src/components/molecules/BadgeCard/index.tsx +++ b/src/components/molecules/BadgeCard/index.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import Styled from 'styled-components'; import { Exp, Image, SBadgeCard, Title } from './style'; export interface IProps { From ee54b9fc3c0f58dde2267f0f79f617b078d86714 Mon Sep 17 00:00:00 2001 From: Subin Date: Sat, 7 Aug 2021 20:58:19 +0900 Subject: [PATCH 20/80] =?UTF-8?q?Fix:=20styled=20component=20Props=20?= =?UTF-8?q?=EB=B3=80=EC=88=98=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/AdminChallengeOpenForm/index.tsx | 6 +++--- src/components/molecules/AdminChallengeOpenForm/style.ts | 4 ++-- src/components/organisms/AdminChallengeOpen/index.tsx | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/molecules/AdminChallengeOpenForm/index.tsx b/src/components/molecules/AdminChallengeOpenForm/index.tsx index fdefbd4a..77ae327b 100644 --- a/src/components/molecules/AdminChallengeOpenForm/index.tsx +++ b/src/components/molecules/AdminChallengeOpenForm/index.tsx @@ -91,7 +91,7 @@ function AdminChallengeOpenForm({ isConditionMet={isConditionMet.challengePeriod.start} margin="0 0 40px 0" /> - ~ + ~ - ~ + ~ - 명 + 명 ); diff --git a/src/components/molecules/AdminChallengeOpenForm/style.ts b/src/components/molecules/AdminChallengeOpenForm/style.ts index df1babe9..ab918dab 100644 --- a/src/components/molecules/AdminChallengeOpenForm/style.ts +++ b/src/components/molecules/AdminChallengeOpenForm/style.ts @@ -23,8 +23,8 @@ export const PeopleContainer = Styled.div` align-items : flex-start; `; -export const Text = Styled.div<{ style: string }>` - ${theme(`font.style`)}; +export const Text = Styled.div<{ font: string }>` + ${theme(`font.font`)}; line-height : 60px; color : ${palette('grayscale', 4)}; `; diff --git a/src/components/organisms/AdminChallengeOpen/index.tsx b/src/components/organisms/AdminChallengeOpen/index.tsx index bd70abe7..46e4dcb4 100644 --- a/src/components/organisms/AdminChallengeOpen/index.tsx +++ b/src/components/organisms/AdminChallengeOpen/index.tsx @@ -93,7 +93,7 @@ function AdminChallengeOpen(): React.ReactElement { /> 사진 업로드 - + From ed19fb2ed0ab91da367e12c431621e9acb5dbfb5 Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Sun, 8 Aug 2021 22:37:40 +0900 Subject: [PATCH 21/80] =?UTF-8?q?Etc:=20=ED=83=80=EC=9E=85=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/user.ts | 19 +------------------ src/types/global.type.ts | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 src/types/global.type.ts diff --git a/src/stores/user.ts b/src/stores/user.ts index 026f4390..471f409b 100644 --- a/src/stores/user.ts +++ b/src/stores/user.ts @@ -1,26 +1,9 @@ import { atom } from 'recoil'; import { recoilPersist } from 'recoil-persist'; +import { IUserState, IUserStatusState } from 'types/global.type'; const { persistAtom } = recoilPersist(); -interface IUserStatusState { - token: string; - userType: number; - totalGeneration: number; - registGeneration: number | null; - progressGeneration: number; -} - -interface IUserState { - interest: string[]; - marpolicy: boolean; - img: string; - _id: string; - email: string; - nickname: string; - gender: number; -} - export const userState = atom({ key: 'user/atom', default: null, diff --git a/src/types/global.type.ts b/src/types/global.type.ts new file mode 100644 index 00000000..6339bbbc --- /dev/null +++ b/src/types/global.type.ts @@ -0,0 +1,17 @@ +export interface IUserStatusState { + token: string; + userType: number; + totalGeneration: number; + registGeneration: number | null; + progressGeneration: number; +} + +export interface IUserState { + interest: string[]; + marpolicy: boolean; + img: string; + _id: string; + email: string; + nickname: string; + gender: number; +} From 687d19c4fdb2485c0f57064cc03f686045c913c1 Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Sun, 8 Aug 2021 22:38:14 +0900 Subject: [PATCH 22/80] =?UTF-8?q?Refactor:=20=ED=85=9C=ED=94=8C=EB=A6=BF?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=9D=B4?= =?UTF-8?q?=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/MyPage/{ => template}/style.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/pages/MyPage/{ => template}/style.ts (100%) diff --git a/src/pages/MyPage/style.ts b/src/pages/MyPage/template/style.ts similarity index 100% rename from src/pages/MyPage/style.ts rename to src/pages/MyPage/template/style.ts From 4b72df471aef01fc4b1f953f4c0c75fd871ad8d1 Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Sun, 8 Aug 2021 22:40:07 +0900 Subject: [PATCH 23/80] =?UTF-8?q?Refactor:=20Page=20-=20Template=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/MyPage/index.tsx | 250 ++++++++-------------------- src/pages/MyPage/template/index.tsx | 186 ++++++++++++++++++++- 2 files changed, 251 insertions(+), 185 deletions(-) diff --git a/src/pages/MyPage/index.tsx b/src/pages/MyPage/index.tsx index 04e0fb0b..7d29dd00 100644 --- a/src/pages/MyPage/index.tsx +++ b/src/pages/MyPage/index.tsx @@ -9,16 +9,7 @@ import { getUserCommentList, } from 'apis'; import { Logo } from 'assets/images'; -import { Modal } from 'components/atoms'; -import { - ChallengeCard, - ChallengeModalComment, - DeleteModal, - MyPageConcertCard, - MyPageSection, -} from 'components/molecules'; -import { MyCommentList, MyPageHeader } from 'components/organisms'; -import dayjs from 'dayjs'; +import { ChallengeCard, MyPageConcertCard } from 'components/molecules'; import React, { useCallback, useEffect, useState } from 'react'; import { useRecoilValue } from 'recoil'; import { userState, userStatusState } from 'stores/user'; @@ -26,24 +17,7 @@ import { IChallenge, IChallengeData } from 'types/challenge.type'; import { IConcert } from 'types/concert.type'; import { IMyPageHeader, IMyScrappedChallenge, IMyScrappedConcert, IMyUserCommentResponse } from 'types/myPage.type'; import { changeDateFormat } from 'utils'; -import { - Body, - Bottom, - ChallengeModalWrapper, - CloseButton, - CommentWrapper, - Header, - ModalUserImg, - ModalUserInfo, - ModalUserInfoWrapper, - ModalWrapper, - MoreButton, - Switch, - SwitchRadio, - TextArea, - Top, - Wrapper, -} from './style'; +import MyPageTemplate from './template'; function MyPage(): React.ReactElement { const [selectedSection, setSelectedSection] = useState('scrap'); @@ -68,6 +42,11 @@ function MyPage(): React.ReactElement { setSelectedSection(e.target.id); }; + const handleCommentFold = () => { + !isFolded && setIsChallengeModalOpen(false); + setIsFolded(!isFolded); + }; + const handleModalOpen = () => { setIsModalOpened(true); }; @@ -79,6 +58,37 @@ function MyPage(): React.ReactElement { setIsModalOpened(false); }; + const renderScrappedConcert = (data: IConcert[]) => { + return data?.map((item: IConcert) => { + return ( + + ); + }); + }; + + const renderChallenge = (data: IChallenge[]) => { + return data?.map((item: IChallenge) => ( + + )); + }; + const fetchMyPageUserInfo = useCallback(async () => { const data = await getMyPageUserInfo(globalUserStatusInfo?.token); setUserInfo(data); @@ -146,161 +156,37 @@ function MyPage(): React.ReactElement { fetchUserCommentList(selectedCategory, currentPage); }, [selectedCategory, currentPage, isReRender, fetchUserCommentList]); - const renderScrappedConcert = (data: IConcert[]) => { - return data?.map((item: IConcert) => { - return ( - - ); - }); - }; - - const renderChallenge = (data: IChallenge[]) => { - return data?.map((item: IChallenge) => ( - - )); - }; - return ( - -
- -
- - -
  • - - -
  • -
  • - - -
  • -
    - - {selectedSection === 'scrap' ? ( - - ) : ( - - )} - - - {selectedSection === 'scrap' ? ( - - ) : ( - userComment && ( - - ) - )} - - - - - - - - - -
    -
    {challenge?.user?.nickname}
    -
    {dayjs().format('MM.DD')}
    -
    -
    {challenge?.interest?.map((item: string) => `#${item} `)}
    -
    -
    - - { - setIsFolded(!isFolded); - }} - > - {isFolded ? '더보기' : '접기'} - - - {challenge?.comments.map((comment) => ( - - ))} - -
    - { - setIsChallengeModalOpen(false); - setIsFolded(true); - }} - > - 닫기 - -
    -
    -
    + ); } diff --git a/src/pages/MyPage/template/index.tsx b/src/pages/MyPage/template/index.tsx index d82cc99a..aa56d079 100644 --- a/src/pages/MyPage/template/index.tsx +++ b/src/pages/MyPage/template/index.tsx @@ -1,7 +1,187 @@ +import { Modal } from 'components/atoms'; +import { ChallengeModalComment, DeleteModal, MyPageSection } from 'components/molecules'; +import { MyCommentList, MyPageHeader } from 'components/organisms'; +import dayjs from 'dayjs'; import React from 'react'; +import { IChallenge, IChallengeData } from 'types/challenge.type'; +import { IConcert } from 'types/concert.type'; +import { IUserState } from 'types/global.type'; +import { IMyPageHeader, IMyScrappedChallenge, IMyScrappedConcert, IMyUserCommentResponse } from 'types/myPage.type'; +import * as S from './style'; -function Home(): React.ReactElement { - return
    Home
    ; +export interface IProps { + userInfo: IMyPageHeader | null; + globalUserInfo: IUserState | null; + concertData: IMyScrappedConcert | null; + scrappedChallenge: IMyScrappedChallenge | null; + userChallengeList: IChallengeData[] | null; + userComment: IMyUserCommentResponse | null; + challenge: IChallenge | null; + selectedSection: string; + selectedCategory: string; + isModalOpened: boolean; + isSelectAll: boolean; + isChallengeModalOpen: boolean; + isFolded: boolean; + currentPage: number; + checkedCommentList: string[]; + onChangeSection: (e: React.ChangeEvent) => void; + setSelectedCategory: (value: string) => void; + setCurrentPage: (value: number) => void; + setCheckedCommentList: (value: string[]) => void; + setIsSelectAll: (value: boolean) => void; + setIsModalOpened: (value: boolean) => void; + setIsChallengeModalOpen: (value: boolean) => void; + renderScrappedConcert: (data: IConcert[]) => React.ReactElement[]; + renderChallenge: (data: IChallenge[]) => React.ReactElement[]; + handleModalOpen: () => void; + handleCommentFold: () => void; + fetchLearnMyselfData: (id: string) => Promise; + deleteSelectedCommentList: () => void; } -export default Home; +function MyPageTemplate({ + userInfo, + globalUserInfo, + concertData, + scrappedChallenge, + userChallengeList, + userComment, + challenge, + selectedSection, + selectedCategory, + isModalOpened, + isSelectAll, + isChallengeModalOpen, + isFolded, + currentPage, + checkedCommentList, + onChangeSection, + setSelectedCategory, + setCurrentPage, + setCheckedCommentList, + setIsSelectAll, + setIsModalOpened, + setIsChallengeModalOpen, + renderScrappedConcert, + renderChallenge, + handleModalOpen, + handleCommentFold, + fetchLearnMyselfData, + deleteSelectedCommentList, +}: IProps): React.ReactElement { + return ( + + + + + + +
  • + + +
  • +
  • + + +
  • +
    + + {selectedSection === 'scrap' ? ( + + ) : ( + + )} + + + {selectedSection === 'scrap' ? ( + + ) : ( + userComment && ( + + ) + )} + +
    + + + + + + + +
    +
    {challenge?.user?.nickname}
    +
    {dayjs().format('MM.DD')}
    +
    +
    {challenge?.interest?.map((item: string) => `#${item} `)}
    +
    +
    + +

    잘한 점

    +

    {challenge?.good}

    +

    못한 점

    +

    {challenge?.bad}

    +

    배운 점

    +

    {challenge?.learn}

    +
    + {isFolded ? '더보기' : '접기'} + + {challenge?.comments.map((comment) => ( + + ))} + +
    + 닫기 +
    +
    +
    + ); +} + +export default MyPageTemplate; From 9eba265b00af406fedeb3e889c0a7b8fb006928b Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Mon, 9 Aug 2021 00:11:33 +0900 Subject: [PATCH 24/80] =?UTF-8?q?Style=20:=20molecules=20,=20organisms=20e?= =?UTF-8?q?xport=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/index.ts | 12 ++++++++++-- src/components/organisms/index.ts | 5 ++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/molecules/index.ts b/src/components/molecules/index.ts index b4484074..96c3c35f 100644 --- a/src/components/molecules/index.ts +++ b/src/components/molecules/index.ts @@ -4,15 +4,21 @@ export { default as AdminWriteForm } from './AdminWriteForm'; export { default as BadgeCard } from './BadgeCard'; export { default as CategoryButton } from './CategoryButton'; export { default as ChallengeCard } from './ChallengeCard'; +export { default as ChallengeCardBottom } from './ChallengeCardBottom'; +export { default as ChallengeCardFold } from './ChallengeCardFold'; +export { default as ChallengeCardList } from './ChallengeCardList'; +export { default as ChallengeCardProfile } from './ChallengeCardProfile'; export { default as ChallengeComment } from './ChallengeComment'; export { default as ChallengeCommentWrite, default as ChallengeReCommentWrite } from './ChallengeCommentWrite'; -export { default as ChallengeDetailCard } from './ChallengeDetailCard'; export { default as ChallengeDetailRegister } from './ChallengeDetailRegister'; export { default as ChallengeEditCard } from './ChallengeEditCard'; export { default as ChallengeHeader } from './ChallengeHeader'; export { default as ChallengeModalComment } from './ChallengeModalComment'; +export { default as ChallengeProgressBar } from './ChallengeProgressBar'; export { default as ChallengeSingleComment } from './ChallengeSingleComment'; -export { default as ChallengeWriteCard } from './ChallengeWriteCard'; +export { default as ChallengeWriteButton } from './ChallengeWriteButton'; +export { default as ChallengeWriteCard, default as ChallengeWriteForm } from './ChallengeWriteForm'; +export { default as ChallengeWriteInterest } from './ChallengeWriteInterest'; export { default as ChallengeWriteTag } from './ChallengeWriteTag'; export { default as CommentedBoardRow } from './CommentedBoardRow'; export { default as CommentWrite } from './CommentWrite'; @@ -34,6 +40,8 @@ export { default as MyPageConcertCard } from './MyPageConcertCard'; export { default as MyPageSection } from './MyPageSection'; export { default as MyPageSlider } from './MyPageSlider'; export { default as NoticeSingleComment } from './NoticeSingleComment'; +export { default as RegisterCompletedModal } from './RegisterCompletedModal'; +export { default as RegisterConfirmModal } from './RegisterConfirmModal'; export { default as RegisterHeader } from './RegisterHeader'; export { default as ChallengeReCommentList, default as ReplyComment } from './ReplyComment'; export { default as SearchBar } from './SearchBar'; diff --git a/src/components/organisms/index.ts b/src/components/organisms/index.ts index 9bc36844..6e681b9c 100644 --- a/src/components/organisms/index.ts +++ b/src/components/organisms/index.ts @@ -2,7 +2,9 @@ export { default as AdminChallengeList } from './AdminChallengeList'; export { default as AdminChallengeOpen } from './AdminChallengeOpen'; export { default as AdminWrite } from './AdminWrite'; export { default as CategoryList } from './CategoryList'; -export { default as ChallengeCard } from './ChallengeCard'; +export { default as ChallengeDetailCard } from './ChallengeDetailCard'; +export { default as ChallengeEditCard } from './ChallengeEditCard'; +export { default as ChallengeWriteCard } from './ChallengeWriteCard'; export { default as CommentList } from './CommentList'; export { default as ConcertCardList } from './ConcertCardList'; export { default as ConcertList } from './ConcertList'; @@ -18,5 +20,6 @@ export { default as MyPageHeader } from './MyPageHeader'; export { default as NoticeCommentList } from './NoticeCommentList'; export { default as NoticeHeader } from './NoticeHeader'; export { default as NoticeList } from './NoticeList'; +export { default as RegisterDetailCard } from './RegisterDetailCard'; export { default as SearchForm } from './SearchForm'; export { default as SetNewPwd } from './SetNewPwd'; From aef91d197e97b6db8c6e5b3e09bddfc3bc88d24e Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Mon, 9 Aug 2021 00:12:09 +0900 Subject: [PATCH 25/80] =?UTF-8?q?Refactor=20:=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=EB=AA=A8=EB=8B=AC=20css=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/LoginModal/style.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/LoginModal/style.ts b/src/components/molecules/LoginModal/style.ts index de3bdb96..4a0d985c 100644 --- a/src/components/molecules/LoginModal/style.ts +++ b/src/components/molecules/LoginModal/style.ts @@ -12,7 +12,7 @@ export const LoginNotice = Styled.div` `; export const LoginNoticeTitle = Styled.div` - padding:20px 0px 20px 0px; + padding:30px 0px 30px 0px; text-align: center; color: #000000; ${theme('font.dp4')}; From cd9b6caacd91ee322d6d03f651f514833415e82e Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Mon, 9 Aug 2021 00:22:11 +0900 Subject: [PATCH 26/80] =?UTF-8?q?Style=20:=20=EC=B1=8C=EB=A6=B0=EC=A7=80?= =?UTF-8?q?=20=EC=8B=A0=EC=B2=AD=ED=95=98=EA=B8=B0=20template,=20organisms?= =?UTF-8?q?,=20molecules=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChallengeDetailRegister/index.tsx | 43 +---- .../organisms/RegisterDetailCard/index.tsx | 147 +++++++++++++++ .../organisms/RegisterDetailCard/style.ts | 173 ++++++++++++++++++ src/pages/ChallengeRegister/index.tsx | 4 +- .../ChallengeRegister/template/index.tsx | 39 ++++ src/pages/ChallengeRegister/template/style.ts | 173 ++++++++++++++++++ 6 files changed, 544 insertions(+), 35 deletions(-) create mode 100644 src/components/organisms/RegisterDetailCard/index.tsx create mode 100644 src/components/organisms/RegisterDetailCard/style.ts create mode 100644 src/pages/ChallengeRegister/template/index.tsx create mode 100644 src/pages/ChallengeRegister/template/style.ts diff --git a/src/components/molecules/ChallengeDetailRegister/index.tsx b/src/components/molecules/ChallengeDetailRegister/index.tsx index 4b4931fd..694df44a 100644 --- a/src/components/molecules/ChallengeDetailRegister/index.tsx +++ b/src/components/molecules/ChallengeDetailRegister/index.tsx @@ -1,24 +1,20 @@ import { getRegistPeriod, SignRegister } from 'apis'; -import { AlertIcon, CautionIcon, ChallengeImg, CheckCircleIcon, CheckIcon, MinusIcon, PlusIcon } from 'assets/images'; +import { AlertIcon, ChallengeImg, CheckCircleIcon, MinusIcon, PlusIcon } from 'assets/images'; import { Modal } from 'components/atoms'; import { RegisterHeader } from 'components/molecules'; import React, { useEffect, useState } from 'react'; import { useRecoilState } from 'recoil'; import { userState, userStatusState } from 'stores/user'; import { IAdminChallengePeriod } from 'types/admin.type'; +import RegisterConfirmModal from '../RegisterConfirmModal'; import { BoxWrapper, CardDetailWrapper, CardSettingWrapper, CardWrapper, - CautionWrapper, ChallengeSetting, - ConfirmDetail, - ConfirmModalWrapper, Container, - DetailContent, Header, - ModalButton, NoticeCardWrapper, NoticeHeaderWrapper, RegisterButton, @@ -131,33 +127,14 @@ function ChallengeRegister(): React.ReactElement { - - - -

    잠깐! 확인하고 신청 완료하세요

    -

    아래 정보를 확인해주세요

    - -

    챌린지 기간

    -

    - {dateToString(periodData.challengeStartDT)}~{dateToString(periodData.challengeEndDT)} -

    -

    신청자

    -

    {userData?.nickname}님

    -

    챌린지 개수

    -

    {registerCount}개

    -
    - - -

    주의사항

    -
    -
    챌린지 개수 2개를 선택하시면 최종 달성률 80%를 넘더라도 배지를 받을 수 없어요!
    -
    - - -

    주의 사항을 확인했으며 챌린지 신청을 완료합니다.

    -
    -
    -
    + {isRegisterSubmit === true ? ( diff --git a/src/components/organisms/RegisterDetailCard/index.tsx b/src/components/organisms/RegisterDetailCard/index.tsx new file mode 100644 index 00000000..c5409f2a --- /dev/null +++ b/src/components/organisms/RegisterDetailCard/index.tsx @@ -0,0 +1,147 @@ +import { getRegistPeriod, SignRegister } from 'apis'; +import { AlertIcon, MinusIcon, PlusIcon } from 'assets/images'; +import { RegisterCompletedModal, RegisterConfirmModal } from 'components/molecules'; +import React, { useEffect, useState } from 'react'; +import { useRecoilState } from 'recoil'; +import { userState, userStatusState } from 'stores/user'; +import { IAdminChallengePeriod } from 'types/admin.type'; +import { + BoxWrapper, + CardDetailWrapper, + CardSettingWrapper, + CardWrapper, + ChallengeSetting, + NoticeCardWrapper, + NoticeHeaderWrapper, + RegisterButton, +} from './style'; + +function RegisterDetailCard() { + const [userData, setUserData] = useRecoilState(userState); + const [userStatusData, setUserStatusData] = useRecoilState(userStatusState); + const [registerCount, setRegisterCount] = useState(0); + const [isOpenModal, setIsOpenModal] = useState(false); + const [isRegisterSubmit, setIsRegisterSubmit] = useState(false); + const [periodData, setPeriodData] = useState(null); + + function minusCount() { + if (registerCount > 0) { + setRegisterCount(registerCount - 1); + } + } + const handleSubmit = async () => { + const signData = { + challengeCNT: registerCount, + }; + if (userStatusData) { + const getData = await SignRegister(signData, userStatusData.token); + if (getData) { + setIsRegisterSubmit(true); + setIsOpenModal(false); + } else { + setIsOpenModal(false); + } + } + }; + + const dateToString = (date: string): string => { + let month = date.substr(5, 2); + if (month.substr(0, 1) === '0') month = month.substr(1, 1); + let day = date.substr(8, 2); + if (day.substr(0, 1) === '0') day = day.substr(1, 1); + return `${month}월 ${day}일`; + }; + + const getRestDay = (dateString: string): number => { + const date = new Date( + parseInt(dateString.substr(0, 4)), + parseInt(dateString.substr(5, 2)) - 1, + parseInt(dateString.substr(8, 2)), + ); + const today = new Date(); + const rest = Math.ceil((date.getTime() - today.getTime()) / (1000 * 3600 * 24)); + return rest; + }; + + const getChallengePeriod = async () => { + const data = await getRegistPeriod(); + data && setPeriodData(data); + }; + + useEffect(() => { + getChallengePeriod(); + }, []); + + return periodData ? ( + <> + + +

    신청기간

    +

    {getRestDay(periodData.registerEndDT)}일 남음

    +

    챌린지 기간

    +

    + {dateToString(periodData.challengeStartDT)} ~ {dateToString(periodData.challengeEndDT)} +

    + + +

    챌린지 개수 설정

    +

    2개 이상부터 뱃지 획득 가능

    +
    + +

    { + minusCount(); + }} + > + +

    + {registerCount} +

    { + setRegisterCount(registerCount + 1); + }} + > + +

    +
    +
    + + + +
    + + {isRegisterSubmit === true ? ( + + ) : null} + + + + 오투 챌린지 주의사항 + + +

    01

    +

    주당 회고록 개수 3개 이상 선택 및 80% 이상 달성 시 뱃지 획득이 가능합니다.

    +

    02

    +

    본 챌린지 의도와는 다른 광고성 글과 카테고리와 무관한 내용은 무통보 삭제 될 수 있습니다.

    +
    +
    + + ) : ( +

    챌린지 신청기간이 아닙니다

    + ); +} + +export default RegisterDetailCard; diff --git a/src/components/organisms/RegisterDetailCard/style.ts b/src/components/organisms/RegisterDetailCard/style.ts new file mode 100644 index 00000000..3cc82eb8 --- /dev/null +++ b/src/components/organisms/RegisterDetailCard/style.ts @@ -0,0 +1,173 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const Container = Styled.div` + margin: 0 auto; + text-align: center; +`; + +export const Header = Styled.div` + position: sticky; + top: 60px; + background-color:${palette('grayscale', 0)}; + width: 100%; + + p{ + padding-top:25px; + height: 70px; + text-align: center; + ${theme('font.body4')}; + } + span{ + display: inline-block; + opacity: 0.4; + background-color: ${palette('grayscale', 10)}; + width: 100%; + height: 2px; + } +`; + +export const CardWrapper = Styled.div` + display:inline-block; + padding:60px 0px 0px 20px; + vertical-align: top; +`; + +export const CardDetailWrapper = Styled.div` + margin-bottom:30px; + border-radius: 10px; + box-shadow: 0 0 24px 0 rgba(13, 12, 63, 0.1); + padding: 50px 30px; + width: 354px; + height: 487px; + + h1{ + margin: 0 243px 4px 0; + width: 51px; + height: 21px; + text-align: center; + color: ${palette('grayscale', 7)}; + ${theme('font.body2')}; + } + h2{ + margin: 4px 0 0; + width: 294px; + height: 44px; + text-align: left; + color: ${palette('grayscale', 7)}; + ${theme('font.dp1')}; + } + h3{ + margin-top:40px; + width: 62px; + height: 21px; + color: ${palette('grayscale', 7)}; + ${theme('font.body2')}; + } + h4{ + margin: 4px 0 0; + width: 294px; + height: 44px; + text-align: left; + color: ${palette('grayscale', 7)}; + ${theme('font.dp1')}; + } +`; + +export const RegisterImg = Styled.div` + display:inline-block; + padding-top:60px; + width: 677px; + height: 1414px; +`; + +export const CardSettingWrapper = Styled.div` + display: flex; + flexDirection: row; + justifyContent: space-between; + + h1{ + margin: 0 37px 0 0; + margin-top:60px; + width: 89px; + height: 21px; + text-align: center; + color: ${palette('grayscale', 7)}; + ${theme('font.body2')}; + } + p{ + width: 126px; + height: 18px; + color: ${palette('grayscale', 2)}; + ${theme('font.body1')}; + } +`; + +export const BoxWrapper = Styled.div` + box-sizing: border-box; + display: flex; + align-items: center; + justify-content: space-between; + margin-top: 60px; + border: solid 1px ${palette('grayscale', 1)}; + border-radius: 4px; + padding: 0 16px; + width: 119px; + height: 36px; + margin-left : 49px; + ${theme('font.subhead3_eng')}; + + p{ + border:none; + background-color: ${palette('grayscale', 0)}; + cursor: pointer; + } +`; + +export const ChallengeSetting = Styled.div` + display:inline-block; +`; + +export const RegisterButton = Styled.div` + margin-top:50px; + + button{ + border:none; + border-radius: 4px; + background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); + width:294px; + height:60px; + color: ${palette('grayscale', 0)}; + ${theme('font.subhead3')}; + } +`; + +export const NoticeCardWrapper = Styled.div` + border-radius: 10px; + box-shadow: 0 0 24px 0 rgba(13, 12, 63, 0.1); + padding: 30px 30px 30px 28px; + width: 354px; + height: 282px; + + h1{ + margin-top:20px; + text-align: left; + color: ${palette('grayscale', 3)}; + ${theme('font.subhead3_eng')}; + } + p{ + text-align: left; + color: ${palette('grayscale', 4)}; + ${theme('font.body3')}; + } +`; + +export const NoticeHeaderWrapper = Styled.div` + text-align: left; + color: ${palette('grayscale', 7)}; + ${theme('font.body4')}; + + img{ + float:right; + } +`; diff --git a/src/pages/ChallengeRegister/index.tsx b/src/pages/ChallengeRegister/index.tsx index f0a63045..26887610 100644 --- a/src/pages/ChallengeRegister/index.tsx +++ b/src/pages/ChallengeRegister/index.tsx @@ -1,10 +1,10 @@ -import Register from 'components/molecules/ChallengeDetailRegister'; import React from 'react'; +import ChallengeDetailRegister from './template'; const ChallengeRegister = () => { return (
    - +
    ); }; diff --git a/src/pages/ChallengeRegister/template/index.tsx b/src/pages/ChallengeRegister/template/index.tsx new file mode 100644 index 00000000..a8d1fbf6 --- /dev/null +++ b/src/pages/ChallengeRegister/template/index.tsx @@ -0,0 +1,39 @@ +import { getRegistPeriod } from 'apis'; +import { ChallengeImg } from 'assets/images'; +import { RegisterHeader } from 'components/molecules'; +import { RegisterDetailCard } from 'components/organisms'; +import React, { useEffect, useState } from 'react'; +import { useRecoilState } from 'recoil'; +import { userState } from 'stores/user'; +import { IAdminChallengePeriod } from 'types/admin.type'; +import { Container, Header, RegisterImg } from './style'; + +function ChallengeRegister(): React.ReactElement { + const [userData, setUserData] = useRecoilState(userState); + const [periodData, setPeriodData] = useState(null); + + const getChallengePeriod = async () => { + const data = await getRegistPeriod(); + data && setPeriodData(data); + }; + useEffect(() => { + getChallengePeriod(); + }, []); + + return periodData ? ( + + +
    +

    챌린지 설명

    + +
    + + + + +
    + ) : ( +

    챌린지 신청기간이 아닙니다

    + ); +} +export default ChallengeRegister; diff --git a/src/pages/ChallengeRegister/template/style.ts b/src/pages/ChallengeRegister/template/style.ts new file mode 100644 index 00000000..3cc82eb8 --- /dev/null +++ b/src/pages/ChallengeRegister/template/style.ts @@ -0,0 +1,173 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const Container = Styled.div` + margin: 0 auto; + text-align: center; +`; + +export const Header = Styled.div` + position: sticky; + top: 60px; + background-color:${palette('grayscale', 0)}; + width: 100%; + + p{ + padding-top:25px; + height: 70px; + text-align: center; + ${theme('font.body4')}; + } + span{ + display: inline-block; + opacity: 0.4; + background-color: ${palette('grayscale', 10)}; + width: 100%; + height: 2px; + } +`; + +export const CardWrapper = Styled.div` + display:inline-block; + padding:60px 0px 0px 20px; + vertical-align: top; +`; + +export const CardDetailWrapper = Styled.div` + margin-bottom:30px; + border-radius: 10px; + box-shadow: 0 0 24px 0 rgba(13, 12, 63, 0.1); + padding: 50px 30px; + width: 354px; + height: 487px; + + h1{ + margin: 0 243px 4px 0; + width: 51px; + height: 21px; + text-align: center; + color: ${palette('grayscale', 7)}; + ${theme('font.body2')}; + } + h2{ + margin: 4px 0 0; + width: 294px; + height: 44px; + text-align: left; + color: ${palette('grayscale', 7)}; + ${theme('font.dp1')}; + } + h3{ + margin-top:40px; + width: 62px; + height: 21px; + color: ${palette('grayscale', 7)}; + ${theme('font.body2')}; + } + h4{ + margin: 4px 0 0; + width: 294px; + height: 44px; + text-align: left; + color: ${palette('grayscale', 7)}; + ${theme('font.dp1')}; + } +`; + +export const RegisterImg = Styled.div` + display:inline-block; + padding-top:60px; + width: 677px; + height: 1414px; +`; + +export const CardSettingWrapper = Styled.div` + display: flex; + flexDirection: row; + justifyContent: space-between; + + h1{ + margin: 0 37px 0 0; + margin-top:60px; + width: 89px; + height: 21px; + text-align: center; + color: ${palette('grayscale', 7)}; + ${theme('font.body2')}; + } + p{ + width: 126px; + height: 18px; + color: ${palette('grayscale', 2)}; + ${theme('font.body1')}; + } +`; + +export const BoxWrapper = Styled.div` + box-sizing: border-box; + display: flex; + align-items: center; + justify-content: space-between; + margin-top: 60px; + border: solid 1px ${palette('grayscale', 1)}; + border-radius: 4px; + padding: 0 16px; + width: 119px; + height: 36px; + margin-left : 49px; + ${theme('font.subhead3_eng')}; + + p{ + border:none; + background-color: ${palette('grayscale', 0)}; + cursor: pointer; + } +`; + +export const ChallengeSetting = Styled.div` + display:inline-block; +`; + +export const RegisterButton = Styled.div` + margin-top:50px; + + button{ + border:none; + border-radius: 4px; + background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); + width:294px; + height:60px; + color: ${palette('grayscale', 0)}; + ${theme('font.subhead3')}; + } +`; + +export const NoticeCardWrapper = Styled.div` + border-radius: 10px; + box-shadow: 0 0 24px 0 rgba(13, 12, 63, 0.1); + padding: 30px 30px 30px 28px; + width: 354px; + height: 282px; + + h1{ + margin-top:20px; + text-align: left; + color: ${palette('grayscale', 3)}; + ${theme('font.subhead3_eng')}; + } + p{ + text-align: left; + color: ${palette('grayscale', 4)}; + ${theme('font.body3')}; + } +`; + +export const NoticeHeaderWrapper = Styled.div` + text-align: left; + color: ${palette('grayscale', 7)}; + ${theme('font.body4')}; + + img{ + float:right; + } +`; From 6cf3724804538393decd5577410950ed79218543 Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Mon, 9 Aug 2021 00:24:49 +0900 Subject: [PATCH 27/80] =?UTF-8?q?Style=20:=20=EB=9F=B0=EB=A7=88=EC=85=80?= =?UTF-8?q?=20template,=20organisms,=20molecules=20=EB=B6=84=EB=A6=AC=20?= =?UTF-8?q?=EB=B0=8F=20=EB=AA=A8=EB=93=88=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../molecules/ChallengeCardBottom/index.tsx | 110 +++++ .../molecules/ChallengeCardBottom/style.ts | 32 ++ .../molecules/ChallengeCardFold/index.tsx | 64 +++ .../molecules/ChallengeCardFold/style.ts | 25 ++ .../molecules/ChallengeCardList/index.tsx | 30 ++ .../molecules/ChallengeCardList/style.ts | 26 ++ .../molecules/ChallengeCardProfile/index.tsx | 145 +++++++ .../molecules/ChallengeCardProfile/style.ts | 67 +++ .../molecules/ChallengeDetailCard/index.tsx | 387 ------------------ src/pages/ChallengeList/index.tsx | 10 +- .../ChallengeList/template}/index.tsx | 2 +- src/pages/ChallengeList/template/style.ts | 11 + 12 files changed, 518 insertions(+), 391 deletions(-) create mode 100644 src/components/molecules/ChallengeCardBottom/index.tsx create mode 100644 src/components/molecules/ChallengeCardBottom/style.ts create mode 100644 src/components/molecules/ChallengeCardFold/index.tsx create mode 100644 src/components/molecules/ChallengeCardFold/style.ts create mode 100644 src/components/molecules/ChallengeCardList/index.tsx create mode 100644 src/components/molecules/ChallengeCardList/style.ts create mode 100644 src/components/molecules/ChallengeCardProfile/index.tsx create mode 100644 src/components/molecules/ChallengeCardProfile/style.ts delete mode 100644 src/components/molecules/ChallengeDetailCard/index.tsx rename src/{components/organisms/ChallengeCard => pages/ChallengeList/template}/index.tsx (96%) create mode 100644 src/pages/ChallengeList/template/style.ts diff --git a/src/components/molecules/ChallengeCardBottom/index.tsx b/src/components/molecules/ChallengeCardBottom/index.tsx new file mode 100644 index 00000000..45caaf64 --- /dev/null +++ b/src/components/molecules/ChallengeCardBottom/index.tsx @@ -0,0 +1,110 @@ +import { CancelChallengeLike, ChallengeLike } from 'apis'; +import { ClickGoodIcon, CommentCountIcon, LikeFilledIcon } from 'assets/images'; +import React, { useState } from 'react'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import { ButtonWrapper, FoldButton, IconWrapper } from './style'; + +interface IProps { + setIsClosed: (value: boolean) => void; + setIsLoginModalOpen: (value: boolean) => void; + isLike?: boolean; + like: number; + comments?: number; + id: string; +} + +function ChallengeCardBottom({ + setIsClosed, + setIsLoginModalOpen, + like, + isLike, + comments, + id, +}: IProps): React.ReactElement { + const userStatusData = useRecoilValue(userStatusState); + const [countLikes, setCountLikes] = useState(like); + const [likeRender, setLikeRender] = useState(isLike); + const [lookMoreButton, setLookMoreButton] = useState(true); + const [userStateNum, setUserState] = useState(userStatusData ? userStatusData.userType : 0); + + const submitLike = async () => { + if (userStatusData) { + const token = userStatusData.token; + const submitSuccess = await ChallengeLike(token, id); + if (submitSuccess) { + setLikeRender(true); + setCountLikes(countLikes + 1); + } + } + }; + + const cancelLike = async () => { + if (userStatusData) { + const token = userStatusData.token; + const cancelSuccess = await CancelChallengeLike(token, id); + if (cancelSuccess) { + setLikeRender(false); + setCountLikes(countLikes - 1); + } + } + }; + + return ( + <> + {lookMoreButton === true ? ( + + { + setLookMoreButton(false); + setIsClosed(true); + }} + > + 더보기 + + + ) : ( + + { + setLookMoreButton(true); + setIsClosed(false); + }} + > + 접기 + + + )} + + {likeRender ? ( + { + cancelLike(); + { + userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); + } + }} + alt="" + /> + ) : ( + { + submitLike(); + { + userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); + } + }} + alt="" + /> + )} +

    {countLikes}

    + +

    {comments}

    +
    + + ); +} + +export default ChallengeCardBottom; diff --git a/src/components/molecules/ChallengeCardBottom/style.ts b/src/components/molecules/ChallengeCardBottom/style.ts new file mode 100644 index 00000000..579fd7f5 --- /dev/null +++ b/src/components/molecules/ChallengeCardBottom/style.ts @@ -0,0 +1,32 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const IconWrapper = Styled.div` + padding: 33px 620px 0px 30px; + padding-bottom:50px; + + h2{ + display:inline-block; + margin: 4px 0 3.2px 8px; + width: 60px; + font-size: 18px; + } + img{ + display:inline-block; + width: 24px; + height:24px; + } +`; + +export const ButtonWrapper = Styled.div` + align-items: center; + margin: 0 auto; + padding: 50px 385px 0px 385px; +`; + +export const FoldButton = Styled.button` + border:0; + background: ${palette('grayscale', 0)}; + color: ${palette('primary', 5)}; + ${theme('font.subhead4')}; +`; diff --git a/src/components/molecules/ChallengeCardFold/index.tsx b/src/components/molecules/ChallengeCardFold/index.tsx new file mode 100644 index 00000000..71167f24 --- /dev/null +++ b/src/components/molecules/ChallengeCardFold/index.tsx @@ -0,0 +1,64 @@ +import { getChallengeContent } from 'apis'; +import { ChallengeComment } from 'components/molecules'; +import React, { useCallback, useEffect, useState } from 'react'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import { ICommentData } from 'types/challenge.type'; +import { CommentButton, CommentFoldButton } from './style'; + +interface IProps { + id: string; +} + +function ChallengeCardFold({ id }: IProps): React.ReactElement { + const [isOpenComment, setIsOpenComment] = useState(false); + const [isFoldComment, setIsFoldComment] = useState(true); + const userStatusData = useRecoilValue(userStatusState); + const [isCommentListFlag, setIsCommentListFlag] = useState(false); + const [myCommentList, setMyCommentList] = useState(null); + + const getCommentList = useCallback(async () => { + if (userStatusData) { + const data = await getChallengeContent(id, userStatusData.token); + data && setMyCommentList(data.comments); + } + }, [id, userStatusData]); + + useEffect(() => { + getCommentList(); + }, [isCommentListFlag, getCommentList]); + return ( + <> + {isOpenComment === false ? ( + { + setIsOpenComment(true); + getCommentList(); + }} + > + 댓글 펼치기 + + ) : ( +
    + {isFoldComment === false ? null : ( + + )} + { + setIsOpenComment(false); + }} + > + 댓글 접기 + +
    + )} + + ); +} + +export default ChallengeCardFold; diff --git a/src/components/molecules/ChallengeCardFold/style.ts b/src/components/molecules/ChallengeCardFold/style.ts new file mode 100644 index 00000000..377deb9f --- /dev/null +++ b/src/components/molecules/ChallengeCardFold/style.ts @@ -0,0 +1,25 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const CommentFoldButton = Styled.button` + + border-radius: 0px 0px 18px 18px; + background: ${palette('grayscale', 7)}; + width: 844px; + height: 63px; + line-height: 22px; + color: ${palette('grayscale', 0)}; + ${theme('font.subhead3')}; +`; + +export const CommentButton = Styled.button` + align-items: center; + border-radius: 0px 0px 18px 18px; + background: ${palette('grayscale', 7)}; + width: 844px; + height: 63px; + text-align: center; + color: ${palette('grayscale', 0)}; + ${theme('font.subhead3')}; + +`; diff --git a/src/components/molecules/ChallengeCardList/index.tsx b/src/components/molecules/ChallengeCardList/index.tsx new file mode 100644 index 00000000..d4861620 --- /dev/null +++ b/src/components/molecules/ChallengeCardList/index.tsx @@ -0,0 +1,30 @@ +import React from 'react'; +import { FormDetailWrapper } from './style'; + +interface IProps { + good?: string; + bad?: string; + learn?: string; + isClosed: boolean; +} + +function ChallengeCardList({ good, bad, learn, isClosed }: IProps): React.ReactElement { + return ( +
    + +

    잘한점

    + {isClosed === true ?
    {good}
    :

    {good}

    } +
    + +

    못한점

    + {isClosed === true ?
    {bad}
    :

    {bad}

    } +
    + +

    배운점

    + {isClosed === true ?
    {learn}
    :

    {learn}

    } +
    +
    + ); +} + +export default ChallengeCardList; diff --git a/src/components/molecules/ChallengeCardList/style.ts b/src/components/molecules/ChallengeCardList/style.ts new file mode 100644 index 00000000..e227951e --- /dev/null +++ b/src/components/molecules/ChallengeCardList/style.ts @@ -0,0 +1,26 @@ +import Styled from 'styled-components'; +import { theme } from 'styled-tools'; + +export const FormDetailWrapper = Styled.div` + padding: 30px 30px 0 60px; + + h1{ + text-align: left; + ${theme('font.subhead3')}; + } + h5{ + width:724px; + max-height: 100%; + text-align: left; + ${theme('font.body3')}; + } + h2{ + width:724px; + overflow:hidden; + text-align: left; + text-overflow:ellipsis; + white-space:nowrap; + ${theme('font.body3')}; + } + +`; diff --git a/src/components/molecules/ChallengeCardProfile/index.tsx b/src/components/molecules/ChallengeCardProfile/index.tsx new file mode 100644 index 00000000..08e7636e --- /dev/null +++ b/src/components/molecules/ChallengeCardProfile/index.tsx @@ -0,0 +1,145 @@ +import { CancelChallengeScrap, ChallengeScrap } from 'apis'; +import { ColorScrapIcon, DeleteIcon, EditIcon, GrayScrapIcon, MenuBarIcon } from 'assets/images'; +import dayjs from 'dayjs'; +import React, { useState } from 'react'; +import { useHistory } from 'react-router'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import { + DeleteBar, + DeleteEditCardButton, + InterestTag, + MenuBarWrapper, + MenuButton, + ProfileDetailWrapper, + ProfileImage, + ProfileWrapper, +} from './style'; + +interface IProps { + setIsDeleteModalOpen: (value: boolean) => void; + setIsLoginModalOpen: (value: boolean) => void; + isMine: boolean; + nickname?: string; + image?: string; + createdAt?: string; + isScrap?: boolean; + interest?: string[]; + id: string; +} + +function ChallengeCardProfile({ + setIsDeleteModalOpen, + setIsLoginModalOpen, + isMine, + nickname, + image, + createdAt, + isScrap, + interest, + id, +}: IProps): React.ReactElement { + const history = useHistory(); + const [isMenuBar, setIsMenuBar] = useState(true); + const [scrapRender, setScrapRender] = useState(isScrap); + const userStatusData = useRecoilValue(userStatusState); + const [userStateNum, setUserState] = useState(userStatusData ? userStatusData.userType : 0); + + const submitScrap = async () => { + if (userStatusData) { + const token = userStatusData.token; + const submitSuccess = await ChallengeScrap(token, id); + if (submitSuccess) { + setScrapRender(true); + } + } + }; + + const cancelScrap = async () => { + if (userStatusData) { + const token = userStatusData.token; + const cancelSuccess = await CancelChallengeScrap(token, id); + if (cancelSuccess) { + setScrapRender(false); + } + } + }; + + return ( +
    + + +
    + +

    {nickname}

    +

    {dayjs(createdAt).format('MM.DD')}

    +
    + {userStateNum === 0 || userStateNum === 1 || userStateNum === 2 || isMine === false ? ( + scrapRender === false ? ( + + + { + submitScrap(); + userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); + }} + /> + + + ) : ( + + + { + cancelScrap(); + userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); + }} + /> + + + ) + ) : isMenuBar === false ? ( + + { + setIsDeleteModalOpen(true); + }} + > + + + { + history.push(`/challenge/edit/${id}`); + }} + > + + + + ) : ( + + + { + setIsMenuBar(false); + }} + /> + + + )} +
    + {interest && + interest.map((item, id) => { + return #{item}; + })} +
    +
    + ); +} + +export default ChallengeCardProfile; diff --git a/src/components/molecules/ChallengeCardProfile/style.ts b/src/components/molecules/ChallengeCardProfile/style.ts new file mode 100644 index 00000000..8baa05e6 --- /dev/null +++ b/src/components/molecules/ChallengeCardProfile/style.ts @@ -0,0 +1,67 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const ProfileDetailWrapper = Styled.div` + display:inline-block; + width: calc(100% - 60px); + + h3{ + display:inline-block; + margin-bottom: 10px; + text-align: left; + ${theme('font.subhead5')}; + } + h4{ + display:inline-block; + align-items: center; + padding-left:10px; + color: ${palette('grayscale', 3)}; + ${theme('font.body2')}; + } +`; + +export const MenuBarWrapper = Styled.div` + display:inline-block; + padding-left: 0px; +`; + +export const DeleteBar = Styled.div` + display:inline-block; +`; + +export const MenuButton = Styled.button` + border:none; + background-color:${palette('grayscale', 0)}; +`; + +export const DeleteEditCardButton = Styled.button` + display:inline-block; + border:none; + background-color:${palette('grayscale', 0)}; + padding: 2px; +`; + +export const ProfileWrapper = Styled.div` + display:inline-block; + width: calc( 100% - 140px); + +`; + +export const InterestTag = Styled.div` + display : inline-block; + align-items: center; + margin-right : 5px; + line-height: 20px; + color: ${palette('grayscale', 5)}; + ${theme('font.subhead2')}; + +`; + +export const ProfileImage = Styled.img` + margin: 0 15px 0px 30px; + border: solid 1px ${palette('grayscale', 0)}; + border-radius: 40px 40px 40px 40px; + background-color: ${palette('grayscale', 1)}; + width: 80px; + height: 80px; +`; diff --git a/src/components/molecules/ChallengeDetailCard/index.tsx b/src/components/molecules/ChallengeDetailCard/index.tsx deleted file mode 100644 index 745b4e2c..00000000 --- a/src/components/molecules/ChallengeDetailCard/index.tsx +++ /dev/null @@ -1,387 +0,0 @@ -import { - CancelChallengeLike, - CancelChallengeScrap, - ChallengeLike, - ChallengeScrap, - DeleteChallenge, - getChallengeContent, -} from 'apis'; -import { - ClickGoodIcon, - ColorScrapIcon, - CommentCountIcon, - DeleteIcon, - EditIcon, - GrayScrapIcon, - LikeFilledIcon, - LoginAlertIcon, - MenuBarIcon, -} from 'assets/images'; -import { Modal } from 'components/atoms'; -import { ChallengeComment, DeleteModal } from 'components/molecules'; -import dayjs from 'dayjs'; -import React, { useCallback, useEffect, useState } from 'react'; -import { useHistory } from 'react-router'; -import { useRecoilValue } from 'recoil'; -import { userState, userStatusState } from 'stores/user'; -import { ICommentData } from 'types/challenge.type'; -import { - ButtonWrapper, - CancelButton, - CommentButton, - CommentFoldButton, - Container, - DeleteBar, - DeleteButton, - DeleteEditCardButton, - FoldButton, - FormDetailWrapper, - IconWrapper, - InterestTag, - LoginButtonWrapper, - LoginModalWrapper, - LoginNoticeWrapper, - MainCardWrapper, - MenuBarWrapper, - MenuButton, - ProfileDetailWrapper, - ProfileImage, - ProfileWrapper, -} from './style'; - -interface IProps { - nickname?: string; - image?: string; - createdAt?: string; - interest?: string[]; - good?: string; - bad?: string; - learn?: string; - like: number; - comments?: number; - isLike?: boolean; - isScrap?: boolean; - id: string; - onChange?: () => void; - handleFetch?: (offset: number) => void; -} - -function ChallengeDetailCard({ - nickname, - image, - createdAt, - interest, - good, - bad, - learn, - like, - isLike, - isScrap, - comments, - id, - onChange, - handleFetch, -}: IProps): React.ReactElement { - const history = useHistory(); - const userStatusData = useRecoilValue(userStatusState); - const userData = useRecoilValue(userState); - const [isOpenComment, setIsOpenComment] = useState(false); - const [lookMoreButton, setLookMoreButton] = useState(true); - const [isMenuBar, setIsMenuBar] = useState(true); - const [isFoldComment, setIsFoldComment] = useState(true); - const [isClosed, setIsClosed] = useState(false); - const [countLikes, setCountLikes] = useState(like); - const [myCommentList, setMyCommentList] = useState(null); - const [isCommentListFlag, setIsCommentListFlag] = useState(false); - const [userStateNum, setUserState] = useState(userStatusData ? userStatusData.userType : 0); - const [userStateNickname, setUserStateNickname] = useState(userData ? userData.nickname : 0); - const [isMine, setIsMine] = useState(false); - const [likeRender, setLikeRender] = useState(isLike); - const [scrapRender, setScrapRender] = useState(isScrap); - const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); - const [isConfirmLoginModal, setIsConfirmLoginModal] = useState(false); - - const getCommentList = useCallback(async () => { - if (userStatusData) { - const data = await getChallengeContent(id, userStatusData.token); - data && setMyCommentList(data.comments); - } - }, [id, userStatusData]); - - useEffect(() => { - getCommentList(); - }, [isCommentListFlag, getCommentList]); - - useEffect(() => { - setIsMine(nickname === userStateNickname); - document.body.style.overflow = isDeleteModalOpen === true ? 'hidden' : 'unset'; - }, [isDeleteModalOpen, nickname, userStateNickname]); - - const deleteClickHandler = async () => { - if (userStatusData) { - const token = userStatusData?.token; - const data = await DeleteChallenge(id, token); - data && setIsDeleteModalOpen(false); - onChange?.(); - handleFetch?.(0); - } else { - alert('네트워크가 좋지 않습니다'); - } - }; - - const submitLike = async () => { - if (userStatusData) { - const token = userStatusData.token; - const submitSuccess = await ChallengeLike(token, id); - if (submitSuccess) { - setLikeRender(true); - setCountLikes(countLikes + 1); - } - } - }; - - const cancelLike = async () => { - if (userStatusData) { - const token = userStatusData.token; - const cancelSuccess = await CancelChallengeLike(token, id); - if (cancelSuccess) { - setLikeRender(false); - setCountLikes(countLikes - 1); - } - } - }; - - const submitScarp = async () => { - if (userStatusData) { - const token = userStatusData.token; - const submitSuccess = await ChallengeScrap(token, id); - if (submitSuccess) { - setScrapRender(true); - } - } - }; - - const cancelScrap = async () => { - if (userStatusData) { - const token = userStatusData.token; - const cancelSuccess = await CancelChallengeScrap(token, id); - if (cancelSuccess) { - setScrapRender(false); - } - } - }; - - // userState상태 : - // 0: 비회원, - // 1: 챌린지안하는유저 (기간은 신청기간 중) - // 2: 챌린지 안하는 유저 (기간은 신청기간이 아님) - // 3: 챌린지 하는 유저 (기간은 챌린지 중) - // 4: 관리자 - - return ( - <> - - -
    - - -
    - -

    {nickname}

    -

    {dayjs(createdAt).format('MM.DD')}

    -
    - {userStateNum === 0 || userStateNum === 1 || userStateNum === 2 || isMine === false ? ( - scrapRender === false ? ( - - - { - submitScarp(); - userStateNum === 0 ? setIsConfirmLoginModal(true) : setIsConfirmLoginModal(false); - }} - /> - - - ) : ( - - - { - cancelScrap(); - userStateNum === 0 ? setIsConfirmLoginModal(true) : setIsConfirmLoginModal(false); - }} - /> - - - ) - ) : isMenuBar === false ? ( - - { - setIsDeleteModalOpen(true); - }} - > - - - { - history.push(`/challenge/edit/${id}`); - }} - > - - - - ) : ( - - - { - setIsMenuBar(false); - }} - /> - - - )} -
    - {interest && - interest.map((item, id) => { - return #{item}; - })} -
    -
    - -

    잘한점

    - {isClosed === true ?
    {good}
    :

    {good}

    } -
    - -

    못한점

    - {isClosed === true ?
    {bad}
    :

    {bad}

    } -
    - -

    배운점

    - {isClosed === true ?
    {learn}
    :

    {learn}

    } -
    - {lookMoreButton === true ? ( - - { - setLookMoreButton(false); - setIsClosed(true); - }} - > - 더보기 - - - ) : ( - - { - setLookMoreButton(true); - setIsClosed(false); - }} - > - 접기 - - - )} - - {likeRender ? ( - { - cancelLike(); - { - userStateNum === 0 ? setIsConfirmLoginModal(true) : setIsConfirmLoginModal(false); - } - }} - alt="" - /> - ) : ( - { - submitLike(); - { - userStateNum === 0 ? setIsConfirmLoginModal(true) : setIsConfirmLoginModal(false); - } - }} - alt="" - /> - )} -

    {countLikes}

    - -

    {comments}

    -
    - {isOpenComment === false ? ( - { - setIsOpenComment(true); - getCommentList(); - }} - > - 댓글 펼치기 - - ) : ( -
    - {isFoldComment === false ? null : ( - - )} - { - setIsOpenComment(false); - }} - > - 댓글 접기 - -
    - )} -
    -
    -
    -
    - - - - - -

    앗!

    -

    로그인이 필요한 서비스입니다

    -
    - - { - setIsConfirmLoginModal(false); - }} - > - 취소 - - { - history.push('/login'); - }} - > - 로그인하기 - - -
    -
    - - ); -} - -export default ChallengeDetailCard; diff --git a/src/pages/ChallengeList/index.tsx b/src/pages/ChallengeList/index.tsx index 85b599ce..d1cce3a1 100644 --- a/src/pages/ChallengeList/index.tsx +++ b/src/pages/ChallengeList/index.tsx @@ -1,11 +1,11 @@ import { ChallengeListData } from 'apis'; -import ChallengeHeader from 'components/molecules/ChallengeHeader'; -import ChallengeCard from 'components/organisms/ChallengeCard'; +import { ChallengeHeader } from 'components/molecules'; import React, { useCallback, useState } from 'react'; import { RouteComponentProps } from 'react-router'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; import { IChallengeData } from 'types/challenge.type'; +import ChallengeMiddle from './template'; interface MatchParams { generationNum: string; @@ -38,7 +38,11 @@ function ChallengeView({ match }: RouteComponentProps): React.React isClickedEntire={isClickedEntire} setIsClickedEntire={setIsClickedEntire} /> - +
    ); } diff --git a/src/components/organisms/ChallengeCard/index.tsx b/src/pages/ChallengeList/template/index.tsx similarity index 96% rename from src/components/organisms/ChallengeCard/index.tsx rename to src/pages/ChallengeList/template/index.tsx index ec5c7177..146da861 100644 --- a/src/components/organisms/ChallengeCard/index.tsx +++ b/src/pages/ChallengeList/template/index.tsx @@ -1,5 +1,5 @@ import { ChallengeListData } from 'apis'; -import { ChallengeDetailCard } from 'components/molecules'; +import { ChallengeDetailCard } from 'components/organisms'; import React, { useCallback, useEffect, useState } from 'react'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; diff --git a/src/pages/ChallengeList/template/style.ts b/src/pages/ChallengeList/template/style.ts new file mode 100644 index 00000000..dce922ae --- /dev/null +++ b/src/pages/ChallengeList/template/style.ts @@ -0,0 +1,11 @@ +import Styled from 'styled-components'; +import { theme } from 'styled-tools'; + +export const ChallengeCardWrapper = Styled.div` +p{ + margin : 100px 0 100px 0; + width : 100%; + text-align :center; + ${theme('font.body3')}; +} +`; From b0807fb9cdba85a58c70cb3ab140a7b592b5a9d0 Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Mon, 9 Aug 2021 00:25:40 +0900 Subject: [PATCH 28/80] =?UTF-8?q?Style=20:=20=EB=9F=B0=EB=A7=88=EC=85=80?= =?UTF-8?q?=20organisms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organisms/ChallengeDetailCard/index.tsx | 112 ++++++++++++++++++ .../organisms/ChallengeDetailCard/style.ts | 17 +++ 2 files changed, 129 insertions(+) create mode 100644 src/components/organisms/ChallengeDetailCard/index.tsx create mode 100644 src/components/organisms/ChallengeDetailCard/style.ts diff --git a/src/components/organisms/ChallengeDetailCard/index.tsx b/src/components/organisms/ChallengeDetailCard/index.tsx new file mode 100644 index 00000000..74551039 --- /dev/null +++ b/src/components/organisms/ChallengeDetailCard/index.tsx @@ -0,0 +1,112 @@ +import { DeleteChallenge } from 'apis'; +import { + ChallengeCardBottom, + ChallengeCardFold, + ChallengeCardList, + ChallengeCardProfile, + DeleteModal, + LoginModal, +} from 'components/molecules'; +import React, { useEffect, useState } from 'react'; +import { useRecoilValue } from 'recoil'; +import { userState, userStatusState } from 'stores/user'; +import { Container, MainCardWrapper } from './style'; + +interface IProps { + nickname?: string; + image?: string; + createdAt?: string; + interest?: string[]; + good?: string; + bad?: string; + learn?: string; + like: number; + comments?: number; + isLike?: boolean; + isScrap?: boolean; + id: string; + onChange?: () => void; + handleFetch?: (offset: number) => void; +} + +function ChallengeDetailCard({ + nickname, + image, + createdAt, + interest, + good, + bad, + learn, + like, + isLike, + isScrap, + comments, + id, + onChange, + handleFetch, +}: IProps): React.ReactElement { + const userStatusData = useRecoilValue(userStatusState); + const userData = useRecoilValue(userState); + const [isClosed, setIsClosed] = useState(false); + const [userStateNickname, setUserStateNickname] = useState(userData ? userData.nickname : 0); + const [isMine, setIsMine] = useState(false); + const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); + const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); + + useEffect(() => { + setIsMine(nickname === userStateNickname); + document.body.style.overflow = isDeleteModalOpen === true ? 'hidden' : 'unset'; + }, [isDeleteModalOpen, nickname, userStateNickname]); + + const deleteClickHandler = async () => { + if (userStatusData) { + const token = userStatusData?.token; + const data = await DeleteChallenge(id, token); + data && setIsDeleteModalOpen(false); + onChange?.(); + handleFetch?.(0); + } else { + alert('네트워크가 좋지 않습니다'); + } + }; + + return ( + <> + + + + + { + + } + + + + + + + ); +} + +export default ChallengeDetailCard; diff --git a/src/components/organisms/ChallengeDetailCard/style.ts b/src/components/organisms/ChallengeDetailCard/style.ts new file mode 100644 index 00000000..2c4bf33c --- /dev/null +++ b/src/components/organisms/ChallengeDetailCard/style.ts @@ -0,0 +1,17 @@ +import Styled from 'styled-components'; +import { palette } from 'styled-tools'; + +export const MainCardWrapper = Styled.div` + position: relative; + align-items: center; + margin: 0 auto; + border-radius: 18px; + box-shadow: 0px 0px 24px rgba(13, 12, 63, 0.1); + background: ${palette('grayscale', 0)}; + padding-top: 40px; + width : 844px; +`; + +export const Container = Styled.div` + padding-top: 60px; +`; From 525e835334f820fa236e4f59a1ddb11fc6d4d2c3 Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Mon, 9 Aug 2021 00:26:03 +0900 Subject: [PATCH 29/80] =?UTF-8?q?Style=20:=20=EC=B1=8C=EB=A6=B0=EC=A7=80?= =?UTF-8?q?=20=EC=8B=A0=EC=B2=AD=ED=95=98=EA=B8=B0=20=EB=AA=A8=EB=8B=AC=20?= =?UTF-8?q?=EB=AA=A8=EB=93=88=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RegisterCompletedModal/index.tsx | 27 +++++ .../molecules/RegisterCompletedModal/style.ts | 38 +++++++ .../molecules/RegisterConfirmModal/index.tsx | 58 ++++++++++ .../molecules/RegisterConfirmModal/style.ts | 100 ++++++++++++++++++ 4 files changed, 223 insertions(+) create mode 100644 src/components/molecules/RegisterCompletedModal/index.tsx create mode 100644 src/components/molecules/RegisterCompletedModal/style.ts create mode 100644 src/components/molecules/RegisterConfirmModal/index.tsx create mode 100644 src/components/molecules/RegisterConfirmModal/style.ts diff --git a/src/components/molecules/RegisterCompletedModal/index.tsx b/src/components/molecules/RegisterCompletedModal/index.tsx new file mode 100644 index 00000000..254e917c --- /dev/null +++ b/src/components/molecules/RegisterCompletedModal/index.tsx @@ -0,0 +1,27 @@ +import { CheckCircleIcon } from 'assets/images'; +import { Modal } from 'components/atoms'; +import React from 'react'; +import { useRecoilState } from 'recoil'; +import { userState } from 'stores/user'; +import { RegisterSubmitWrapper } from './style'; + +interface IProps { + isRegisterSubmit: boolean; + setIsRegisterSubmit: (value: boolean) => void; +} + +function RegisterCompletedModal({ isRegisterSubmit, setIsRegisterSubmit }: IProps): React.ReactElement { + const [userData, setUserData] = useRecoilState(userState); + return ( + + + +
    신청완료!
    +

    {userData?.nickname}님 챌린지가 정상적으로

    +

    신청되었습니다.

    +
    +
    + ); +} + +export default RegisterCompletedModal; diff --git a/src/components/molecules/RegisterCompletedModal/style.ts b/src/components/molecules/RegisterCompletedModal/style.ts new file mode 100644 index 00000000..790310f0 --- /dev/null +++ b/src/components/molecules/RegisterCompletedModal/style.ts @@ -0,0 +1,38 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const RegisterSubmitWrapper = Styled.div` + position: fixed; + top:0; + right:0; + bottom:0; + left:0; + margin:auto; + border-width: 1px; + border-style: solid; + border-radius: 16px; + border-color:${palette('primary', 3)}; + background-color: ${palette('grayscale', 0)}; + width: 500px; + height: 273px; + + img{ + display:flex; + margin:auto; + margin-top:-40px; + } + h5{ + background: linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + -webkit-background-clip: text; + background-clip: text; + padding-top:20px; + padding-bottom:40px; + text-align: center; + -webkit-text-fill-color: transparent; + ${theme('font.dp4')}; + } + p{ + text-align: center; + ${theme('font.body3')}; + } +`; diff --git a/src/components/molecules/RegisterConfirmModal/index.tsx b/src/components/molecules/RegisterConfirmModal/index.tsx new file mode 100644 index 00000000..d45ef39a --- /dev/null +++ b/src/components/molecules/RegisterConfirmModal/index.tsx @@ -0,0 +1,58 @@ +import { CautionIcon, CheckIcon } from 'assets/images'; +import { Modal } from 'components/atoms'; +import React from 'react'; +import { useRecoilState } from 'recoil'; +import { userState } from 'stores/user'; +import { IAdminChallengePeriod } from 'types/admin.type'; +import { CautionWrapper, ConfirmDetail, ConfirmModalWrapper, DetailContent, ModalButton } from './style'; + +interface IProps { + isOpenModal: boolean; + setIsOpenModal: (value: boolean) => void; + dateToString: (date: string) => void; + periodData: IAdminChallengePeriod; + registerCount: number; + handleSubmit: () => void; +} + +function RegisterConfirmModal({ + isOpenModal, + setIsOpenModal, + dateToString, + periodData, + registerCount, + handleSubmit, +}: IProps): React.ReactElement { + const [userData, setUserData] = useRecoilState(userState); + return ( + + + +

    잠깐! 확인하고 신청 완료하세요

    +

    아래 정보를 확인해주세요

    + +

    챌린지 기간

    +

    + {dateToString(periodData.challengeStartDT)}~{dateToString(periodData.challengeEndDT)} +

    +

    신청자

    +

    {userData?.nickname}님

    +

    챌린지 개수

    +

    {registerCount}개

    +
    + + +

    주의사항

    +
    +
    챌린지 개수 2개를 선택하시면 최종 달성률 80%를 넘더라도 배지를 받을 수 없어요!
    +
    + + +

    주의 사항을 확인했으며 챌린지 신청을 완료합니다.

    +
    +
    +
    + ); +} + +export default RegisterConfirmModal; diff --git a/src/components/molecules/RegisterConfirmModal/style.ts b/src/components/molecules/RegisterConfirmModal/style.ts new file mode 100644 index 00000000..e6766d08 --- /dev/null +++ b/src/components/molecules/RegisterConfirmModal/style.ts @@ -0,0 +1,100 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const ConfirmModalWrapper = Styled.div` + position: fixed; + top:0; + right:0; + bottom:0; + left:0; + margin:auto; + border-radius: 16px; + background-color: ${palette('grayscale', 0)}; + width: 500px; + height: 613px; +`; + +export const ConfirmDetail = Styled.div` + padding: 80px 80px 80px; + + h1{ + ${theme('font.h1')}; + color: ${palette('grayscale', 7)}; + } + h2{ + padding-top:10px; + padding-bottom:30px; + color: ${palette('grayscale', 4)}; + ${theme('font.body3')}; + } + img{ + margin-right: 8px; + } + h4{ + text-align: center; + color: ${palette('grayscale', 7)}; + ${theme('font.body2')}; + } + h5{ + padding-top:12px; + text-align: center; + color: ${palette('primary', 6)}; + ${theme('font.body2')}; + } +`; + +export const DetailContent = Styled.div` + border-radius: 30px; + padding: 20px 40px 40px 40px; + height:192px; + text-align:left; + background-color: #f9f9f9; + + h3{ + display:inline-block; + padding-top:20px; + width: calc(100% - 150px); + text-align:left; + color: ${palette('grayscale', 7)}; + ${theme('font.body2')}; + } + p{ + display:inline-block; + text-align:left; + color: ${palette('grayscale', 7)}; + ${theme('font.subhead3')}; + } + `; + +export const CautionWrapper = Styled.div` + display: flex; + align-items: center; + justify-content: center; + margin-top: 50px; +`; + +export const ModalButton = Styled.button` + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + border:none; + border-radius: 0px 0px 16px 16px; + background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); + width:500px; + height:64px; + + img{ + display:inline-block; + margin-right: 10px; + } + p{ + display:inline-block; + border:none; + border-radius: 0px 0px 16px 16px; + background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); + color: ${palette('grayscale', 0)}; + ${theme('font.subhead3')}; + } + +`; From db708dcf3031bae85a52e999b9689a448ea66824 Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Mon, 9 Aug 2021 00:27:26 +0900 Subject: [PATCH 30/80] =?UTF-8?q?Style=20:=20=EB=9F=B0=EB=A7=88=EC=85=80?= =?UTF-8?q?=20=ED=8E=B8=EC=A7=91=20template,=20organisms,=20molecules=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC=20=EB=B0=8F=20=EB=AA=A8=EB=93=88=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../molecules/ChallengeEditCard/index.tsx | 215 ++---------------- .../molecules/ChallengeEditCard/style.ts | 36 +-- .../organisms/ChallengeEditCard/index.tsx | 212 +++++++++++++++++ .../organisms/ChallengeEditCard/style.ts | 108 +++++++++ src/pages/ChallengeEdit/index.tsx | 4 +- 5 files changed, 343 insertions(+), 232 deletions(-) create mode 100644 src/components/organisms/ChallengeEditCard/index.tsx create mode 100644 src/components/organisms/ChallengeEditCard/style.ts diff --git a/src/components/molecules/ChallengeEditCard/index.tsx b/src/components/molecules/ChallengeEditCard/index.tsx index 5c5863af..eb906eac 100644 --- a/src/components/molecules/ChallengeEditCard/index.tsx +++ b/src/components/molecules/ChallengeEditCard/index.tsx @@ -1,33 +1,10 @@ import { ChallengeEdit, getChallengeContent } from 'apis'; -import { - CharacterBlackIcon, - CharacterColor1Icon, - CharacterColor2Icon, - CharacterColor3Icon, - MoreClickedIcon, -} from 'assets/images'; -import { Button, Modal } from 'components/atoms'; +import { ChallengeProgressBar, ChallengeWriteInterest } from 'components/molecules'; import React, { useEffect, useState } from 'react'; import { useHistory } from 'react-router-dom'; import { useRecoilValue } from 'recoil'; -import { interestList } from 'resources/string'; import { userStatusState } from 'stores/user'; -import { - BlackButton, - ButtonWrapper, - CharacterStepImg, - CharacterWrapper, - ColorButton, - Header, - InterestTagButton, - ProgressBarStep0, - ProgressBarStep1, - ProgressBarStep2, - ProgressBarStep3, - QuestionWrapper, - TagListWrapper, - TagWrapper, -} from './style'; +import { BlackButton, ButtonWrapper, ColorButton, Header, QuestionWrapper } from './style'; export interface IProps { description?: string; @@ -35,46 +12,6 @@ export interface IProps { value?: string; } -type selectedStyle = { - backgroundColor: string; - color: string; -}; - -type selectedStyleLists = { - [key: string]: selectedStyle; -}; - -const selectedInterestStyle: selectedStyleLists = { - '건강 및 피트니스': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '게임': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '교육': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '그래픽 및 디자인': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '금융': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - 'K-pop': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '뉴스, 신문': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '데이트': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '날씨': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '네비게이션': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '출판,도서': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '뷰티': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '라이프 스타일': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '만화': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '부동산 / 홈 인테리어': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '사진 및 비디오': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '쇼핑': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '비즈니스': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '생산성': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '소셜 네트워킹': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '스포츠': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '어린이': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - 'AR앱': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '여행': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '유틸리티': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '음식 및 음료': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '음악': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '의료': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '기타': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, -}; interface IEditCard { id: string; } @@ -83,7 +20,6 @@ function EditCard({ id }: IEditCard): React.ReactElement { const userStatusData = useRecoilValue(userStatusState); const history = useHistory(); const maxByte = 1000; //최대 1000바이트 - const [isBadgeModal, setIsBadgeModal] = useState(false); //뱃지 모달 const [countProgressBar, setCountProgressBar] = useState(0); //프로그래스바 const [byte, setByte] = useState({ @@ -184,102 +120,25 @@ function EditCard({ id }: IEditCard): React.ReactElement { } }; - const [isOpenTag, setIsOpenTag] = useState(false); - const [isClickTag, setIsClickTag] = useState(false); - const [selectedInterest, setSelectedInterest] = useState([]); - const modalInterestHandler = (interest: string) => { - if (selectedInterest.length === 0) { - setSelectedInterest([interest]); - } - if (selectedInterest.length < 3) { - if (!selectedInterest.includes(interest)) { - setSelectedInterest([...selectedInterest, interest]); - } else { - setSelectedInterest(selectedInterest.filter((v) => v !== interest)); - } - } else { - if (selectedInterest.includes(interest)) { - setSelectedInterest(selectedInterest.filter((v) => v !== interest)); - } - } - }; - const setInterestButton = (id: any, interest: string) => { - return ( - { - modalInterestHandler(interest); - setIsClickTag(!isClickTag); - }} - style={ - selectedInterestStyle[interest] && selectedInterest.indexOf(interest) > -1 - ? selectedInterestStyle[interest] - : {} - } - > - {interest} - - ); + const indextoName = (index: undefined | number) => { + switch (index) { + case 1: + return '1st'; + case 2: + return `2nd`; + case 3: + return `3rd`; + default: + return `${index}th`; + } }; return ( <> -
    Learn Myself
    - {countProgressBar === 0 ? ( - -
    - -

    당신의 오늘을 알고싶어요!

    -
    -
    - - . - -
    -
    - ) : null} - - {countProgressBar === 1 ? ( - -

    - -

    오호라! 오늘 이런 일이 있었군요!

    -

    -
    - - . - -
    -
    - ) : null} - {countProgressBar === 2 ? ( - -

    - -

    우와! 내일의 당신은 더 행복할거에요 :)

    -

    -
    - - . - -
    -
    - ) : null} - {countProgressBar === 3 ? ( - -

    - -

    더 성장한 내일의 나를 위해!

    -

    -
    - - . - -
    -
    - ) : null} +
    Learn Myself {indextoName(userStatusData?.progressGeneration)}
    +

    오늘의 잘한 점을 적어보세요.

    @@ -319,55 +178,17 @@ function EditCard({ id }: IEditCard): React.ReactElement { >
    - - 해시태그 -
    - {interestList.map((interest, id) => { - if (id < 6) { - return setInterestButton(id, interest); - } - })} - - - - {isOpenTag === true ? ( - - ) : null} - -
    -
    + {countProgressBar === 3 ? ( - 글 올리기 + 수정완료 ) : ( - 글 올리기 + 수정완료 )} - - -
    -

    뱃지 획득

    -

    축하합니다! 뱃지 하나가 추가되었습니다

    -

    마이페이지를 확인해주세요 :)

    -
    -
    ); } diff --git a/src/components/molecules/ChallengeEditCard/style.ts b/src/components/molecules/ChallengeEditCard/style.ts index 649ff80b..beae4b8a 100644 --- a/src/components/molecules/ChallengeEditCard/style.ts +++ b/src/components/molecules/ChallengeEditCard/style.ts @@ -18,35 +18,6 @@ export const InterestTagButton = Styled(Button)` ${theme('font.subhead3')}; `; -export const CharacterWrapper = Styled.div` - position:sticky; - top:20px; - margin: 0 auto; - background-color: ${palette('grayscale', 0)}; - padding-top:60px; - width:844px; - - img{ - padding-top:29px; - } - p{ - padding-top:12.32px; - padding-bottom: 12px; - ${theme('font.subhead2')}; - color : ${palette('grayscale', 5)}; - } - h1{ - padding-top:29px; - padding-left:200px; - } - h2{ - padding-left:450px; - } - h3{ - text-align:end; - } -`; - export const QuestionWrapper = Styled.div` margin: 0 auto; padding-top:60px; @@ -101,6 +72,7 @@ export const TagListWrapper = Styled.div` background: ${palette('grayscale', 0)}; padding: 13px 30px 30px 30px; } +<<<<<<< Updated upstream `; @@ -159,6 +131,8 @@ export const ProgressBarStep3 = Styled.span` width: 100%; height: 5px; } +======= +>>>>>>> Stashed changes `; export const ButtonWrapper = Styled.div` @@ -192,7 +166,3 @@ export const BlackButton = Styled(Button)` background: ${palette('grayscale', 1)}; ${theme('font.subhead3')}; `; - -export const CharacterStepImg = Styled.img` - padding-left:55px; -`; diff --git a/src/components/organisms/ChallengeEditCard/index.tsx b/src/components/organisms/ChallengeEditCard/index.tsx new file mode 100644 index 00000000..af434966 --- /dev/null +++ b/src/components/organisms/ChallengeEditCard/index.tsx @@ -0,0 +1,212 @@ +import { ChallengeEdit, getChallengeContent } from 'apis'; +import { ChallengeProgressBar, ChallengeWriteInterest } from 'components/molecules'; +import React, { useEffect, useState } from 'react'; +import { useHistory } from 'react-router-dom'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import { BlackButton, ButtonWrapper, ColorButton, Header, QuestionWrapper } from './style'; + +export interface IProps { + description?: string; + className?: string; + value?: string; +} + +interface IEditCard { + id: string; +} + +function EditCard({ id }: IEditCard): React.ReactElement { + const userStatusData = useRecoilValue(userStatusState); + const history = useHistory(); + const maxByte = 1000; //최대 1000바이트 + const [countProgressBar, setCountProgressBar] = useState(0); //프로그래스바 + + const [byte, setByte] = useState({ + byte1: 0, + byte2: 0, + byte3: 0, + }); + + const [textForm, setTextForm] = useState({ + description1: '', + description2: '', + description3: '', + }); + + const { description1, description2, description3 } = textForm; + const textOnChange = (target: any) => { + const { name, value } = target; + setTextForm({ + ...textForm, + [name]: value, + }); + }; + + const handleSubmit = async (e: any) => { + e.preventDefault(); + setTextForm({ + description1: '', + description2: '', + description3: '', + }); + const editData = { + good: description1, + bad: description2, + learn: description3, + interest: selectedInterest, + }; + if (userStatusData) { + const data = await ChallengeEdit(editData, userStatusData.token, id); + data && history.goBack(); + } + }; + + const progressBarState = () => { + let count = 0; + if (byte.byte1 > 0) { + count++; + } + if (byte.byte2 > 0) { + count++; + } + if (byte.byte3 > 0) { + count++; + } + setCountProgressBar(count); + }; + + const handleTotalOnChange = (e: any) => { + const text_val = e.target.value; //입력한 문자 + const target_byte_name = 'byte' + e.target.name.split('description')[1]; + let str = ''; + let totalByte = stringtoByte(text_val); + + if (totalByte >= maxByte) { + str = text_val.substring(0, maxByte); + e.target.value = str; + totalByte = maxByte; + } + textOnChange(e.target); + setByte({ + ...byte, + [target_byte_name]: totalByte, + }); + }; + const stringtoByte = (value: string) => { + return value.length; + }; + + useEffect(() => { + progressBarState(); + }, [byte]); + useEffect(() => { + getDefaultData(); + }, []); + + const getDefaultData = async () => { + if (userStatusData) { + const data = await getChallengeContent(id, userStatusData.token); + if (data) { + setTextForm({ description1: data.good, description2: data.bad, description3: data.learn }); + setSelectedInterest(data.interest); + setByte({ + byte1: stringtoByte(data.good), + byte2: stringtoByte(data.bad), + byte3: stringtoByte(data.learn), + }); + } + } else { + } + }; + + const [selectedInterest, setSelectedInterest] = useState([]); + const modalInterestHandler = (interest: string) => { + if (selectedInterest.length === 0) { + setSelectedInterest([interest]); + } + if (selectedInterest.length < 3) { + if (!selectedInterest.includes(interest)) { + setSelectedInterest([...selectedInterest, interest]); + } else { + setSelectedInterest(selectedInterest.filter((v) => v !== interest)); + } + } else { + if (selectedInterest.includes(interest)) { + setSelectedInterest(selectedInterest.filter((v) => v !== interest)); + } + } + }; + + const indextoName = (index: undefined | number) => { + switch (index) { + case 1: + return '1st'; + case 2: + return `2nd`; + case 3: + return `3rd`; + default: + return `${index}th`; + } + }; + + return ( + <> +
    Learn Myself {indextoName(userStatusData?.progressGeneration)}
    + + + +

    오늘의 잘한 점을 적어보세요.

    +

    + {byte.byte1}/{maxByte} +

    + +
    + + +

    오늘의 못한 점을 적어보세요.

    +

    + {byte.byte2}/{maxByte} +

    + +
    + +

    잘한 점/못한 점을 통해 배운 것과 다음에 실천할 것을 적어보세요.

    +

    + {byte.byte3}/{maxByte} +

    + +
    + + + + {countProgressBar === 3 ? ( + + 수정완료 + + ) : ( + + 수정완료 + + )} + + ); +} + +export default EditCard; diff --git a/src/components/organisms/ChallengeEditCard/style.ts b/src/components/organisms/ChallengeEditCard/style.ts new file mode 100644 index 00000000..23c1a8fd --- /dev/null +++ b/src/components/organisms/ChallengeEditCard/style.ts @@ -0,0 +1,108 @@ +import { Button } from 'components/atoms'; +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const Header = Styled.div` + padding-top:100px; + text-align:center; + ${theme('font.dp3_eng')}; +`; +export const InterestTagButton = Styled(Button)` + margin : 12px 5px; + border: solid 1px ${palette('grayscale', 4)}; + border-radius: 60px; + background-color: ${palette('grayscale', 0)}; + padding : 12px 30px; + height : 48px; + color : ${palette('grayscale', 4)}; + ${theme('font.subhead3')}; +`; + +export const QuestionWrapper = Styled.div` + margin: 0 auto; + padding-top:60px; + width:844px; + + h1 { + line-height:38px; + color: ${palette('grayscale', 7)}; + ${theme('font.subhead5')}; + } + + p { + padding-bottom: 30px; + text-align: right; + color: #B1B1B1; + ${theme('font.subhead2_eng')}; + } + + textarea{ + box-sizing: border-box; + align-items: center; + border: 1px solid ${palette('grayscale', 1)}; + padding: 40px 60px 40px 60px; + width: 844px; + height:369px; + resize:none; + ${theme('font.body4')}; + } +`; + +export const TagWrapper = Styled.div` + align-items:center; + margin:0 auto; + padding-top:60px; + width:844px; + text-align: left; + ${theme('font.subhead5')}; + + img{ + padding-bottom:5px; + vertical-align : middle; + } +`; + +export const TagListWrapper = Styled.div` + padding-top:20px; + + button{ + box-sizing: border-box; + border: 1px solid rgba(223, 223, 223, 0.5); + box-shadow: 0px 0px 15px rgba(23, 22, 91, 0.08); + background: ${palette('grayscale', 0)}; + padding: 13px 30px 30px 30px; + } +`; + +export const ButtonWrapper = Styled.div` + align-items: center; + margin: 0 auto; + width:844px; +`; + +export const ColorButton = Styled(Button)` + + margin: 0 auto; + margin-top:60px; + border:none; + border-radius: 4px; + width:844px; + height: 60px; + text-align: center; + color: ${palette('grayscale', 0)}; + background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); + ${theme('font.subhead3')}; +`; + +export const BlackButton = Styled(Button)` + margin: 0 auto; + margin-top:60px; + border:none; + border-radius: 4px; + width:844px; + height: 60px; + text-align: center; + color: ${palette('grayscale', 0)}; + background: ${palette('grayscale', 1)}; + ${theme('font.subhead3')}; +`; diff --git a/src/pages/ChallengeEdit/index.tsx b/src/pages/ChallengeEdit/index.tsx index cb22cb8e..45911421 100644 --- a/src/pages/ChallengeEdit/index.tsx +++ b/src/pages/ChallengeEdit/index.tsx @@ -1,4 +1,4 @@ -import ChallengeEdit from 'components/molecules/ChallengeEditCard/index'; +import { ChallengeEditCard } from 'components/organisms'; import React from 'react'; import { RouteComponentProps } from 'react-router'; @@ -7,7 +7,7 @@ interface MatchParams { } function ChallengeWrite({ match }: RouteComponentProps): React.ReactElement { const { id } = match.params; - return ; + return ; } export default ChallengeWrite; From 1b8959d0a4cba9f7f1c2d762109549cba96ac26c Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Mon, 9 Aug 2021 00:28:18 +0900 Subject: [PATCH 31/80] =?UTF-8?q?Style=20:=20=EB=9F=B0=EB=A7=88=EC=85=80?= =?UTF-8?q?=20=EC=93=B0=EA=B8=B0=20template,=20organisms,=20molecules=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC=20=EB=B0=8F=20=EB=AA=A8=EB=93=88=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../molecules/ChallengeWriteButton/index.tsx | 25 ++ .../molecules/ChallengeWriteButton/style.ts | 36 ++ .../molecules/ChallengeWriteCard/index.tsx | 374 ------------------ .../molecules/ChallengeWriteCard/style.ts | 196 --------- .../molecules/ChallengeWriteForm/index.tsx | 57 +++ .../molecules/ChallengeWriteForm/style.ts | 32 ++ .../organisms/ChallengeWriteCard/index.tsx | 137 +++++++ .../organisms/ChallengeWriteCard/style.ts | 8 + src/pages/ChallengeWrite/index.tsx | 4 +- 9 files changed, 297 insertions(+), 572 deletions(-) create mode 100644 src/components/molecules/ChallengeWriteButton/index.tsx create mode 100644 src/components/molecules/ChallengeWriteButton/style.ts delete mode 100644 src/components/molecules/ChallengeWriteCard/index.tsx delete mode 100644 src/components/molecules/ChallengeWriteCard/style.ts create mode 100644 src/components/molecules/ChallengeWriteForm/index.tsx create mode 100644 src/components/molecules/ChallengeWriteForm/style.ts create mode 100644 src/components/organisms/ChallengeWriteCard/index.tsx create mode 100644 src/components/organisms/ChallengeWriteCard/style.ts diff --git a/src/components/molecules/ChallengeWriteButton/index.tsx b/src/components/molecules/ChallengeWriteButton/index.tsx new file mode 100644 index 00000000..265d9b72 --- /dev/null +++ b/src/components/molecules/ChallengeWriteButton/index.tsx @@ -0,0 +1,25 @@ +import React from 'react'; +import { BlackButton, ButtonWrapper, ColorButton } from './style'; + +interface IProps { + countProgressBar: number; + handleSubmit: (e: any) => void; +} + +function ChallengeWriteButton({ countProgressBar, handleSubmit }: IProps): React.ReactElement { + return ( + <> + {countProgressBar === 3 ? ( + + 글 올리기 + + ) : ( + + 글 올리기 + + )} + + ); +} + +export default ChallengeWriteButton; diff --git a/src/components/molecules/ChallengeWriteButton/style.ts b/src/components/molecules/ChallengeWriteButton/style.ts new file mode 100644 index 00000000..6ada1ab8 --- /dev/null +++ b/src/components/molecules/ChallengeWriteButton/style.ts @@ -0,0 +1,36 @@ +import { Button } from 'components/atoms'; +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const ButtonWrapper = Styled.div` + align-items: center; + margin: 0 auto; + width:844px; +`; + +export const ColorButton = Styled(Button)` + + margin: 0 auto; + margin-top:60px; + border:none; + border-radius: 4px; + width:844px; + height: 60px; + text-align: center; + color: ${palette('grayscale', 0)}; + background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); + ${theme('font.subhead3')}; +`; + +export const BlackButton = Styled(Button)` + margin: 0 auto; + margin-top:60px; + border:none; + border-radius: 4px; + width:844px; + height: 60px; + text-align: center; + color: ${palette('grayscale', 0)}; + background: ${palette('grayscale', 1)}; + ${theme('font.subhead3')}; +`; diff --git a/src/components/molecules/ChallengeWriteCard/index.tsx b/src/components/molecules/ChallengeWriteCard/index.tsx deleted file mode 100644 index bdbca91b..00000000 --- a/src/components/molecules/ChallengeWriteCard/index.tsx +++ /dev/null @@ -1,374 +0,0 @@ -import { writeForm } from 'apis'; -import { - CharacterBlackIcon, - CharacterColor1Icon, - CharacterColor2Icon, - CharacterColor3Icon, - MoreClickedIcon, -} from 'assets/images'; -import React, { useCallback, useEffect, useState } from 'react'; -import { useHistory } from 'react-router-dom'; -import { useRecoilValue } from 'recoil'; -import { userStatusState } from 'stores/user'; -import { interestList } from '../../../resources/string'; -import { Button, Modal } from '../../atoms'; -import { - BlackButton, - ButtonWrapper, - CharacterStepImg, - CharacterWrapper, - ColorButton, - Header, - InterestTagButton, - ProgressBarStep0, - ProgressBarStep1, - ProgressBarStep2, - ProgressBarStep3, - QuestionWrapper, - TagListWrapper, - TagWrapper, -} from './style'; - -type selectedStyle = { - backgroundColor: string; - color: string; -}; - -type selectedStyleLists = { - [key: string]: selectedStyle; -}; - -const selectedInterestStyle: selectedStyleLists = { - '건강 및 피트니스': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '게임': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '교육': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '그래픽 및 디자인': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '금융': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - 'K-pop': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '뉴스, 신문': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '데이트': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '날씨': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '네비게이션': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '출판,도서': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '뷰티': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '라이프 스타일': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '만화': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '부동산 / 홈 인테리어': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '사진 및 비디오': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '쇼핑': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '비즈니스': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '생산성': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '소셜 네트워킹': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '스포츠': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '어린이': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - 'AR앱': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '여행': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '유틸리티': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '음식 및 음료': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '음악': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '의료': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, - '기타': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, -}; - -type MyFormProps = { - onChangeForm: (form: { description1: string; description2: string; description3: string }) => void; -}; - -function WriteCard({ onChangeForm }: MyFormProps): React.ReactElement { - const history = useHistory(); - const userStatusData = useRecoilValue(userStatusState); - const [isBadgeModal, setIsBadgeModal] = useState(false); //뱃지 모달 - const [countProgressBar, setCountProgressBar] = useState(0); //프로그래스바 - const maxByte = 1000; //최대 1000바이트 - - const [byte, setByte] = useState({ - byte1: 0, - byte2: 0, - byte3: 0, - }); - - const [textForm, setTextForm] = useState({ - description1: '', - description2: '', - description3: '', - }); - - const { description1, description2, description3 } = textForm; - - const textOnChange = (target: any) => { - const { name, value } = target; - setTextForm({ - ...textForm, - [name]: value, - }); - }; - - const handleSubmit = async (e: any) => { - setUserData({ ...userData, interest: selectedInterest }); - e.preventDefault(); - onChangeForm(textForm); - setTextForm({ - description1: '', - description2: '', - description3: '', - }); - const writeData = { - good: description1, - bad: description2, - learn: description3, - interest: selectedInterest, - }; - if (userStatusData) { - await writeForm(writeData, userStatusData.token); - history.goBack(); - } - }; - - const progressBarState = useCallback(() => { - let count = 0; - if (byte.byte1 > 0) { - count++; - } - if (byte.byte2 > 0) { - count++; - } - if (byte.byte3 > 0) { - count++; - } - setCountProgressBar(count); - }, [byte.byte1, byte.byte2, byte.byte3]); - - const totalOnChange = (e: any) => { - const text_val = e.target.value; //입력한 문자 - const target_byte_name = 'byte' + e.target.name.split('description')[1]; - let str = ''; - let totalByte = 0; - for (let i = 0; i < text_val.length; i++) { - totalByte += 1; - } - - if (totalByte >= maxByte) { - str = text_val.substring(0, maxByte); - e.target.value = str; - totalByte = maxByte; - } - - textOnChange(e.target); - setByte({ - ...byte, - [target_byte_name]: totalByte, - }); - }; - - useEffect(() => { - progressBarState(); - }, [byte, progressBarState]); - - const [isOpenTag, setIsOpenTag] = useState(false); - const [isClickTag, setIsClickTag] = useState(false); - - const [userData, setUserData] = useState({ - interest: [''], - }); - const [selectedInterest, setSelectedInterest] = useState([]); - const modalInterestHandler = (interest: string) => { - if (selectedInterest.length === 0) { - setSelectedInterest([interest]); - } - if (selectedInterest.length < 3) { - if (!selectedInterest.includes(interest)) { - setSelectedInterest([...selectedInterest, interest]); - } else { - setSelectedInterest(selectedInterest.filter((v) => v !== interest)); - } - } else { - if (selectedInterest.includes(interest)) { - setSelectedInterest(selectedInterest.filter((v) => v !== interest)); - } - } - }; - - const setInterestButton = (id: any, interest: string) => { - return ( - { - modalInterestHandler(interest); - setIsClickTag(!isClickTag); - }} - style={ - selectedInterestStyle[interest] && selectedInterest.indexOf(interest) > -1 - ? selectedInterestStyle[interest] - : {} - } - > - {interest} - - ); - }; - - useEffect(() => { - setSelectedInterest(selectedInterest); - }, [selectedInterest]); - - const indextoName = (index: undefined | number) => { - switch (index) { - case 1: - return '1st'; - case 2: - return `2nd`; - case 3: - return `3rd`; - default: - return `${index}th`; - } - }; - - return ( - <> -
    Learn Myself {indextoName(userStatusData?.progressGeneration)}
    - {countProgressBar === 0 ? ( - -
    - -

    당신의 오늘을 알고싶어요!

    -
    -
    - - . - -
    -
    - ) : null} - - {countProgressBar === 1 ? ( - -

    - -

    오호라! 오늘 이런 일이 있었군요!

    -

    -
    - - . - -
    -
    - ) : null} - {countProgressBar === 2 ? ( - -

    - -

    우와! 내일의 당신은 더 행복할거에요 :)

    -

    -
    - - . - -
    -
    - ) : null} - {countProgressBar === 3 ? ( - -

    - -

    더 성장한 내일의 나를 위해!

    -

    -
    - - . - -
    -
    - ) : null} - - -

    오늘의 잘한 점을 적어보세요.

    -

    - {byte.byte1}/{maxByte} -

    - -
    - -

    오늘의 못한 점을 적어보세요.

    -

    - {byte.byte2}/{maxByte} -

    - -
    - -

    잘한 점/못한 점을 통해 배운 것과 다음에 실천할 것을 적어보세요.

    -

    - {byte.byte3}/{maxByte} -

    - -
    - - - 해시태그 -
    - {interestList.map((interest, id) => { - if (id < 6) { - return setInterestButton(id, interest); - } - })} - - - - {isOpenTag === true ? ( - - ) : null} - -
    -
    - - {countProgressBar === 3 ? ( - - 글 올리기 - - ) : ( - - 글 올리기 - - )} - - -
    -

    뱃지 획득

    -

    축하합니다! 뱃지 하나가 추가되었습니다

    -

    마이페이지를 확인해주세요 :)

    -
    -
    - - ); -} - -export default WriteCard; diff --git a/src/components/molecules/ChallengeWriteCard/style.ts b/src/components/molecules/ChallengeWriteCard/style.ts deleted file mode 100644 index 4eb0f48f..00000000 --- a/src/components/molecules/ChallengeWriteCard/style.ts +++ /dev/null @@ -1,196 +0,0 @@ -import { Button } from 'components/atoms'; -import Styled from 'styled-components'; -import { palette, theme } from 'styled-tools'; - -export const Header = Styled.div` - padding-top:100px; - text-align:center; - ${theme('font.dp3_eng')}; -`; -export const InterestTagButton = Styled(Button)` - margin : 12px 5px; - border: solid 1px ${palette('grayscale', 4)}; - border-radius: 60px; - background-color: ${palette('grayscale', 0)}; - padding : 12px 30px; - height : 48px; - color : ${palette('grayscale', 4)}; - ${theme('font.subhead3')}; -`; - -export const CharacterWrapper = Styled.div` - position:sticky; - top:20px; - margin: 0 auto; - background-color: ${palette('grayscale', 0)}; - padding-top:60px; - width:844px; - - img{ - padding-top:29px; - } - p{ - padding-top:12.32px; - padding-bottom: 12px; - ${theme('font.subhead2')}; - color : ${palette('grayscale', 5)}; - } - h1{ - padding-top:29px; - padding-left:200px; - } - h2{ - padding-left:450px; - } - h3{ - text-align:end; - } -`; - -export const QuestionWrapper = Styled.div` - margin: 0 auto; - padding-top:60px; - width:844px; - - h1 { - line-height:38px; - color: ${palette('grayscale', 7)}; - ${theme('font.subhead5')}; - } - - p { - padding-bottom: 30px; - text-align: right; - color: #B1B1B1; - ${theme('font.subhead2_eng')}; - } - - textarea{ - box-sizing: border-box; - align-items: center; - border: 1px solid ${palette('grayscale', 1)}; - padding: 40px 60px 40px 60px; - width: 844px; - height:369px; - resize:none; - ${theme('font.body4')}; - } -`; - -export const TagWrapper = Styled.div` - align-items:center; - margin:0 auto; - padding-top:60px; - width:844px; - text-align: left; - ${theme('font.subhead5')}; - - img{ - padding-bottom:5px; - vertical-align : middle; - } -`; - -export const TagListWrapper = Styled.div` - padding-top:20px; - - button{ - box-sizing: border-box; - border: 1px solid rgba(223, 223, 223, 0.5); - box-shadow: 0px 0px 15px rgba(23, 22, 91, 0.08); - background: ${palette('grayscale', 0)}; - padding: 13px 30px 30px 30px; - } -`; - -export const ProgressBarStep0 = Styled.span` - display: inline-block; - background-color: #d6d3d3; - width: 844px; - height: 5px; - - span{ - display: inline-block; - background-color: ${palette('primary', 3)}; - width: 1%; - height: 5px; - } -`; - -export const ProgressBarStep1 = Styled.span` - display: inline-block; - background-color: #d6d3d3; - width: 844px; - height: 5px; - - span{ - display: inline-block; - background-color: ${palette('primary', 3)}; - width: 34%; - height: 5px; - } -`; - -export const ProgressBarStep2 = Styled.span` - display: inline-block; - background-color: #d6d3d3; - width: 844px; - height: 5px; - - span{ - display: inline-block; - background-color: ${palette('primary', 3)}; - width: 67%; - height: 5px; - } -`; - -export const ProgressBarStep3 = Styled.span` - display: inline-block; - background-color: #d6d3d3; - width: 844px; - height: 5px; - - span{ - display: inline-block; - background-color: ${palette('primary', 3)}; - width: 100%; - height: 5px; - } -`; - -export const ButtonWrapper = Styled.div` - align-items: center; - margin: 0 auto; - width:844px; -`; - -export const ColorButton = Styled(Button)` - margin: 0 auto; - margin-top:60px; - border:none; - border-radius: 4px; - width:844px; - height: 60px; - text-align: center; - color: ${palette('grayscale', 0)}; - background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); - ${theme('font.subhead3')}; -`; - -export const BlackButton = Styled(Button)` - margin: 0 auto; - margin-top:60px; - border:none; - border-radius: 4px; - width:844px; - height: 60px; - text-align: center; - color: ${palette('grayscale', 0)}; - background: ${palette('grayscale', 1)}; - ${theme('font.subhead3')}; -`; - -export const CharacterStepImg = Styled.img` - padding-left:55px; -`; diff --git a/src/components/molecules/ChallengeWriteForm/index.tsx b/src/components/molecules/ChallengeWriteForm/index.tsx new file mode 100644 index 00000000..6d7171d4 --- /dev/null +++ b/src/components/molecules/ChallengeWriteForm/index.tsx @@ -0,0 +1,57 @@ +import React from 'react'; +import { IByte, ITextForm } from 'types/challenge.type'; +import { QuestionWrapper } from './style'; + +interface IProps { + totalOnChange: (e: any) => void; + byte: IByte; + ITextForm: ITextForm; +} + +function ChallengeWriteForm({ totalOnChange, byte, ITextForm }: IProps): React.ReactElement { + const maxByte = 1000; //최대 1000바이트 + return ( + <> + +

    오늘의 잘한 점을 적어보세요.

    +

    + {byte.byte1}/{maxByte} +

    + +
    + + +

    오늘의 못한 점을 적어보세요.

    +

    + {byte.byte2}/{maxByte} +

    + +
    + + +

    잘한 점/못한 점을 통해 배운 것과 다음에 실천할 것을 적어보세요.

    +

    + {byte.byte3}/{maxByte} +

    + +
    + + ); +} + +export default ChallengeWriteForm; diff --git a/src/components/molecules/ChallengeWriteForm/style.ts b/src/components/molecules/ChallengeWriteForm/style.ts new file mode 100644 index 00000000..82a76467 --- /dev/null +++ b/src/components/molecules/ChallengeWriteForm/style.ts @@ -0,0 +1,32 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const QuestionWrapper = Styled.div` + margin: 0 auto; + padding-top:60px; + width:844px; + + h1 { + line-height:38px; + color: ${palette('grayscale', 7)}; + ${theme('font.subhead5')}; + } + + p { + padding-bottom: 30px; + text-align: right; + color: #B1B1B1; + ${theme('font.subhead2_eng')}; + } + + textarea{ + box-sizing: border-box; + align-items: center; + border: 1px solid ${palette('grayscale', 1)}; + padding: 40px 60px 40px 60px; + width: 844px; + height:369px; + resize:none; + ${theme('font.body4')}; + } +`; diff --git a/src/components/organisms/ChallengeWriteCard/index.tsx b/src/components/organisms/ChallengeWriteCard/index.tsx new file mode 100644 index 00000000..ca26decb --- /dev/null +++ b/src/components/organisms/ChallengeWriteCard/index.tsx @@ -0,0 +1,137 @@ +import { writeForm } from 'apis'; +import { + ChallengeProgressBar, + ChallengeWriteButton, + ChallengeWriteForm, + ChallengeWriteInterest, +} from 'components/molecules'; +import React, { useCallback, useEffect, useState } from 'react'; +import { useHistory } from 'react-router-dom'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import { Header } from './style'; + +type MyFormProps = { + onChangeForm: (form: { description1: string; description2: string; description3: string }) => void; +}; + +function WriteCard({ onChangeForm }: MyFormProps): React.ReactElement { + const history = useHistory(); + const userStatusData = useRecoilValue(userStatusState); + const [countProgressBar, setCountProgressBar] = useState(0); //프로그래스바 + const maxByte = 1000; //최대 1000바이트 + + const [byte, setByte] = useState({ + byte1: 0, + byte2: 0, + byte3: 0, + }); + + const [textForm, setTextForm] = useState({ + description1: '', + description2: '', + description3: '', + }); + + const { description1, description2, description3 } = textForm; + + const textOnChange = (target: any) => { + const { name, value } = target; + setTextForm({ + ...textForm, + [name]: value, + }); + }; + + const handleSubmit = async (e: any) => { + setUserData({ ...userData, interest: selectedInterest }); + e.preventDefault(); + onChangeForm(textForm); + setTextForm({ + description1: '', + description2: '', + description3: '', + }); + const writeData = { + good: description1, + bad: description2, + learn: description3, + interest: selectedInterest, + }; + if (userStatusData) { + await writeForm(writeData, userStatusData.token); + history.goBack(); + } + }; + + const progressBarState = useCallback(() => { + let count = 0; + if (byte.byte1 > 0) { + count++; + } + if (byte.byte2 > 0) { + count++; + } + if (byte.byte3 > 0) { + count++; + } + setCountProgressBar(count); + }, [byte.byte1, byte.byte2, byte.byte3]); + + const totalOnChange = (e: any) => { + const text_val = e.target.value; //입력한 문자 + const target_byte_name = 'byte' + e.target.name.split('description')[1]; + let str = ''; + let totalByte = 0; + for (let i = 0; i < text_val.length; i++) { + totalByte += 1; + } + + if (totalByte >= maxByte) { + str = text_val.substring(0, maxByte); + e.target.value = str; + totalByte = maxByte; + } + + textOnChange(e.target); + setByte({ + ...byte, + [target_byte_name]: totalByte, + }); + }; + + useEffect(() => { + progressBarState(); + }, [byte, progressBarState]); + + const [userData, setUserData] = useState({ + interest: [''], + }); + + const [selectedInterest, setSelectedInterest] = useState([]); + + const indextoName = (index: undefined | number) => { + switch (index) { + case 1: + return '1st'; + case 2: + return `2nd`; + case 3: + return `3rd`; + default: + return `${index}th`; + } + }; + + return ( + <> +
    Learn Myself {indextoName(userStatusData?.progressGeneration)}
    + + + + + + ); +} + +export default WriteCard; diff --git a/src/components/organisms/ChallengeWriteCard/style.ts b/src/components/organisms/ChallengeWriteCard/style.ts new file mode 100644 index 00000000..53c5e782 --- /dev/null +++ b/src/components/organisms/ChallengeWriteCard/style.ts @@ -0,0 +1,8 @@ +import Styled from 'styled-components'; +import { theme } from 'styled-tools'; + +export const Header = Styled.div` + padding-top:100px; + text-align:center; + ${theme('font.dp3_eng')}; +`; diff --git a/src/pages/ChallengeWrite/index.tsx b/src/pages/ChallengeWrite/index.tsx index 37cfd765..e4682d5f 100644 --- a/src/pages/ChallengeWrite/index.tsx +++ b/src/pages/ChallengeWrite/index.tsx @@ -1,4 +1,4 @@ -import ChallengeCard from 'components/molecules/ChallengeWriteCard'; +import { ChallengeWriteCard } from 'components/organisms'; import React from 'react'; const ChallengeWrite = () => { @@ -6,7 +6,7 @@ const ChallengeWrite = () => { return; }; - return ; + return ; }; export default ChallengeWrite; From 7595063ac8f2810ea122d63886579735f6eb7723 Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Mon, 9 Aug 2021 00:28:37 +0900 Subject: [PATCH 32/80] =?UTF-8?q?Style=20:=20import=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/MyChallengeList/index.tsx | 2 +- src/pages/ScrappedChallengeList/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/MyChallengeList/index.tsx b/src/pages/MyChallengeList/index.tsx index f711744c..a32938ee 100644 --- a/src/pages/MyChallengeList/index.tsx +++ b/src/pages/MyChallengeList/index.tsx @@ -1,5 +1,5 @@ import { getUserChallengeList } from 'apis'; -import { ChallengeDetailCard } from 'components/molecules'; +import { ChallengeDetailCard } from 'components/organisms'; import React, { useCallback, useEffect, useState } from 'react'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; diff --git a/src/pages/ScrappedChallengeList/index.tsx b/src/pages/ScrappedChallengeList/index.tsx index 590abf79..ed5fc37e 100644 --- a/src/pages/ScrappedChallengeList/index.tsx +++ b/src/pages/ScrappedChallengeList/index.tsx @@ -1,5 +1,5 @@ import { getMyPageChallengeList } from 'apis'; -import { ChallengeDetailCard } from 'components/molecules'; +import { ChallengeDetailCard } from 'components/organisms'; import React, { useCallback, useEffect, useState } from 'react'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; From 97153f8acb92d6e799a35708ac7811b17efbae3c Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Mon, 9 Aug 2021 00:28:49 +0900 Subject: [PATCH 33/80] =?UTF-8?q?Style=20:=20=ED=83=80=EC=9E=85=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/types/challenge.type.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/types/challenge.type.ts b/src/types/challenge.type.ts index eeb9aa09..9333fa31 100644 --- a/src/types/challenge.type.ts +++ b/src/types/challenge.type.ts @@ -108,3 +108,15 @@ export interface IReply { }; text?: string; } + +export interface IByte { + byte1: number; + byte2: number; + byte3: number; +} + +export interface ITextForm { + description1: string; + description2: string; + description3: string; +} From bf9b90a19eedf830de9a7d55866da517578ab158 Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Mon, 9 Aug 2021 00:29:16 +0900 Subject: [PATCH 34/80] =?UTF-8?q?Style=20:=20=EC=B1=8C=EB=A6=B0=EC=A7=80?= =?UTF-8?q?=20=EC=93=B0=EA=B8=B0/=ED=8E=B8=EC=A7=91=20=EA=B3=B5=ED=86=B5?= =?UTF-8?q?=20molecules=20=EB=AA=A8=EB=93=88=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../molecules/ChallengeProgressBar/index.tsx | 78 +++++++++++ .../molecules/ChallengeProgressBar/style.ts | 91 ++++++++++++ .../ChallengeWriteInterest/index.tsx | 132 ++++++++++++++++++ .../molecules/ChallengeWriteInterest/style.ts | 40 ++++++ 4 files changed, 341 insertions(+) create mode 100644 src/components/molecules/ChallengeProgressBar/index.tsx create mode 100644 src/components/molecules/ChallengeProgressBar/style.ts create mode 100644 src/components/molecules/ChallengeWriteInterest/index.tsx create mode 100644 src/components/molecules/ChallengeWriteInterest/style.ts diff --git a/src/components/molecules/ChallengeProgressBar/index.tsx b/src/components/molecules/ChallengeProgressBar/index.tsx new file mode 100644 index 00000000..d4c17b62 --- /dev/null +++ b/src/components/molecules/ChallengeProgressBar/index.tsx @@ -0,0 +1,78 @@ +import { CharacterBlackIcon, CharacterColor1Icon, CharacterColor2Icon, CharacterColor3Icon } from 'assets/images'; +import React from 'react'; +import { + CharacterStepImg, + CharacterWrapper, + ProgressBarStep0, + ProgressBarStep1, + ProgressBarStep2, + ProgressBarStep3, +} from './style'; + +interface IProps { + countProgressBar: number; +} + +function ChallengeProgressBar({ countProgressBar }: IProps): React.ReactElement { + return ( + <> + {countProgressBar === 0 ? ( + +
    + +

    당신의 오늘을 알고싶어요!

    +
    +
    + + . + +
    +
    + ) : null} + + {countProgressBar === 1 ? ( + +

    + +

    오호라! 오늘 이런 일이 있었군요!

    +

    +
    + + . + +
    +
    + ) : null} + + {countProgressBar === 2 ? ( + +

    + +

    우와! 내일의 당신은 더 행복할거에요 :)

    +

    +
    + + . + +
    +
    + ) : null} + + {countProgressBar === 3 ? ( + +

    + +

    더 성장한 내일의 나를 위해!

    +

    +
    + + . + +
    +
    + ) : null} + + ); +} + +export default ChallengeProgressBar; diff --git a/src/components/molecules/ChallengeProgressBar/style.ts b/src/components/molecules/ChallengeProgressBar/style.ts new file mode 100644 index 00000000..58df7ced --- /dev/null +++ b/src/components/molecules/ChallengeProgressBar/style.ts @@ -0,0 +1,91 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const CharacterWrapper = Styled.div` + position:sticky; + top:20px; + margin: 0 auto; + background-color: ${palette('grayscale', 0)}; + padding-top:60px; + width:844px; + + img{ + padding-top:29px; + } + p{ + padding-top:12.32px; + padding-bottom: 12px; + ${theme('font.subhead2')}; + color : ${palette('grayscale', 5)}; + } + h1{ + padding-top:29px; + padding-left:200px; + } + h2{ + padding-left:450px; + } + h3{ + text-align:end; + } +`; + +export const ProgressBarStep0 = Styled.span` + display: inline-block; + background-color: #d6d3d3; + width: 844px; + height: 5px; + + span{ + display: inline-block; + background-color: ${palette('primary', 3)}; + width: 1%; + height: 5px; + } +`; + +export const ProgressBarStep1 = Styled.span` + display: inline-block; + background-color: #d6d3d3; + width: 844px; + height: 5px; + + span{ + display: inline-block; + background-color: ${palette('primary', 3)}; + width: 34%; + height: 5px; + } +`; + +export const ProgressBarStep2 = Styled.span` + display: inline-block; + background-color: #d6d3d3; + width: 844px; + height: 5px; + + span{ + display: inline-block; + background-color: ${palette('primary', 3)}; + width: 67%; + height: 5px; + } +`; + +export const ProgressBarStep3 = Styled.span` + display: inline-block; + background-color: #d6d3d3; + width: 844px; + height: 5px; + + span{ + display: inline-block; + background-color: ${palette('primary', 3)}; + width: 100%; + height: 5px; + } +`; + +export const CharacterStepImg = Styled.img` + padding-left:55px; +`; diff --git a/src/components/molecules/ChallengeWriteInterest/index.tsx b/src/components/molecules/ChallengeWriteInterest/index.tsx new file mode 100644 index 00000000..54a2ec76 --- /dev/null +++ b/src/components/molecules/ChallengeWriteInterest/index.tsx @@ -0,0 +1,132 @@ +import { MoreClickedIcon } from 'assets/images'; +import { Button } from 'components/atoms'; +import React, { useEffect, useState } from 'react'; +import { interestList } from 'resources/string'; +import { InterestTagButton, TagListWrapper, TagWrapper } from './style'; + +interface IProps { + selectedInterest: string[]; + setSelectedInterest: (value: string[]) => void; +} + +type selectedStyle = { + backgroundColor: string; + color: string; +}; + +type selectedStyleLists = { + [key: string]: selectedStyle; +}; + +const selectedInterestStyle: selectedStyleLists = { + '건강 및 피트니스': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '게임': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '교육': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '그래픽 및 디자인': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '금융': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + 'K-pop': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '뉴스, 신문': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '데이트': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '날씨': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '네비게이션': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '출판,도서': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '뷰티': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '라이프 스타일': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '만화': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '부동산 / 홈 인테리어': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '사진 및 비디오': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '쇼핑': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '비즈니스': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '생산성': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '소셜 네트워킹': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '스포츠': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '어린이': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + 'AR앱': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '여행': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '유틸리티': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '음식 및 음료': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '음악': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '의료': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, + '기타': { backgroundColor: '#6f6f6f', color: '#FFFFFF' }, +}; + +function ChallengeWriteInterest({ selectedInterest, setSelectedInterest }: IProps) { + const [isOpenTag, setIsOpenTag] = useState(false); + const [isClickTag, setIsClickTag] = useState(false); + + const modalInterestHandler = (interest: string) => { + if (selectedInterest.length === 0) { + setSelectedInterest([interest]); + } + if (selectedInterest.length < 3) { + if (!selectedInterest.includes(interest)) { + setSelectedInterest([...selectedInterest, interest]); + } else { + setSelectedInterest(selectedInterest.filter((v) => v !== interest)); + } + } else { + if (selectedInterest.includes(interest)) { + setSelectedInterest(selectedInterest.filter((v) => v !== interest)); + } + } + }; + + const setInterestButton = (id: any, interest: string) => { + return ( + { + modalInterestHandler(interest); + setIsClickTag(!isClickTag); + }} + style={ + selectedInterestStyle[interest] && selectedInterest.indexOf(interest) > -1 + ? selectedInterestStyle[interest] + : {} + } + > + {interest} + + ); + }; + + useEffect(() => { + setSelectedInterest(selectedInterest); + }, [selectedInterest]); + + return ( + + 해시태그 +
    + {interestList.map((interest, id) => { + if (id < 6) { + return setInterestButton(id, interest); + } + })} + + + + {isOpenTag === true ? ( + + ) : null} + +
    +
    + ); +} + +export default ChallengeWriteInterest; diff --git a/src/components/molecules/ChallengeWriteInterest/style.ts b/src/components/molecules/ChallengeWriteInterest/style.ts new file mode 100644 index 00000000..1d7f2be2 --- /dev/null +++ b/src/components/molecules/ChallengeWriteInterest/style.ts @@ -0,0 +1,40 @@ +import { Button } from 'components/atoms'; +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const InterestTagButton = Styled(Button)` + margin : 12px 5px; + border: solid 1px ${palette('grayscale', 4)}; + border-radius: 60px; + background-color: ${palette('grayscale', 0)}; + padding : 12px 30px; + height : 48px; + color : ${palette('grayscale', 4)}; + ${theme('font.subhead3')}; +`; + +export const TagWrapper = Styled.div` + align-items:center; + margin:0 auto; + padding-top:60px; + width:844px; + text-align: left; + ${theme('font.subhead5')}; + + img{ + padding-bottom:5px; + vertical-align : middle; + } +`; + +export const TagListWrapper = Styled.div` + padding-top:20px; + + button{ + box-sizing: border-box; + border: 1px solid rgba(223, 223, 223, 0.5); + box-shadow: 0px 0px 15px rgba(23, 22, 91, 0.08); + background: ${palette('grayscale', 0)}; + padding: 13px 30px 30px 30px; + } +`; From f2f1997fed8279355982c263012d2fb283ed093a Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Mon, 9 Aug 2021 00:56:38 +0900 Subject: [PATCH 35/80] =?UTF-8?q?Refactor=20:=20=EC=B1=8C=EB=A6=B0?= =?UTF-8?q?=EC=A7=80=20=EC=8B=A0=EC=B2=AD=ED=95=98=EA=B8=B0=20Link=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 --- src/components/organisms/Hamburger/index.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/organisms/Hamburger/index.tsx b/src/components/organisms/Hamburger/index.tsx index ddf26891..d42856e9 100644 --- a/src/components/organisms/Hamburger/index.tsx +++ b/src/components/organisms/Hamburger/index.tsx @@ -6,12 +6,11 @@ import React, { useEffect, useState } from 'react'; import { Link, useHistory } from 'react-router-dom'; import { useRecoilState } from 'recoil'; import { userState, userStatusState } from 'stores/user'; -import Styled from 'styled-components'; import { - HamburgerContainer, BottomContainer, ChallengeEndUser, EngTitleBtn, + HamburgerContainer, Hide, Line, LoginButton, @@ -65,7 +64,7 @@ function Hamburger(): React.ReactElement { arr.push({ name: changeIndextoName(i), link: `/challenge/${i}` }); } if (generationNum.registGeneration) { - arr.push({ name: changeIndextoName(generationNum.registGeneration), link: '/challengeRegister' }); + arr.push({ name: changeIndextoName(generationNum.registGeneration), link: '/challenge/register' }); } } setChallengeList(arr); From 60e17a500345b9f9f50c8dee7fadd69f3594a222 Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Mon, 9 Aug 2021 00:57:27 +0900 Subject: [PATCH 36/80] =?UTF-8?q?Fix=20:=20export=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/index.ts b/src/components/molecules/index.ts index 96c3c35f..d89043d7 100644 --- a/src/components/molecules/index.ts +++ b/src/components/molecules/index.ts @@ -10,7 +10,6 @@ export { default as ChallengeCardList } from './ChallengeCardList'; export { default as ChallengeCardProfile } from './ChallengeCardProfile'; export { default as ChallengeComment } from './ChallengeComment'; export { default as ChallengeCommentWrite, default as ChallengeReCommentWrite } from './ChallengeCommentWrite'; -export { default as ChallengeDetailRegister } from './ChallengeDetailRegister'; export { default as ChallengeEditCard } from './ChallengeEditCard'; export { default as ChallengeHeader } from './ChallengeHeader'; export { default as ChallengeModalComment } from './ChallengeModalComment'; @@ -40,6 +39,7 @@ export { default as MyPageConcertCard } from './MyPageConcertCard'; export { default as MyPageSection } from './MyPageSection'; export { default as MyPageSlider } from './MyPageSlider'; export { default as NoticeSingleComment } from './NoticeSingleComment'; +export { default as RegisterCard } from './RegisterCard'; export { default as RegisterCompletedModal } from './RegisterCompletedModal'; export { default as RegisterConfirmModal } from './RegisterConfirmModal'; export { default as RegisterHeader } from './RegisterHeader'; From ed94c9dd2074b1d1d38e78b5d7ef6fffa2f5ead3 Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Mon, 9 Aug 2021 00:58:34 +0900 Subject: [PATCH 37/80] =?UTF-8?q?Fix=20:=20=EC=B1=8C=EB=A6=B0=EC=A7=80=20?= =?UTF-8?q?=EC=8B=A0=EC=B2=AD=ED=95=98=EA=B8=B0=20=EB=AA=A8=EB=93=88?= =?UTF-8?q?=ED=99=94=20=EC=B6=94=EA=B0=80=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChallengeDetailRegister/index.tsx | 165 ---------- .../ChallengeDetailRegister/style.ts | 307 ------------------ .../molecules/RegisterCard/index.tsx | 83 +++++ .../molecules/RegisterCard/style.ts | 104 ++++++ .../organisms/RegisterDetailCard/index.tsx | 81 +---- .../organisms/RegisterDetailCard/style.ts | 135 -------- 6 files changed, 198 insertions(+), 677 deletions(-) delete mode 100644 src/components/molecules/ChallengeDetailRegister/index.tsx delete mode 100644 src/components/molecules/ChallengeDetailRegister/style.ts create mode 100644 src/components/molecules/RegisterCard/index.tsx create mode 100644 src/components/molecules/RegisterCard/style.ts diff --git a/src/components/molecules/ChallengeDetailRegister/index.tsx b/src/components/molecules/ChallengeDetailRegister/index.tsx deleted file mode 100644 index 694df44a..00000000 --- a/src/components/molecules/ChallengeDetailRegister/index.tsx +++ /dev/null @@ -1,165 +0,0 @@ -import { getRegistPeriod, SignRegister } from 'apis'; -import { AlertIcon, ChallengeImg, CheckCircleIcon, MinusIcon, PlusIcon } from 'assets/images'; -import { Modal } from 'components/atoms'; -import { RegisterHeader } from 'components/molecules'; -import React, { useEffect, useState } from 'react'; -import { useRecoilState } from 'recoil'; -import { userState, userStatusState } from 'stores/user'; -import { IAdminChallengePeriod } from 'types/admin.type'; -import RegisterConfirmModal from '../RegisterConfirmModal'; -import { - BoxWrapper, - CardDetailWrapper, - CardSettingWrapper, - CardWrapper, - ChallengeSetting, - Container, - Header, - NoticeCardWrapper, - NoticeHeaderWrapper, - RegisterButton, - RegisterImg, - RegisterSubmitWrapper, -} from './style'; - -function ChallengeRegister(): React.ReactElement { - const [userData, setUserData] = useRecoilState(userState); - const [userStatusData, setUserStatusData] = useRecoilState(userStatusState); - const [registerCount, setRegisterCount] = useState(0); - const [isOpenModal, setIsOpenModal] = useState(false); - const [isRegisterSubmit, setIsRegisterSubmit] = useState(false); - const [periodData, setPeriodData] = useState(null); - - function minusCount() { - if (registerCount > 0) { - setRegisterCount(registerCount - 1); - } - } - const handleSubmit = async () => { - const signData = { - challengeCNT: registerCount, - }; - if (userStatusData) { - const getData = await SignRegister(signData, userStatusData.token); - if (getData) { - setIsRegisterSubmit(true); - setIsOpenModal(false); - } else { - setIsOpenModal(false); - } - } - }; - - const dateToString = (date: string): string => { - let month = date.substr(5, 2); - if (month.substr(0, 1) === '0') month = month.substr(1, 1); - let day = date.substr(8, 2); - if (day.substr(0, 1) === '0') day = day.substr(1, 1); - return `${month}월 ${day}일`; - }; - - const getRestDay = (dateString: string): number => { - const date = new Date( - parseInt(dateString.substr(0, 4)), - parseInt(dateString.substr(5, 2)) - 1, - parseInt(dateString.substr(8, 2)), - ); - const today = new Date(); - const rest = Math.ceil((date.getTime() - today.getTime()) / (1000 * 3600 * 24)); - return rest; - }; - const getChallengePeriod = async () => { - const data = await getRegistPeriod(); - data && setPeriodData(data); - }; - useEffect(() => { - getChallengePeriod(); - }, []); - - return periodData ? ( - - -
    -

    챌린지 설명

    - -
    - - - - - -

    신청기간

    -

    {getRestDay(periodData.registerEndDT)}일 남음

    -

    챌린지 기간

    -

    - {dateToString(periodData.challengeStartDT)} ~ {dateToString(periodData.challengeEndDT)} -

    - - -

    챌린지 개수 설정

    -

    2개 이상부터 뱃지 획득 가능

    -
    - -

    { - minusCount(); - }} - > - -

    - {registerCount} -

    { - setRegisterCount(registerCount + 1); - }} - > - -

    -
    -
    - - - -
    - - {isRegisterSubmit === true ? ( - - - -
    신청완료!
    -

    {userData?.nickname}님 챌린지가 정상적으로

    -

    신청되었습니다.

    -
    -
    - ) : null} - - - - 오투 챌린지 주의사항 - - -

    01

    -

    주당 회고록 개수 3개 이상 선택 및 80% 이상 달성 시 뱃지 획득이 가능합니다.

    -

    02

    -

    본 챌린지 의도와는 다른 광고성 글과 카테고리와 무관한 내용은 무통보 삭제 될 수 있습니다.

    -
    -
    -
    - ) : ( -

    챌린지 신청기간이 아닙니다

    - ); -} -export default ChallengeRegister; diff --git a/src/components/molecules/ChallengeDetailRegister/style.ts b/src/components/molecules/ChallengeDetailRegister/style.ts deleted file mode 100644 index aee6914c..00000000 --- a/src/components/molecules/ChallengeDetailRegister/style.ts +++ /dev/null @@ -1,307 +0,0 @@ -import Styled from 'styled-components'; -import { palette, theme } from 'styled-tools'; - -export const Container = Styled.div` - margin: 0 auto; - text-align: center; -`; - -export const Header = Styled.div` - position: sticky; - top: 60px; - background-color:${palette('grayscale', 0)}; - width: 100%; - - p{ - padding-top:25px; - height: 70px; - text-align: center; - ${theme('font.body4')}; - } - span{ - display: inline-block; - opacity: 0.4; - background-color: ${palette('grayscale', 10)}; - width: 100%; - height: 2px; - } -`; - -export const CardWrapper = Styled.div` - display:inline-block; - padding:60px 0px 0px 20px; - vertical-align: top; -`; - -export const CardDetailWrapper = Styled.div` - margin-bottom:30px; - border-radius: 10px; - box-shadow: 0 0 24px 0 rgba(13, 12, 63, 0.1); - padding: 50px 30px; - width: 354px; - height: 487px; - - h1{ - margin: 0 243px 4px 0; - width: 51px; - height: 21px; - text-align: center; - color: ${palette('grayscale', 7)}; - ${theme('font.body2')}; - } - h2{ - margin: 4px 0 0; - width: 294px; - height: 44px; - text-align: left; - color: ${palette('grayscale', 7)}; - ${theme('font.dp1')}; - } - h3{ - margin-top:40px; - width: 62px; - height: 21px; - color: ${palette('grayscale', 7)}; - ${theme('font.body2')}; - } - h4{ - margin: 4px 0 0; - width: 294px; - height: 44px; - text-align: left; - color: ${palette('grayscale', 7)}; - ${theme('font.dp1')}; - } -`; - -export const RegisterImg = Styled.div` - display:inline-block; - padding-top:60px; - width: 677px; - height: 1414px; -`; - -export const CardSettingWrapper = Styled.div` - display: flex; - flexDirection: row; - justifyContent: space-between; - - h1{ - margin: 0 37px 0 0; - margin-top:60px; - width: 89px; - height: 21px; - text-align: center; - color: ${palette('grayscale', 7)}; - ${theme('font.body2')}; - } - p{ - width: 126px; - height: 18px; - color: ${palette('grayscale', 2)}; - ${theme('font.body1')}; - } -`; - -export const BoxWrapper = Styled.div` - box-sizing: border-box; - display: flex; - align-items: center; - justify-content: space-between; - margin-top: 60px; - border: solid 1px ${palette('grayscale', 1)}; - border-radius: 4px; - padding: 0 16px; - width: 119px; - height: 36px; - margin-left : 49px; - ${theme('font.subhead3_eng')}; - - p{ - border:none; - background-color: ${palette('grayscale', 0)}; - cursor: pointer; - } -`; - -export const ChallengeSetting = Styled.div` - display:inline-block; -`; - -export const RegisterButton = Styled.div` - margin-top:50px; - - button{ - border:none; - border-radius: 4px; - background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); - width:294px; - height:60px; - color: ${palette('grayscale', 0)}; - ${theme('font.subhead3')}; - } -`; - -export const NoticeCardWrapper = Styled.div` - border-radius: 10px; - box-shadow: 0 0 24px 0 rgba(13, 12, 63, 0.1); - padding: 30px 30px 30px 28px; - width: 354px; - height: 282px; - - h1{ - margin-top:20px; - text-align: left; - color: ${palette('grayscale', 3)}; - ${theme('font.subhead3_eng')}; - } - p{ - text-align: left; - color: ${palette('grayscale', 4)}; - ${theme('font.body3')}; - } -`; - -export const NoticeHeaderWrapper = Styled.div` - text-align: left; - color: ${palette('grayscale', 7)}; - ${theme('font.body4')}; - - img{ - float:right; - } -`; - -export const ConfirmModalWrapper = Styled.div` - position: fixed; - top:0; - right:0; - bottom:0; - left:0; - margin:auto; - border-radius: 16px; - background-color: ${palette('grayscale', 0)}; - width: 500px; - height: 613px; -`; - -export const CautionWrapper = Styled.div` - display: flex; - align-items: center; - justify-content: center; - margin-top: 50px; - -`; - -export const ConfirmDetail = Styled.div` - padding: 80px 80px 80px; - - h1{ - ${theme('font.h1')}; - color: ${palette('grayscale', 7)}; - } - h2{ - padding-top:10px; - padding-bottom:30px; - color: ${palette('grayscale', 4)}; - ${theme('font.body3')}; - } - img{ - margin-right: 8px; - } - h4{ - text-align: center; - color: ${palette('grayscale', 7)}; - ${theme('font.body2')}; - } - h5{ - padding-top:12px; - text-align: center; - color: ${palette('primary', 6)}; - ${theme('font.body2')}; - } -`; - -export const ModalButton = Styled.button` - display: flex; - flex-direction: row; - align-items: center; - justify-content: center; - border:none; - border-radius: 0px 0px 16px 16px; - background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); - width:500px; - height:64px; - - img{ - display:inline-block; - margin-right: 10px; - } - p{ - display:inline-block; - border:none; - border-radius: 0px 0px 16px 16px; - background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); - color: ${palette('grayscale', 0)}; - ${theme('font.subhead3')}; - } -`; - -export const DetailContent = Styled.div` - border-radius: 30px; - padding: 20px 40px 40px 40px; - height:192px; - text-align:left; - background-color: #f9f9f9; - - h3{ - display:inline-block; - padding-top:20px; - width: calc(100% - 150px); - text-align:left; - color: ${palette('grayscale', 7)}; - ${theme('font.body2')}; - } - p{ - display:inline-block; - text-align:left; - color: ${palette('grayscale', 7)}; - ${theme('font.subhead3')}; - } - `; - -export const RegisterSubmitWrapper = Styled.div` - position: fixed; - top:0; - right:0; - bottom:0; - left:0; - margin:auto; - border-width: 1px; - border-style: solid; - border-radius: 16px; - border-color:${palette('primary', 3)}; - background-color: ${palette('grayscale', 0)}; - width: 500px; - height: 273px; - - img{ - display:flex; - margin:auto; - margin-top:-40px; - } - h5{ - background: linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); - -webkit-background-clip: text; - background-clip: text; - padding-top:20px; - padding-bottom:40px; - text-align: center; - -webkit-text-fill-color: transparent; - ${theme('font.dp4')}; - } - p{ - text-align: center; - ${theme('font.body3')}; - } -`; diff --git a/src/components/molecules/RegisterCard/index.tsx b/src/components/molecules/RegisterCard/index.tsx new file mode 100644 index 00000000..b7d36a1a --- /dev/null +++ b/src/components/molecules/RegisterCard/index.tsx @@ -0,0 +1,83 @@ +import { MinusIcon, PlusIcon } from 'assets/images'; +import React from 'react'; +import { IAdminChallengePeriod } from 'types/admin.type'; +import { BoxWrapper, CardDetailWrapper, CardSettingWrapper, ChallengeSetting, RegisterButton } from './style'; + +interface IProps { + setIsOpenModal: (value: boolean) => void; + dateToString: (date: string) => void; + periodData: IAdminChallengePeriod; + registerCount: number; + setRegisterCount: (value: number) => void; +} + +function RegisterCard({ + setIsOpenModal, + dateToString, + periodData, + registerCount, + setRegisterCount, +}: IProps): React.ReactElement { + function minusCount() { + if (registerCount > 0) { + setRegisterCount(registerCount - 1); + } + } + + const getRestDay = (dateString: string): number => { + const date = new Date( + parseInt(dateString.substr(0, 4)), + parseInt(dateString.substr(5, 2)) - 1, + parseInt(dateString.substr(8, 2)), + ); + const today = new Date(); + const rest = Math.ceil((date.getTime() - today.getTime()) / (1000 * 3600 * 24)); + return rest; + }; + return ( + <> + +

    신청기간

    +

    {getRestDay(periodData.registerEndDT)}일 남음

    +

    챌린지 기간

    +

    + {dateToString(periodData.challengeStartDT)} ~ {dateToString(periodData.challengeEndDT)} +

    + + +

    챌린지 개수 설정

    +

    2개 이상부터 뱃지 획득 가능

    +
    + +

    { + minusCount(); + }} + > + +

    + {registerCount} +

    { + setRegisterCount(registerCount + 1); + }} + > + +

    +
    +
    + + + +
    + + ); +} + +export default RegisterCard; diff --git a/src/components/molecules/RegisterCard/style.ts b/src/components/molecules/RegisterCard/style.ts new file mode 100644 index 00000000..cb443056 --- /dev/null +++ b/src/components/molecules/RegisterCard/style.ts @@ -0,0 +1,104 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const CardDetailWrapper = Styled.div` + margin-bottom:30px; + border-radius: 10px; + box-shadow: 0 0 24px 0 rgba(13, 12, 63, 0.1); + padding: 50px 30px; + width: 354px; + height: 487px; + + h1{ + margin: 0 243px 4px 0; + width: 51px; + height: 21px; + text-align: center; + color: ${palette('grayscale', 7)}; + ${theme('font.body2')}; + } + h2{ + margin: 4px 0 0; + width: 294px; + height: 44px; + text-align: left; + color: ${palette('grayscale', 7)}; + ${theme('font.dp1')}; + } + h3{ + margin-top:40px; + width: 62px; + height: 21px; + color: ${palette('grayscale', 7)}; + ${theme('font.body2')}; + } + h4{ + margin: 4px 0 0; + width: 294px; + height: 44px; + text-align: left; + color: ${palette('grayscale', 7)}; + ${theme('font.dp1')}; + } +`; + +export const CardSettingWrapper = Styled.div` + display: flex; + flexDirection: row; + justifyContent: space-between; + + h1{ + margin: 0 37px 0 0; + margin-top:60px; + width: 89px; + height: 21px; + text-align: center; + color: ${palette('grayscale', 7)}; + ${theme('font.body2')}; + } + p{ + width: 126px; + height: 18px; + color: ${palette('grayscale', 2)}; + ${theme('font.body1')}; + } +`; + +export const BoxWrapper = Styled.div` + box-sizing: border-box; + display: flex; + align-items: center; + justify-content: space-between; + margin-top: 60px; + border: solid 1px ${palette('grayscale', 1)}; + border-radius: 4px; + padding: 0 16px; + width: 119px; + height: 36px; + margin-left : 49px; + ${theme('font.subhead3_eng')}; + + p{ + border:none; + background-color: ${palette('grayscale', 0)}; + cursor: pointer; + } +`; + +export const ChallengeSetting = Styled.div` + display:inline-block; +`; + +export const RegisterButton = Styled.div` + margin-top:50px; + + button{ + border:none; + border-radius: 4px; + background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); + width:294px; + height:60px; + color: ${palette('grayscale', 0)}; + ${theme('font.subhead3')}; + } +`; diff --git a/src/components/organisms/RegisterDetailCard/index.tsx b/src/components/organisms/RegisterDetailCard/index.tsx index c5409f2a..b79db7d4 100644 --- a/src/components/organisms/RegisterDetailCard/index.tsx +++ b/src/components/organisms/RegisterDetailCard/index.tsx @@ -1,34 +1,19 @@ import { getRegistPeriod, SignRegister } from 'apis'; -import { AlertIcon, MinusIcon, PlusIcon } from 'assets/images'; -import { RegisterCompletedModal, RegisterConfirmModal } from 'components/molecules'; +import { AlertIcon } from 'assets/images'; +import { RegisterCard, RegisterCompletedModal, RegisterConfirmModal } from 'components/molecules'; import React, { useEffect, useState } from 'react'; import { useRecoilState } from 'recoil'; -import { userState, userStatusState } from 'stores/user'; +import { userStatusState } from 'stores/user'; import { IAdminChallengePeriod } from 'types/admin.type'; -import { - BoxWrapper, - CardDetailWrapper, - CardSettingWrapper, - CardWrapper, - ChallengeSetting, - NoticeCardWrapper, - NoticeHeaderWrapper, - RegisterButton, -} from './style'; +import { CardWrapper, NoticeCardWrapper, NoticeHeaderWrapper } from './style'; function RegisterDetailCard() { - const [userData, setUserData] = useRecoilState(userState); const [userStatusData, setUserStatusData] = useRecoilState(userStatusState); const [registerCount, setRegisterCount] = useState(0); const [isOpenModal, setIsOpenModal] = useState(false); const [isRegisterSubmit, setIsRegisterSubmit] = useState(false); const [periodData, setPeriodData] = useState(null); - function minusCount() { - if (registerCount > 0) { - setRegisterCount(registerCount - 1); - } - } const handleSubmit = async () => { const signData = { challengeCNT: registerCount, @@ -52,17 +37,6 @@ function RegisterDetailCard() { return `${month}월 ${day}일`; }; - const getRestDay = (dateString: string): number => { - const date = new Date( - parseInt(dateString.substr(0, 4)), - parseInt(dateString.substr(5, 2)) - 1, - parseInt(dateString.substr(8, 2)), - ); - const today = new Date(); - const rest = Math.ceil((date.getTime() - today.getTime()) / (1000 * 3600 * 24)); - return rest; - }; - const getChallengePeriod = async () => { const data = await getRegistPeriod(); data && setPeriodData(data); @@ -75,46 +49,13 @@ function RegisterDetailCard() { return periodData ? ( <> - -

    신청기간

    -

    {getRestDay(periodData.registerEndDT)}일 남음

    -

    챌린지 기간

    -

    - {dateToString(periodData.challengeStartDT)} ~ {dateToString(periodData.challengeEndDT)} -

    - - -

    챌린지 개수 설정

    -

    2개 이상부터 뱃지 획득 가능

    -
    - -

    { - minusCount(); - }} - > - -

    - {registerCount} -

    { - setRegisterCount(registerCount + 1); - }} - > - -

    -
    -
    - - - -
    + Date: Mon, 9 Aug 2021 01:20:50 +0900 Subject: [PATCH 38/80] =?UTF-8?q?Fix=20:=20=EB=9F=B0=EB=A7=88=EC=85=80=20?= =?UTF-8?q?=ED=8E=B8=EC=A7=91=20=EB=AA=A8=EB=93=88=ED=99=94=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../molecules/ChallengeEditCard/index.tsx | 196 ------------------ .../molecules/ChallengeEditCard/style.ts | 168 --------------- .../molecules/ChallengeEditForm/index.tsx | 56 +++++ .../molecules/ChallengeEditForm/style.ts | 32 +++ src/components/molecules/index.ts | 2 +- .../organisms/ChallengeCard/style.ts | 11 - .../organisms/ChallengeEditCard/index.tsx | 61 +----- 7 files changed, 92 insertions(+), 434 deletions(-) delete mode 100644 src/components/molecules/ChallengeEditCard/index.tsx delete mode 100644 src/components/molecules/ChallengeEditCard/style.ts create mode 100644 src/components/molecules/ChallengeEditForm/index.tsx create mode 100644 src/components/molecules/ChallengeEditForm/style.ts delete mode 100644 src/components/organisms/ChallengeCard/style.ts diff --git a/src/components/molecules/ChallengeEditCard/index.tsx b/src/components/molecules/ChallengeEditCard/index.tsx deleted file mode 100644 index eb906eac..00000000 --- a/src/components/molecules/ChallengeEditCard/index.tsx +++ /dev/null @@ -1,196 +0,0 @@ -import { ChallengeEdit, getChallengeContent } from 'apis'; -import { ChallengeProgressBar, ChallengeWriteInterest } from 'components/molecules'; -import React, { useEffect, useState } from 'react'; -import { useHistory } from 'react-router-dom'; -import { useRecoilValue } from 'recoil'; -import { userStatusState } from 'stores/user'; -import { BlackButton, ButtonWrapper, ColorButton, Header, QuestionWrapper } from './style'; - -export interface IProps { - description?: string; - className?: string; - value?: string; -} - -interface IEditCard { - id: string; -} - -function EditCard({ id }: IEditCard): React.ReactElement { - const userStatusData = useRecoilValue(userStatusState); - const history = useHistory(); - const maxByte = 1000; //최대 1000바이트 - const [countProgressBar, setCountProgressBar] = useState(0); //프로그래스바 - - const [byte, setByte] = useState({ - byte1: 0, - byte2: 0, - byte3: 0, - }); - - const [textForm, setTextForm] = useState({ - description1: '', - description2: '', - description3: '', - }); - - const { description1, description2, description3 } = textForm; - const textOnChange = (target: any) => { - const { name, value } = target; - setTextForm({ - ...textForm, - [name]: value, - }); - }; - - const handleSubmit = async (e: any) => { - e.preventDefault(); - setTextForm({ - description1: '', - description2: '', - description3: '', - }); - const editData = { - good: description1, - bad: description2, - learn: description3, - interest: selectedInterest, - }; - if (userStatusData) { - const data = await ChallengeEdit(editData, userStatusData.token, id); - data && history.goBack(); - } - }; - - const progressBarState = () => { - let count = 0; - if (byte.byte1 > 0) { - count++; - } - if (byte.byte2 > 0) { - count++; - } - if (byte.byte3 > 0) { - count++; - } - setCountProgressBar(count); - }; - - const handleTotalOnChange = (e: any) => { - const text_val = e.target.value; //입력한 문자 - const target_byte_name = 'byte' + e.target.name.split('description')[1]; - let str = ''; - let totalByte = stringtoByte(text_val); - - if (totalByte >= maxByte) { - str = text_val.substring(0, maxByte); - e.target.value = str; - totalByte = maxByte; - } - textOnChange(e.target); - setByte({ - ...byte, - [target_byte_name]: totalByte, - }); - }; - const stringtoByte = (value: string) => { - return value.length; - }; - - useEffect(() => { - progressBarState(); - }, [byte]); - useEffect(() => { - getDefaultData(); - }, []); - - const getDefaultData = async () => { - if (userStatusData) { - const data = await getChallengeContent(id, userStatusData.token); - if (data) { - setTextForm({ description1: data.good, description2: data.bad, description3: data.learn }); - setSelectedInterest(data.interest); - setByte({ - byte1: stringtoByte(data.good), - byte2: stringtoByte(data.bad), - byte3: stringtoByte(data.learn), - }); - } - } else { - } - }; - - const [selectedInterest, setSelectedInterest] = useState([]); - - const indextoName = (index: undefined | number) => { - switch (index) { - case 1: - return '1st'; - case 2: - return `2nd`; - case 3: - return `3rd`; - default: - return `${index}th`; - } - }; - - return ( - <> -
    Learn Myself {indextoName(userStatusData?.progressGeneration)}
    - - - -

    오늘의 잘한 점을 적어보세요.

    -

    - {byte.byte1}/{maxByte} -

    - -
    - - -

    오늘의 못한 점을 적어보세요.

    -

    - {byte.byte2}/{maxByte} -

    - -
    - -

    잘한 점/못한 점을 통해 배운 것과 다음에 실천할 것을 적어보세요.

    -

    - {byte.byte3}/{maxByte} -

    - -
    - - - - {countProgressBar === 3 ? ( - - 수정완료 - - ) : ( - - 수정완료 - - )} - - ); -} - -export default EditCard; diff --git a/src/components/molecules/ChallengeEditCard/style.ts b/src/components/molecules/ChallengeEditCard/style.ts deleted file mode 100644 index beae4b8a..00000000 --- a/src/components/molecules/ChallengeEditCard/style.ts +++ /dev/null @@ -1,168 +0,0 @@ -import { Button } from 'components/atoms'; -import Styled from 'styled-components'; -import { palette, theme } from 'styled-tools'; - -export const Header = Styled.div` - padding-top:100px; - text-align:center; - ${theme('font.dp3_eng')}; -`; -export const InterestTagButton = Styled(Button)` - margin : 12px 5px; - border: solid 1px ${palette('grayscale', 4)}; - border-radius: 60px; - background-color: ${palette('grayscale', 0)}; - padding : 12px 30px; - height : 48px; - color : ${palette('grayscale', 4)}; - ${theme('font.subhead3')}; -`; - -export const QuestionWrapper = Styled.div` - margin: 0 auto; - padding-top:60px; - width:844px; - - h1 { - line-height:38px; - color: ${palette('grayscale', 7)}; - ${theme('font.subhead5')}; - } - - p { - padding-bottom: 30px; - text-align: right; - color: #B1B1B1; - ${theme('font.subhead2_eng')}; - } - - textarea{ - box-sizing: border-box; - align-items: center; - border: 1px solid ${palette('grayscale', 1)}; - padding: 40px 60px 40px 60px; - width: 844px; - height:369px; - resize:none; - ${theme('font.body4')}; - } -`; - -export const TagWrapper = Styled.div` - align-items:center; - margin:0 auto; - padding-top:60px; - width:844px; - text-align: left; - ${theme('font.subhead5')}; - - img{ - padding-bottom:5px; - vertical-align : middle; - } -`; - -export const TagListWrapper = Styled.div` - padding-top:20px; - - button{ - box-sizing: border-box; - border: 1px solid rgba(223, 223, 223, 0.5); - box-shadow: 0px 0px 15px rgba(23, 22, 91, 0.08); - background: ${palette('grayscale', 0)}; - padding: 13px 30px 30px 30px; - } -<<<<<<< Updated upstream - - -`; - -export const ProgressBarStep0 = Styled.span` - display: inline-block; - background-color: #d6d3d3; - width: 844px; - height: 5px; - - span{ - display: inline-block; - background-color: ${palette('primary', 3)}; - width: 1%; - height: 5px; - } -`; - -export const ProgressBarStep1 = Styled.span` - display: inline-block; - background-color: #d6d3d3; - width: 844px; - height: 5px; - - span{ - display: inline-block; - background-color: ${palette('primary', 3)}; - width: 34%; - height: 5px; - } -`; - -export const ProgressBarStep2 = Styled.span` - display: inline-block; - background-color: #d6d3d3; - width: 844px; - height: 5px; - - span{ - display: inline-block; - background-color: ${palette('primary', 3)}; - width: 67%; - height: 5px; - } -`; - -export const ProgressBarStep3 = Styled.span` - display: inline-block; - background-color: #d6d3d3; - width: 844px; - height: 5px; - - span{ - display: inline-block; - background-color: ${palette('primary', 3)}; - width: 100%; - height: 5px; - } -======= ->>>>>>> Stashed changes -`; - -export const ButtonWrapper = Styled.div` - align-items: center; - margin: 0 auto; - width:844px; -`; - -export const ColorButton = Styled(Button)` - margin: 0 auto; - margin-top:60px; - border:none; - border-radius: 4px; - width:844px; - height: 60px; - text-align: center; - color: ${palette('grayscale', 0)}; - background: linear-gradient(91.91deg, ${palette('primary', 3)} 7.34%, ${palette('primary', 0)} 90.35%); - ${theme('font.subhead3')}; -`; - -export const BlackButton = Styled(Button)` - margin: 0 auto; - margin-top:60px; - border:none; - border-radius: 4px; - width:844px; - height: 60px; - text-align: center; - color: ${palette('grayscale', 0)}; - background: ${palette('grayscale', 1)}; - ${theme('font.subhead3')}; -`; diff --git a/src/components/molecules/ChallengeEditForm/index.tsx b/src/components/molecules/ChallengeEditForm/index.tsx new file mode 100644 index 00000000..9919f375 --- /dev/null +++ b/src/components/molecules/ChallengeEditForm/index.tsx @@ -0,0 +1,56 @@ +import React from 'react'; +import { IByte, ITextForm } from 'types/challenge.type'; +import { QuestionWrapper } from './style'; + +interface IProps { + handleTotalOnChange: (e: any) => void; + byte: IByte; + ITextForm: ITextForm; +} + +function ChallengeEditForm({ handleTotalOnChange, byte, ITextForm }: IProps): React.ReactElement { + const maxByte = 1000; //최대 1000바이트 + return ( + <> + +

    오늘의 잘한 점을 적어보세요.

    +

    + {byte.byte1}/{maxByte} +

    + +
    + + +

    오늘의 못한 점을 적어보세요.

    +

    + {byte.byte2}/{maxByte} +

    + +
    + +

    잘한 점/못한 점을 통해 배운 것과 다음에 실천할 것을 적어보세요.

    +

    + {byte.byte3}/{maxByte} +

    + +
    + + ); +} + +export default ChallengeEditForm; diff --git a/src/components/molecules/ChallengeEditForm/style.ts b/src/components/molecules/ChallengeEditForm/style.ts new file mode 100644 index 00000000..82a76467 --- /dev/null +++ b/src/components/molecules/ChallengeEditForm/style.ts @@ -0,0 +1,32 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const QuestionWrapper = Styled.div` + margin: 0 auto; + padding-top:60px; + width:844px; + + h1 { + line-height:38px; + color: ${palette('grayscale', 7)}; + ${theme('font.subhead5')}; + } + + p { + padding-bottom: 30px; + text-align: right; + color: #B1B1B1; + ${theme('font.subhead2_eng')}; + } + + textarea{ + box-sizing: border-box; + align-items: center; + border: 1px solid ${palette('grayscale', 1)}; + padding: 40px 60px 40px 60px; + width: 844px; + height:369px; + resize:none; + ${theme('font.body4')}; + } +`; diff --git a/src/components/molecules/index.ts b/src/components/molecules/index.ts index d89043d7..244e7243 100644 --- a/src/components/molecules/index.ts +++ b/src/components/molecules/index.ts @@ -10,7 +10,7 @@ export { default as ChallengeCardList } from './ChallengeCardList'; export { default as ChallengeCardProfile } from './ChallengeCardProfile'; export { default as ChallengeComment } from './ChallengeComment'; export { default as ChallengeCommentWrite, default as ChallengeReCommentWrite } from './ChallengeCommentWrite'; -export { default as ChallengeEditCard } from './ChallengeEditCard'; +export { default as ChallengeEditForm } from './ChallengeEditForm'; export { default as ChallengeHeader } from './ChallengeHeader'; export { default as ChallengeModalComment } from './ChallengeModalComment'; export { default as ChallengeProgressBar } from './ChallengeProgressBar'; diff --git a/src/components/organisms/ChallengeCard/style.ts b/src/components/organisms/ChallengeCard/style.ts deleted file mode 100644 index df32e090..00000000 --- a/src/components/organisms/ChallengeCard/style.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Styled from 'styled-components'; -import { theme } from 'styled-tools'; - -export const ChallengeCardWrapper = Styled.div` -p{ - margin : 100px 0 100px 0; - width : 100%; - text-align :center; - ${theme('font.body3')}; -} -`; diff --git a/src/components/organisms/ChallengeEditCard/index.tsx b/src/components/organisms/ChallengeEditCard/index.tsx index af434966..4a05a603 100644 --- a/src/components/organisms/ChallengeEditCard/index.tsx +++ b/src/components/organisms/ChallengeEditCard/index.tsx @@ -1,10 +1,10 @@ import { ChallengeEdit, getChallengeContent } from 'apis'; -import { ChallengeProgressBar, ChallengeWriteInterest } from 'components/molecules'; +import { ChallengeEditForm, ChallengeProgressBar, ChallengeWriteInterest } from 'components/molecules'; import React, { useEffect, useState } from 'react'; import { useHistory } from 'react-router-dom'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; -import { BlackButton, ButtonWrapper, ColorButton, Header, QuestionWrapper } from './style'; +import { BlackButton, ButtonWrapper, ColorButton, Header } from './style'; export interface IProps { description?: string; @@ -121,22 +121,6 @@ function EditCard({ id }: IEditCard): React.ReactElement { }; const [selectedInterest, setSelectedInterest] = useState([]); - const modalInterestHandler = (interest: string) => { - if (selectedInterest.length === 0) { - setSelectedInterest([interest]); - } - if (selectedInterest.length < 3) { - if (!selectedInterest.includes(interest)) { - setSelectedInterest([...selectedInterest, interest]); - } else { - setSelectedInterest(selectedInterest.filter((v) => v !== interest)); - } - } else { - if (selectedInterest.includes(interest)) { - setSelectedInterest(selectedInterest.filter((v) => v !== interest)); - } - } - }; const indextoName = (index: undefined | number) => { switch (index) { @@ -155,47 +139,8 @@ function EditCard({ id }: IEditCard): React.ReactElement { <>
    Learn Myself {indextoName(userStatusData?.progressGeneration)}
    - - -

    오늘의 잘한 점을 적어보세요.

    -

    - {byte.byte1}/{maxByte} -

    - -
    - - -

    오늘의 못한 점을 적어보세요.

    -

    - {byte.byte2}/{maxByte} -

    - -
    - -

    잘한 점/못한 점을 통해 배운 것과 다음에 실천할 것을 적어보세요.

    -

    - {byte.byte3}/{maxByte} -

    - -
    - + - {countProgressBar === 3 ? ( 수정완료 From 58eb6b9db8e4e36775e7a14118795ecde70e5bf4 Mon Sep 17 00:00:00 2001 From: JiyoungHyun Date: Mon, 9 Aug 2021 18:17:20 +0900 Subject: [PATCH 39/80] =?UTF-8?q?Style:=20=ED=94=BC=EB=93=9C=EB=B0=B1=20?= =?UTF-8?q?=EB=B0=98=EC=98=81=20api=20=ED=83=80=EC=9E=85=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/concert.api.ts | 17 ++--------------- src/apis/notice.api.ts | 24 +++++++++--------------- src/types/concert.type.ts | 19 +++++++++++++++++-- src/types/notice.type.ts | 19 +++++++++++++++++-- 4 files changed, 45 insertions(+), 34 deletions(-) diff --git a/src/apis/concert.api.ts b/src/apis/concert.api.ts index d27c3957..bc95b0cd 100644 --- a/src/apis/concert.api.ts +++ b/src/apis/concert.api.ts @@ -1,18 +1,5 @@ import { serverAxios } from 'libs/axios'; -import { IConcert, IConcertList } from '../types/concert.type'; - -interface IConcertCommentData { - parentID?: string | null; - text: string; -} - -interface IFetchParameter { - token?: string; - limit?: number; - offset?: number; - keyword?: string; - tag?: string; -} +import { IConcert, IConcertCommentData, IConcertList, IFetchComment, IFetchParameter } from '../types/concert.type'; const PREFIX_URL = '/concert'; @@ -104,7 +91,7 @@ export const postConcertComment = async ( token: string, concertID: string | undefined, commentData: IConcertCommentData, -): Promise => { +): Promise => { try { const data = await serverAxios.post(`${PREFIX_URL}/comment/${concertID}`, commentData, { headers: { diff --git a/src/apis/notice.api.ts b/src/apis/notice.api.ts index 7b27b1d3..858ff451 100644 --- a/src/apis/notice.api.ts +++ b/src/apis/notice.api.ts @@ -1,17 +1,11 @@ import { serverAxios } from 'libs/axios'; -import { INoticeList, ISearchNoticeList } from '../types/notice.type'; -interface INoticeCommentData { - parentID?: string | null; - text: string; -} - -interface IFetchParameter { - token?: string; - limit?: number; - offset?: number; - keyword?: string; - tag?: string; -} +import { + IFetchComment, + IFetchParameter, + INoticeCommentData, + INoticeList, + ISearchNoticeList, +} from '../types/notice.type'; const PREFIX_URL = '/notice'; @@ -75,7 +69,7 @@ export const postNoticeComment = async ( token: string, noticeID: string | undefined, commentData: INoticeCommentData, -): Promise => { +): Promise => { try { const data = await serverAxios.post(`${PREFIX_URL}/comment/${noticeID}`, commentData, { headers: { @@ -83,7 +77,7 @@ export const postNoticeComment = async ( }, }); if (data.data.status === 200) { - return null; + return data.data.data; } else { return null; } diff --git a/src/types/concert.type.ts b/src/types/concert.type.ts index 5e9dc688..ecb6e653 100644 --- a/src/types/concert.type.ts +++ b/src/types/concert.type.ts @@ -41,7 +41,22 @@ export interface IConcertComment { text: string; } -export interface IConcertNewComment { - parentID?: string; +export interface IConcertCommentData { + parentID?: string | null; text: string; } + +export interface IFetchParameter { + token?: string; + limit?: number; + offset?: number; + keyword?: string; + tag?: string; +} + +export interface IFetchComment { + createdAt: string; + nickname: string; + text: string; + _id: string; +} diff --git a/src/types/notice.type.ts b/src/types/notice.type.ts index 140084bf..ffb00266 100644 --- a/src/types/notice.type.ts +++ b/src/types/notice.type.ts @@ -43,7 +43,22 @@ export interface INoticeComment { text: string; } -export interface INoticeNewComment { - parentID?: string; +export interface INoticeCommentData { + parentID?: string | null; text: string; } + +export interface IFetchParameter { + token?: string; + limit?: number; + offset?: number; + keyword?: string; + tag?: string; +} + +export interface IFetchComment { + createdAt: string; + nickname: string; + text: string; + _id: string; +} From 98529e4e5531bf2dfec6d239b9988fb1eaa28fa4 Mon Sep 17 00:00:00 2001 From: Subin Date: Mon, 9 Aug 2021 21:02:24 +0900 Subject: [PATCH 40/80] =?UTF-8?q?Style:=20styled=20component=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../molecules/AdminChallengeOpenForm/style.ts | 2 +- .../molecules/AdminWriteForm/style.ts | 19 +++-- src/components/molecules/DropDown/style.ts | 21 ++--- .../molecules/DropDownMulti/style.ts | 21 ++--- .../organisms/AdminChallengeOpen/style.ts | 14 ++-- src/components/organisms/AdminWrite/style.ts | 15 ++-- src/components/organisms/Join/style.ts | 80 ++++++++++++------- src/pages/Home/index.tsx | 20 +---- src/pages/Home/style.ts | 21 ++++- 9 files changed, 126 insertions(+), 87 deletions(-) diff --git a/src/components/molecules/AdminChallengeOpenForm/style.ts b/src/components/molecules/AdminChallengeOpenForm/style.ts index ab918dab..bf689dc2 100644 --- a/src/components/molecules/AdminChallengeOpenForm/style.ts +++ b/src/components/molecules/AdminChallengeOpenForm/style.ts @@ -24,7 +24,7 @@ export const PeopleContainer = Styled.div` `; export const Text = Styled.div<{ font: string }>` - ${theme(`font.font`)}; + ${(props) => theme(`font.${props.font}`)}; line-height : 60px; color : ${palette('grayscale', 4)}; `; diff --git a/src/components/molecules/AdminWriteForm/style.ts b/src/components/molecules/AdminWriteForm/style.ts index 67dfca5f..32abb49a 100644 --- a/src/components/molecules/AdminWriteForm/style.ts +++ b/src/components/molecules/AdminWriteForm/style.ts @@ -1,5 +1,5 @@ import { Input, Label } from 'components/atoms'; -import Styled from 'styled-components'; +import Styled, { css } from 'styled-components'; import { palette, theme } from 'styled-tools'; export const UploadDescription = Styled.div` @@ -72,13 +72,18 @@ export const HashTagInput = Styled(Input)` padding : 18px 20px; `; export const HashTagInputContainer = Styled.div<{ isFocused: boolean }>` - border : ${(props) => (props.isFocused ? 'double 1px transparent' : `1px solid ${palette('grayscale', 2)}`)}; - background-image : ${(props) => + ${(props) => props.isFocused - ? `linear-gradient(white, white), linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)})` - : undefined}; - background-origin : ${(props) => (props.isFocused ? 'border-box' : undefined)}; - background-clip : ${(props) => (props.isFocused ? 'content-box, border-box' : undefined)}; + ? css` + border: double 1px transparent; + background-image: linear-gradient(white, white), + linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + background-origin: border-box; + background-clip: content-box, border-box; + ` + : css` + border: 1px solid ${palette('grayscale', 2)}; + `}; width : 100%; height : 60px; border-radius: 4px; diff --git a/src/components/molecules/DropDown/style.ts b/src/components/molecules/DropDown/style.ts index b40dc3f8..51c925a3 100644 --- a/src/components/molecules/DropDown/style.ts +++ b/src/components/molecules/DropDown/style.ts @@ -1,4 +1,4 @@ -import Styled from 'styled-components'; +import Styled, { css } from 'styled-components'; import { palette, theme } from 'styled-tools'; export const Item = Styled.span<{ page: string }>` @@ -22,17 +22,18 @@ export const SummaryOuter = Styled.div<{ border-radius: 4px; display : flex; align-items : center; - border : ${(props) => - props.isOpen || props.isChecked ? 'double 1px transparent' : `1px solid ${palette('grayscale', 1)}`}; - background-image : ${(props) => props.isOpen || props.isChecked - ? `linear-gradient(white, white), linear-gradient(to right, ${palette('primary', 3)},${palette('primary', 0)})` - : undefined}; - background-origin : - ${(props) => (props.isOpen || props.isChecked ? 'border-box' : undefined)}; - background-clip : - ${(props) => (props.isOpen || props.isChecked ? 'content-box, border-box' : undefined)}; + ? css` + border: double 1px transparent; + background-image: linear-gradient(white, white), + linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + background-origin: border-box; + background-clip: content-box, border-box; + ` + : css` + border: 1px solid ${palette('grayscale', 2)}; + `}; position:${(props) => (props.page === 'adminwrite' ? 'relative' : undefined)}; `; diff --git a/src/components/molecules/DropDownMulti/style.ts b/src/components/molecules/DropDownMulti/style.ts index 1e3bb071..d07d4fc6 100644 --- a/src/components/molecules/DropDownMulti/style.ts +++ b/src/components/molecules/DropDownMulti/style.ts @@ -1,4 +1,4 @@ -import Styled from 'styled-components'; +import Styled, { css } from 'styled-components'; import { palette, theme } from 'styled-tools'; export const Item = Styled.span` @@ -20,17 +20,18 @@ export const SummaryOuter = Styled.div<{ border-radius: 4px; display : flex; align-items : center; - border : ${(props) => - props.isOpen || props.isChecked ? 'double 1px transparent' : `1px solid ${palette('grayscale', 1)}`}; - background-image : ${(props) => props.isOpen || props.isChecked - ? `linear-gradient(white, white), linear-gradient(to right, ${palette('primary', 3)},${palette('primary', 0)})` - : undefined}; - background-origin : - ${(props) => (props.isOpen || props.isChecked ? 'border-box' : undefined)}; - background-clip : - ${(props) => (props.isOpen || props.isChecked ? 'content-box, border-box' : undefined)}; + ? css` + border: double 1px transparent; + background-image: linear-gradient(white, white), + linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + background-origin: border-box; + background-clip: content-box, border-box; + ` + : css` + border: 1px solid ${palette('grayscale', 1)}; + `}; `; export const SummaryInner = Styled.div` diff --git a/src/components/organisms/AdminChallengeOpen/style.ts b/src/components/organisms/AdminChallengeOpen/style.ts index e81e05b5..0db0bc1d 100644 --- a/src/components/organisms/AdminChallengeOpen/style.ts +++ b/src/components/organisms/AdminChallengeOpen/style.ts @@ -1,5 +1,5 @@ import { Button, CheckBox, Label } from 'components/atoms'; -import Styled from 'styled-components'; +import Styled, { css } from 'styled-components'; import { palette, theme } from 'styled-tools'; export const PhotoUploadBottomDesc = Styled.div` @@ -85,11 +85,15 @@ export const OpenButton = Styled(Button)<{ isButtonDisabled?: boolean }>` height: 60px; border-radius: 4px; color : ${palette('grayscale', 0)}; - background-image : ${(props) => + ${(props) => !props.isButtonDisabled - ? `linear-gradient(to right, ${palette('primary', 3)},${palette('primary', 0)} )` - : `${palette('grayscale', 1)}`}; - background-color : ${(props) => (props.isButtonDisabled ? `${palette('grayscale', 1)}` : undefined)}; + ? css` + background-image: linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + ` + : css` + background-color: ${palette('grayscale', 1)}; + background-image: ${palette('grayscale', 1)}; + `}; margin-bottom : 304px; `; diff --git a/src/components/organisms/AdminWrite/style.ts b/src/components/organisms/AdminWrite/style.ts index 57f5e5d9..a6de70d2 100644 --- a/src/components/organisms/AdminWrite/style.ts +++ b/src/components/organisms/AdminWrite/style.ts @@ -1,5 +1,5 @@ import { Button, Label } from 'components/atoms'; -import Styled from 'styled-components'; +import Styled, { css } from 'styled-components'; import { palette, theme } from 'styled-tools'; export const PageLabel = Styled(Label)` @@ -24,11 +24,14 @@ export const WriteButton = Styled(Button)<{ isButtonDisabled?: boolean }>` height: 60px; border-radius: 4px; color : ${palette('grayscale', 0)}; - background-color : ${(props) => (props.isButtonDisabled ? `${palette('grayscale', 1)}` : undefined)}; - background-image : ${(props) => - !props.isButtonDisabled - ? `linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)} )` - : undefined}; + ${(props) => + props.isButtonDisabled + ? css` + background-color: ${palette('grayscale', 1)}; + ` + : css` + background-image: linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + `} margin-bottom : 304px; `; diff --git a/src/components/organisms/Join/style.ts b/src/components/organisms/Join/style.ts index 264bfd0d..23094092 100644 --- a/src/components/organisms/Join/style.ts +++ b/src/components/organisms/Join/style.ts @@ -1,5 +1,5 @@ import { Button, Label } from 'components/atoms'; -import Styled from 'styled-components'; +import Styled, { css } from 'styled-components'; import { palette, theme } from 'styled-tools'; export const InterestButtonWrapper = Styled.div` @@ -11,36 +11,49 @@ export const InterestButtonWrapper = Styled.div` export const InterestButton = Styled(Button)<{ order: number }>` ${theme('font.subhead4')} - background-color : ${(props) => + border: solid 1px ${palette('grayscale', 4)}; + ${(props) => props.order == 0 - ? `${palette('primary', 0)}` + ? css` + background-color: ${palette('primary', 0)}; + border-color: ${palette('primary', 0)}; + ` : props.order == 1 - ? `${palette('primary', 3)}` + ? css` + background-color: ${palette('primary', 3)}; + border-color: ${palette('primary', 3)}; + ` : props.order == 2 - ? `${palette('primary', 2)}` + ? css` + background-color: ${palette('primary', 2)}; + border-color: ${palette('primary', 2)}; + ` : props.order == 3 - ? `${palette('primary', 5)}` + ? css` + background-color: ${palette('primary', 5)}; + border-color: ${palette('primary', 5)}; + ` : props.order == 4 - ? `${palette('primary', 4)}` - : `${palette('grayscale', 0)}`}}; + ? css` + background-color: ${palette('primary', 4)}; + border-color: ${palette('primary', 4)}; + ` + : css` + background-color: ${palette('grayscale', 0)}; + border-color: ${palette('grayscale', 4)}; + `}}; padding : 12px 30px; margin : 12px 5px; height : 48px; border-radius: 60px; - border: solid 1px ${palette('grayscale', 4)}; - border-color : ${(props) => - props.order == 0 - ? `${palette('primary', 0)}` - : props.order == 1 - ? `${palette('primary', 3)}` - : props.order == 2 - ? `${palette('primary', 2)}` - : props.order == 3 - ? `${palette('primary', 5)}` - : props.order == 4 - ? `${palette('primary', 4)}` - : `${palette('grayscale', 0)}`}}; - color : ${(props) => (props.order == -1 ? `${palette('grayscale', 4)}` : `${palette('grayscale', 0)}`)} + ${(props) => + props.order == -1 + ? css` + color: ${palette('grayscale', 4)}; + ` + : css` + color: ${palette('grayscale', 0)}; + `}; ; `; @@ -53,8 +66,14 @@ export const ModalButton = Styled(Button)<{ selectedInterest: string[] }>` ${theme('font.subhead3')} color : ${palette('grayscale', 0)}; margin-top : 38px; - background-color : ${(props) => - props.selectedInterest.length > 0 ? `${palette('grayscale', 9)}` : `${palette('grayscale', 1)}`}; + ${(props) => + props.selectedInterest.length > 0 + ? css` + background-color: ${palette('grayscale', 9)}; + ` + : css` + background-color: ${palette('grayscale', 1)}; + `}; `; export const ModalLabel = Styled(Label)` @@ -95,11 +114,14 @@ export const JoinButton = Styled(Button)<{ isButtonDisabled: boolean }>` font-weight : bold; color : ${palette('grayscale', 0)}; margin-top : 60px; - background-color : ${(props) => (props.isButtonDisabled ? `${palette('grayscale', 1)}` : undefined)}; - background-image : ${(props) => - !props.isButtonDisabled - ? `linear-gradient(to right, ${palette('primary', 3)},${palette('primary', 0)} )` - : undefined}; + ${(props) => + props.isButtonDisabled + ? css` + background-color: ${palette('grayscale', 1)}; + ` + : css` + background-image: linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + `}; `; export const JoinWrap = Styled.div` diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index 70e1c33b..35d467f2 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -24,7 +24,6 @@ import { BadgeCard, SpeakerExpCard } from 'components/molecules'; import React, { useEffect, useState } from 'react'; import Reveal from 'react-awesome-reveal'; import { Link } from 'react-router-dom'; -import Styled from 'styled-components'; import { BadgeWrapper, ChallengeBtn, @@ -41,6 +40,7 @@ import { ConcertWrapper, ConcertWrapper1, ConcertWrapper2, + HomeContainer, LinkBtn, LinkCardWrapper, LinkExp, @@ -85,7 +85,7 @@ function Home(): React.ReactElement { }, []); return ( - + O2 @@ -321,20 +321,4 @@ function Home(): React.ReactElement { ); } -const HomeContainer = Styled.div` - display : flex; - flex-direction : column; - align-items : center; - background-image: url('${LandingBackImg}'); - background-repeat: no-repeat; - background-size: cover; - background-position: center; - min-height: 6114px; - overflow-x: hidden; - img{ - margin : 0; - padding : 0; - } -`; - export default Home; diff --git a/src/pages/Home/style.ts b/src/pages/Home/style.ts index 55447337..ddae30e8 100644 --- a/src/pages/Home/style.ts +++ b/src/pages/Home/style.ts @@ -1,5 +1,5 @@ import { Button } from 'components/atoms'; -import Styled from 'styled-components'; +import Styled, { css } from 'styled-components'; import { palette, theme } from 'styled-tools'; export const TopWrapper = Styled.div` @@ -7,6 +7,25 @@ export const TopWrapper = Styled.div` width : 1109px; `; +export const HomeContainer = Styled.div<{ image: string }>` + display : flex; + flex-direction : column; + align-items : center; + ${(props) => + css` + background-image: url('${props.image}'); + `} + background-repeat: no-repeat; + background-size: cover; + background-position: center; + min-height: 6114px; + overflow-x: hidden; + img{ + margin : 0; + padding : 0; + } +`; + export const O2Title = Styled.h1` font-size: 90px; font-weight: bold; From 0e5bd35d1cfbc1c27d1370002c87882c3e8d2874 Mon Sep 17 00:00:00 2001 From: Subin Date: Mon, 9 Aug 2021 22:19:04 +0900 Subject: [PATCH 41/80] =?UTF-8?q?Refactor:=20Login=20Page=20=ED=85=9C?= =?UTF-8?q?=ED=94=8C=EB=A6=BF=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/LoginForm/index.tsx | 113 ------------------ src/components/molecules/LoginForm/style.ts | 19 --- src/components/molecules/index.ts | 2 +- src/components/organisms/Login/index.tsx | 25 ---- src/components/organisms/LoginForm/index.tsx | 43 +++++++ src/components/organisms/LoginForm/style.ts | 9 ++ src/components/organisms/index.ts | 2 +- src/pages/Login/index.tsx | 94 ++++++++++++++- src/pages/Login/template/index.tsx | 42 ++++++- .../Login => pages/Login/template}/style.ts | 11 ++ 10 files changed, 195 insertions(+), 165 deletions(-) delete mode 100644 src/components/molecules/LoginForm/index.tsx delete mode 100644 src/components/molecules/LoginForm/style.ts delete mode 100644 src/components/organisms/Login/index.tsx create mode 100644 src/components/organisms/LoginForm/index.tsx create mode 100644 src/components/organisms/LoginForm/style.ts rename src/{components/organisms/Login => pages/Login/template}/style.ts (77%) diff --git a/src/components/molecules/LoginForm/index.tsx b/src/components/molecules/LoginForm/index.tsx deleted file mode 100644 index 4dedf1fc..00000000 --- a/src/components/molecules/LoginForm/index.tsx +++ /dev/null @@ -1,113 +0,0 @@ -import { getUserData, postLogin } from 'apis'; -import { StyledInput } from 'components/atoms'; -import React, { useEffect, useState } from 'react'; -import { useHistory } from 'react-router-dom'; -import { useRecoilState } from 'recoil'; -import { userState, userStatusState } from 'stores/user'; -import { LoginBtn, LoginformWrap } from './style'; - -function LoginForm(): React.ReactElement { - const history = useHistory(); - const [loginData, setLoginData] = useState({ - // 값 저장 - email: '', - password: '', - }); - const [userStatusData, setUserStatusData] = useRecoilState(userStatusState); - const [userData, setUserData] = useRecoilState(userState); - const [isConditionMet, setIsConditionMet] = useState({ - email: true, - pwd: true, - }); - const errMsg = { - email: '가입되지 않은 이메일입니다', - pwd: '비밀번호를 다시 확인해 주세요', - }; - - const handleLoginBtn = async () => { - const token = await getUserStatusData(); - const isSuccess = await getUserDetailData(token); - isSuccess && history.push('/'); - }; - useEffect(() => { - if (userStatusData && userData) { - alert('이미 로그인이 되어있습니다. '); - history.push('/'); - } - }, []); - - const getUserStatusData = async () => { - const data = await postLogin(loginData); - if (data) { - if (data.status === 200) { - setUserStatusData({ - token: data.token, - userType: data.data.userState, - totalGeneration: data.data.totalGeneration, - registGeneration: data.data.registGeneration, - progressGeneration: data.data.progressGeneration ? data.data.progressGeneration : 0, - }); - return data.token; - } else { - if (data.message === '아이디가 존재하지 않습니다') { - setIsConditionMet({ email: false, pwd: true }); - } else if (data.message === '비밀번호가 틀렸습니다') { - setIsConditionMet({ email: true, pwd: false }); - } - } - } else { - alert('네트워크가 좋지 않습니다'); - } - return ''; - }; - const getUserDetailData = async (token: string): Promise => { - if (token) { - const data = await getUserData(token); - if (data !== undefined) { - setUserData({ - interest: data.interest, - marpolicy: data.marpolicy, - img: data.img, - _id: data._id, - email: data.email, - nickname: data.nickname, - gender: data.gender, - }); - return true; - } else { - alert('네트워크가 좋지 않습니다'); - } - } - return false; - }; - - return ( - - { - if (typeof value === 'string') setLoginData({ ...loginData, email: value }); - }} - isConditionMet={isConditionMet.email} - errorMsg={errMsg.email} - /> - { - if (typeof value === 'string') setLoginData({ ...loginData, password: value }); - }} - isConditionMet={isConditionMet.pwd} - errorMsg={errMsg.pwd} - /> - 로그인 - - ); -} - -export default LoginForm; diff --git a/src/components/molecules/LoginForm/style.ts b/src/components/molecules/LoginForm/style.ts deleted file mode 100644 index 23206050..00000000 --- a/src/components/molecules/LoginForm/style.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Button } from 'components/atoms'; -import Styled from 'styled-components'; -import { palette } from 'styled-tools'; - -export const LoginformWrap = Styled.div` - display : flex; - flex-direction : column; - align-items : center; -`; -export const LoginBtn = Styled(Button)` - margin-top : 14px; - border-radius: 4px; - background-image: linear-gradient(to right, ${palette('primary', 3)},${palette('primary', 0)} ); - width: 406px; - height: 60px; - color : ${palette('grayscale', 0)}; - font-size : 16px; - font-weight : bold; -`; diff --git a/src/components/molecules/index.ts b/src/components/molecules/index.ts index 244e7243..31c1ef73 100644 --- a/src/components/molecules/index.ts +++ b/src/components/molecules/index.ts @@ -33,7 +33,7 @@ export { default as FindPwdForm } from './FindPwdForm'; export { default as HamDropDown } from './HamDropDown'; export { default as JoinCheck } from './JoinCheck'; export { default as JoinForm } from './JoinForm'; -export { default as LoginForm } from './LoginForm'; +export { default as LoginForm } from '../organisms/LoginForm'; export { default as LoginModal } from './LoginModal'; export { default as MyPageConcertCard } from './MyPageConcertCard'; export { default as MyPageSection } from './MyPageSection'; diff --git a/src/components/organisms/Login/index.tsx b/src/components/organisms/Login/index.tsx deleted file mode 100644 index d991aecb..00000000 --- a/src/components/organisms/Login/index.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { LineIcon } from 'assets/images'; -import { Link } from 'components/atoms'; -import { LoginForm } from 'components/molecules'; -import React from 'react'; -import { ButtonWrapper, FindPwdBtn, JoinBtn, Line, LoginContainer, LoginLabel } from './style'; - -function CLogin(): React.ReactElement { - return ( - - 로그인 - - - - 비밀번호 찾기 - - - - 회원가입 - - - - ); -} - -export default CLogin; diff --git a/src/components/organisms/LoginForm/index.tsx b/src/components/organisms/LoginForm/index.tsx new file mode 100644 index 00000000..56b7b07c --- /dev/null +++ b/src/components/organisms/LoginForm/index.tsx @@ -0,0 +1,43 @@ +import { StyledInput } from 'components/atoms'; +import React from 'react'; +import { LoginformWrap } from './style'; + +interface IProps { + idInputChange: (value: string | number) => void; + pwdInputChange: (value: string | number) => void; + isConditionMet: { + email: boolean; + pwd: boolean; + }; +} +const errMsg = { + email: '가입되지 않은 이메일입니다', + pwd: '비밀번호를 다시 확인해 주세요', +}; + +function LoginForm({ idInputChange, isConditionMet, pwdInputChange }: IProps): React.ReactElement { + return ( + + + + + ); +} + +export default LoginForm; diff --git a/src/components/organisms/LoginForm/style.ts b/src/components/organisms/LoginForm/style.ts new file mode 100644 index 00000000..7d2ace9e --- /dev/null +++ b/src/components/organisms/LoginForm/style.ts @@ -0,0 +1,9 @@ +import { Button } from 'components/atoms'; +import Styled from 'styled-components'; +import { palette } from 'styled-tools'; + +export const LoginformWrap = Styled.div` + display : flex; + flex-direction : column; + align-items : center; +`; diff --git a/src/components/organisms/index.ts b/src/components/organisms/index.ts index 6e681b9c..bed13cf6 100644 --- a/src/components/organisms/index.ts +++ b/src/components/organisms/index.ts @@ -14,7 +14,7 @@ export { default as Footer } from './Footer'; export { default as Hamburger } from './Hamburger'; export { default as Header } from './Header'; export { default as Join } from './Join'; -export { default as Login } from './Login'; +export { default as Login } from '../../pages/Login/template'; export { default as MyCommentList } from './MyCommentList'; export { default as MyPageHeader } from './MyPageHeader'; export { default as NoticeCommentList } from './NoticeCommentList'; diff --git a/src/pages/Login/index.tsx b/src/pages/Login/index.tsx index fdf97a1b..7434a6ab 100644 --- a/src/pages/Login/index.tsx +++ b/src/pages/Login/index.tsx @@ -1,8 +1,96 @@ -import { Login as CLogin } from 'components/organisms'; -import React from 'react'; +import { getUserData, postLogin } from 'apis'; +import React, { useEffect, useState } from 'react'; +import { useHistory } from 'react-router-dom'; +import { useRecoilState } from 'recoil'; +import { userState, userStatusState } from 'stores/user'; +import LoginTemplate from './template'; function Login(): React.ReactElement { - return ; + const history = useHistory(); + const [loginData, setLoginData] = useState({ + // 값 저장 + email: '', + password: '', + }); + const [userStatusData, setUserStatusData] = useRecoilState(userStatusState); + const [userData, setUserData] = useRecoilState(userState); + const [isConditionMet, setIsConditionMet] = useState({ + email: true, + pwd: true, + }); + + const idInputChange = (value: string | number) => { + if (typeof value === 'string') setLoginData({ ...loginData, email: value }); + }; + const pwdInputChange = (value: string | number) => { + if (typeof value === 'string') setLoginData({ ...loginData, password: value }); + }; + + const handleLoginBtn = async () => { + const token = await getUserStatusData(); + const isSuccess = await getUserDetailData(token); + isSuccess && history.push('/'); + }; + useEffect(() => { + if (userStatusData && userData) { + alert('이미 로그인이 되어있습니다. '); + history.push('/'); + } + }, []); + + const getUserStatusData = async () => { + const data = await postLogin(loginData); + if (data) { + if (data.status === 200) { + setUserStatusData({ + token: data.token, + userType: data.data.userState, + totalGeneration: data.data.totalGeneration, + registGeneration: data.data.registGeneration, + progressGeneration: data.data.progressGeneration ? data.data.progressGeneration : 0, + }); + return data.token; + } else { + if (data.message === '아이디가 존재하지 않습니다') { + setIsConditionMet({ email: false, pwd: true }); + } else if (data.message === '비밀번호가 틀렸습니다') { + setIsConditionMet({ email: true, pwd: false }); + } + } + } else { + alert('네트워크가 좋지 않습니다'); + } + return ''; + }; + const getUserDetailData = async (token: string): Promise => { + if (token) { + const data = await getUserData(token); + if (data !== undefined) { + setUserData({ + interest: data.interest, + marpolicy: data.marpolicy, + img: data.img, + _id: data._id, + email: data.email, + nickname: data.nickname, + gender: data.gender, + }); + return true; + } else { + alert('네트워크가 좋지 않습니다'); + } + } + return false; + }; + return ( + + ); } export default Login; diff --git a/src/pages/Login/template/index.tsx b/src/pages/Login/template/index.tsx index f08922a7..9bfaff0a 100644 --- a/src/pages/Login/template/index.tsx +++ b/src/pages/Login/template/index.tsx @@ -1,7 +1,43 @@ +import { LineIcon } from 'assets/images'; +import { Link } from 'components/atoms'; +import { LoginForm } from 'components/molecules'; import React from 'react'; +import { ButtonWrapper, FindPwdBtn, JoinBtn, Line, LoginBtn, LoginContainer, LoginLabel } from './style'; -function Login(): React.ReactElement { - return
    Login
    ; +interface IProps { + getUserDetailData: (token: string) => Promise; + handleLoginBtn: () => Promise; + idInputChange: (value: string | number) => void; + pwdInputChange: (value: string | number) => void; + isConditionMet: { + email: boolean; + pwd: boolean; + }; } -export default Login; +function LoginTemplate({ + getUserDetailData, + handleLoginBtn, + idInputChange, + pwdInputChange, + isConditionMet, +}: IProps): React.ReactElement { + return ( + + 로그인 + + 로그인 + + + 비밀번호 찾기 + + + + 회원가입 + + + + ); +} + +export default LoginTemplate; diff --git a/src/components/organisms/Login/style.ts b/src/pages/Login/template/style.ts similarity index 77% rename from src/components/organisms/Login/style.ts rename to src/pages/Login/template/style.ts index ce08f4e9..40d4dc8c 100644 --- a/src/components/organisms/Login/style.ts +++ b/src/pages/Login/template/style.ts @@ -9,6 +9,17 @@ height : 16px; object-fit : contain; `; +export const LoginBtn = Styled(Button)` + margin-top : 14px; + border-radius: 4px; + background-image: linear-gradient(to right, ${palette('primary', 3)},${palette('primary', 0)} ); + width: 406px; + height: 60px; + color : ${palette('grayscale', 0)}; + font-size : 16px; + font-weight : bold; +`; + export const JoinBtn = Styled(Button)` margin-left : 15px; line-height : 1.5; From b64a606dc19eda468eb291c3d02aa14850d0754f Mon Sep 17 00:00:00 2001 From: Subin Date: Mon, 9 Aug 2021 23:30:49 +0900 Subject: [PATCH 42/80] =?UTF-8?q?Refactor:=20=EA=B4=80=EC=8B=AC=EB=B6=84?= =?UTF-8?q?=EC=95=BC=EB=AA=A8=EB=8B=AC=20=EB=AA=A8=EB=93=88=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organisms/InterestModal/index.tsx | 65 +++++++++++++++++++ .../{Join => InterestModal}/style.ts | 32 --------- 2 files changed, 65 insertions(+), 32 deletions(-) create mode 100644 src/components/organisms/InterestModal/index.tsx rename src/components/organisms/{Join => InterestModal}/style.ts (77%) diff --git a/src/components/organisms/InterestModal/index.tsx b/src/components/organisms/InterestModal/index.tsx new file mode 100644 index 00000000..c64f22e7 --- /dev/null +++ b/src/components/organisms/InterestModal/index.tsx @@ -0,0 +1,65 @@ +import { Modal } from 'components/atoms'; +import React from 'react'; +import { interestList } from 'resources/string'; +import { InterestButton, InterestButtonWrapper, ModalButton, ModalLabel, ModalWrapper } from './style'; + +interface IProps { + isInterestModalOpen: boolean; + setIsInterestModalOpen: (value: boolean) => void; + handleInterestOnClick: (interest: string) => void; + selectedInterest: string[]; + modalBtnHandler: () => void; +} + +function InterestModal({ + isInterestModalOpen, + setIsInterestModalOpen, + handleInterestOnClick, + selectedInterest, + modalBtnHandler, +}: IProps): React.ReactElement { + return ( + + + 관심있는 분야를 5개 선택해 주세요 + + {interestList.map((interest, id) => { + const handleOnClick = () => { + handleInterestOnClick(interest); + }; + return ( + + {interest} + + ); + })} + + 0 ? false : true} + onClick={modalBtnHandler} + > +
    확인 ({selectedInterest.length}/5)
    +
    +
    +
    + ); +} + +export default InterestModal; diff --git a/src/components/organisms/Join/style.ts b/src/components/organisms/InterestModal/style.ts similarity index 77% rename from src/components/organisms/Join/style.ts rename to src/components/organisms/InterestModal/style.ts index 23094092..618cd897 100644 --- a/src/components/organisms/Join/style.ts +++ b/src/components/organisms/InterestModal/style.ts @@ -99,35 +99,3 @@ export const ModalWrapper = Styled.div` flex-direction : column; align-items : center; `; - -export const JoinLabel = Styled(Label)` - font-size: 40px; - font-weight: bold; - margin-bottom : 20px; -`; - -export const JoinButton = Styled(Button)<{ isButtonDisabled: boolean }>` - width: 406px; - height: 60px; - border-radius: 4px; - font-size : 16px; - font-weight : bold; - color : ${palette('grayscale', 0)}; - margin-top : 60px; - ${(props) => - props.isButtonDisabled - ? css` - background-color: ${palette('grayscale', 1)}; - ` - : css` - background-image: linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); - `}; -`; - -export const JoinWrap = Styled.div` - display : flex; - flex-direction : column; - align-items : center; - margin-top : 100px; - margin-bottom : 250px; -`; From 6bb8f9d28b863bfe9a969243d03e4d65a2b7d579 Mon Sep 17 00:00:00 2001 From: Subin Date: Mon, 9 Aug 2021 23:34:18 +0900 Subject: [PATCH 43/80] =?UTF-8?q?Refactor:=20molecules,=20organisms=20?= =?UTF-8?q?=EC=9D=B8=EB=8D=B1=EC=8A=A4=20=EC=A3=BC=EC=86=8C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/index.ts | 3 --- src/components/organisms/index.ts | 6 ++++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/molecules/index.ts b/src/components/molecules/index.ts index 31c1ef73..80a45abe 100644 --- a/src/components/molecules/index.ts +++ b/src/components/molecules/index.ts @@ -31,9 +31,6 @@ export { default as DropDownMulti } from './DropDownMulti'; export { default as EditorForm } from './EditorForm'; export { default as FindPwdForm } from './FindPwdForm'; export { default as HamDropDown } from './HamDropDown'; -export { default as JoinCheck } from './JoinCheck'; -export { default as JoinForm } from './JoinForm'; -export { default as LoginForm } from '../organisms/LoginForm'; export { default as LoginModal } from './LoginModal'; export { default as MyPageConcertCard } from './MyPageConcertCard'; export { default as MyPageSection } from './MyPageSection'; diff --git a/src/components/organisms/index.ts b/src/components/organisms/index.ts index bed13cf6..1ba4bf3e 100644 --- a/src/components/organisms/index.ts +++ b/src/components/organisms/index.ts @@ -13,8 +13,10 @@ export { default as FindPwd } from './FindPwd'; export { default as Footer } from './Footer'; export { default as Hamburger } from './Hamburger'; export { default as Header } from './Header'; -export { default as Join } from './Join'; -export { default as Login } from '../../pages/Login/template'; +export { default as InterestModal } from './InterestModal'; +export { default as JoinCheck } from './JoinCheck'; +export { default as JoinForm } from './JoinForm'; +export { default as LoginForm } from './LoginForm'; export { default as MyCommentList } from './MyCommentList'; export { default as MyPageHeader } from './MyPageHeader'; export { default as NoticeCommentList } from './NoticeCommentList'; From a9639fc2daa9949a3b1fc25421deeb88ae69bf8b Mon Sep 17 00:00:00 2001 From: Subin Date: Mon, 9 Aug 2021 23:35:03 +0900 Subject: [PATCH 44/80] =?UTF-8?q?Refactor:=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20props=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Login/index.tsx | 1 - src/pages/Login/template/index.tsx | 11 ++--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/pages/Login/index.tsx b/src/pages/Login/index.tsx index 7434a6ab..13b44c3d 100644 --- a/src/pages/Login/index.tsx +++ b/src/pages/Login/index.tsx @@ -84,7 +84,6 @@ function Login(): React.ReactElement { }; return ( Promise; handleLoginBtn: () => Promise; idInputChange: (value: string | number) => void; pwdInputChange: (value: string | number) => void; @@ -15,13 +14,7 @@ interface IProps { }; } -function LoginTemplate({ - getUserDetailData, - handleLoginBtn, - idInputChange, - pwdInputChange, - isConditionMet, -}: IProps): React.ReactElement { +function LoginTemplate({ handleLoginBtn, idInputChange, pwdInputChange, isConditionMet }: IProps): React.ReactElement { return ( 로그인 From 5f31c669cba2d354ff8c81a278086eb68aa5e894 Mon Sep 17 00:00:00 2001 From: Subin Date: Mon, 9 Aug 2021 23:35:30 +0900 Subject: [PATCH 45/80] =?UTF-8?q?Refactor:=20Join=20Page=20=ED=85=9C?= =?UTF-8?q?=ED=94=8C=EB=A6=BF=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/organisms/Join/index.tsx | 151 ------------------ .../JoinCheck/index.tsx | 0 .../JoinCheck/style.ts | 0 .../JoinForm/index.tsx | 29 +--- .../JoinForm/style.ts | 0 src/pages/Join/index.tsx | 112 ++++++++++++- src/pages/Join/template/index.tsx | 70 +++++++- src/pages/Join/template/style.ts | 42 +++++ src/types/join.type.ts | 11 ++ 9 files changed, 230 insertions(+), 185 deletions(-) delete mode 100644 src/components/organisms/Join/index.tsx rename src/components/{molecules => organisms}/JoinCheck/index.tsx (100%) rename src/components/{molecules => organisms}/JoinCheck/style.ts (100%) rename src/components/{molecules => organisms}/JoinForm/index.tsx (83%) rename src/components/{molecules => organisms}/JoinForm/style.ts (100%) create mode 100644 src/pages/Join/template/style.ts diff --git a/src/components/organisms/Join/index.tsx b/src/components/organisms/Join/index.tsx deleted file mode 100644 index d0337c7c..00000000 --- a/src/components/organisms/Join/index.tsx +++ /dev/null @@ -1,151 +0,0 @@ -import { postJoin } from 'apis'; -import { Modal } from 'components/atoms'; -import { JoinForm } from 'components/molecules'; -import React, { useEffect, useState } from 'react'; -import { useHistory } from 'react-router-dom'; -import { interestList } from 'resources/string'; -import { - InterestButton, - InterestButtonWrapper, - JoinButton, - JoinLabel, - JoinWrap, - ModalButton, - ModalLabel, - ModalWrapper, -} from './style'; - -function CJoin(): React.ReactElement { - const history = useHistory(); - const [isButtonDisabled, setIsButtonDisabled] = useState(true); - const [isInterestModalOpen, setIsInterestModalOpen] = useState(false); - const [isConditionMet, setIsConditionMet] = useState({ - email: false, - password: false, - passwordCheck: false, - nickname: false, - interest: false, - policyMust: false, - gender: false, - }); - const [userData, setUserData] = useState({ - email: '', - password: '', - passwordCheck: '', - nickname: '', - gender: -1, - interest: [''], - marpolicy: false, - policyMust: false, - }); - const [selectedInterest, setSelectedInterest] = useState([]); - const handleInterestOnClick = (interest: string) => { - if (selectedInterest.length === 0) { - setSelectedInterest([interest]); - } - if (selectedInterest.length < 5) { - if (!selectedInterest.includes(interest)) { - setSelectedInterest([...selectedInterest, interest]); - } else { - setSelectedInterest(selectedInterest.filter((v) => v !== interest)); - } - } else { - if (selectedInterest.includes(interest)) { - setSelectedInterest(selectedInterest.filter((v) => v !== interest)); - } - } - }; - const modalBtnHandler = async () => { - //여기서 api호출!! - const postData = { - email: userData.email, - password: userData.password, - nickname: userData.nickname, - interest: userData.interest, - gender: userData.gender, - marpolicy: userData.marpolicy, - }; - const getData = await postJoin(postData); - if (getData) { - history.push('/'); - } - }; - const joinBtnHandler = () => { - setIsInterestModalOpen(true); - }; - useEffect(() => { - setUserData({ ...userData, interest: selectedInterest }); - }, [selectedInterest]); - - useEffect(() => { - if ( - isConditionMet.email && - isConditionMet.password && - isConditionMet.passwordCheck && - isConditionMet.nickname && - isConditionMet.gender && - isConditionMet.policyMust - ) { - setIsButtonDisabled(false); - } else { - setIsButtonDisabled(true); - } - }, [isConditionMet]); - - return ( - - 회원가입 - - - 가입 완료 - - - - 관심있는 분야를 5개 선택해 주세요 - - {interestList.map((interest, id) => { - const handleOnClick = () => { - handleInterestOnClick(interest); - }; - return ( - - {interest} - - ); - })} - - 0 ? false : true} - onClick={modalBtnHandler} - > -
    확인 ({selectedInterest.length}/5)
    -
    -
    -
    -
    - ); -} - -export default CJoin; diff --git a/src/components/molecules/JoinCheck/index.tsx b/src/components/organisms/JoinCheck/index.tsx similarity index 100% rename from src/components/molecules/JoinCheck/index.tsx rename to src/components/organisms/JoinCheck/index.tsx diff --git a/src/components/molecules/JoinCheck/style.ts b/src/components/organisms/JoinCheck/style.ts similarity index 100% rename from src/components/molecules/JoinCheck/style.ts rename to src/components/organisms/JoinCheck/style.ts diff --git a/src/components/molecules/JoinForm/index.tsx b/src/components/organisms/JoinForm/index.tsx similarity index 83% rename from src/components/molecules/JoinForm/index.tsx rename to src/components/organisms/JoinForm/index.tsx index 2b3dd1cc..8ba463b7 100644 --- a/src/components/molecules/JoinForm/index.tsx +++ b/src/components/organisms/JoinForm/index.tsx @@ -1,6 +1,5 @@ import { StyledInput } from 'components/atoms'; -import { DropDown, JoinCheck } from 'components/molecules'; -import React, { useEffect, useState } from 'react'; +import React, { useEffect } from 'react'; import { IJoinConditionMet } from 'types/join.type'; import { IUserDataType } from 'types/user.type'; import { SubTitle, Wrapper } from './style'; @@ -14,22 +13,6 @@ export interface IProps { } function JoinForm({ isConditionMet, userData, setUserData, setIsConditionMet }: IProps): React.ReactElement { - const [gender, setGender] = useState('선택안함'); - const changeGenderStringtoNum = (gender: string) => { - switch (gender) { - case '남성': - return 0; - case '여성': - return 1; - default: - return 2; - } - }; - - useEffect(() => { - setUserData({ ...userData, gender: changeGenderStringtoNum(gender) }); - }, [gender]); - //입력값이 달라질때마다 조건 충족여부 파악하는 useEffect useEffect(() => { if (userData.email.includes('@')) { @@ -123,16 +106,6 @@ function JoinForm({ isConditionMet, userData, setUserData, setIsConditionMet }: }} isConditionMet={isConditionMet.nickname} /> - 성별 - - 약관동의 -
    ); } diff --git a/src/components/molecules/JoinForm/style.ts b/src/components/organisms/JoinForm/style.ts similarity index 100% rename from src/components/molecules/JoinForm/style.ts rename to src/components/organisms/JoinForm/style.ts diff --git a/src/pages/Join/index.tsx b/src/pages/Join/index.tsx index ba8813aa..43534ada 100644 --- a/src/pages/Join/index.tsx +++ b/src/pages/Join/index.tsx @@ -1,10 +1,116 @@ -import { Join as CJoin } from 'components/organisms'; -import React from 'react'; +import { postJoin } from 'apis'; +import React, { useEffect, useState } from 'react'; +import { useHistory } from 'react-router-dom'; +import JoinTemplate from './template'; function Join(): React.ReactElement { + const history = useHistory(); + const [isJoinButtonDisabled, setIsJoinButtonDisabled] = useState(true); + const [isInterestModalOpen, setIsInterestModalOpen] = useState(false); + const [isConditionMet, setIsConditionMet] = useState({ + email: false, + password: false, + passwordCheck: false, + nickname: false, + interest: false, + policyMust: false, + gender: false, + }); + const [userData, setUserData] = useState({ + email: '', + password: '', + passwordCheck: '', + nickname: '', + gender: -1, + interest: [''], + marpolicy: false, + policyMust: false, + }); + const [gender, setGender] = useState('선택안함'); + const [selectedInterest, setSelectedInterest] = useState([]); + const handleInterestOnClick = (interest: string) => { + if (selectedInterest.length === 0) { + setSelectedInterest([interest]); + } + if (selectedInterest.length < 5) { + if (!selectedInterest.includes(interest)) { + setSelectedInterest([...selectedInterest, interest]); + } else { + setSelectedInterest(selectedInterest.filter((v) => v !== interest)); + } + } else { + if (selectedInterest.includes(interest)) { + setSelectedInterest(selectedInterest.filter((v) => v !== interest)); + } + } + }; + const modalBtnHandler = async () => { + //여기서 api호출!! + const postData = { + email: userData.email, + password: userData.password, + nickname: userData.nickname, + interest: userData.interest, + gender: userData.gender, + marpolicy: userData.marpolicy, + }; + const getData = await postJoin(postData); + if (getData) { + history.push('/'); + } + }; + const joinBtnHandler = () => { + setIsInterestModalOpen(true); + }; + const changeGenderStringtoNum = (gender: string) => { + switch (gender) { + case '남성': + return 0; + case '여성': + return 1; + default: + return 2; + } + }; + useEffect(() => { + setUserData({ ...userData, interest: selectedInterest }); + }, [selectedInterest]); + useEffect(() => { + setUserData({ ...userData, gender: changeGenderStringtoNum(gender) }); + }, [gender]); + + useEffect(() => { + if ( + isConditionMet.email && + isConditionMet.password && + isConditionMet.passwordCheck && + isConditionMet.nickname && + isConditionMet.gender && + isConditionMet.policyMust + ) { + setIsJoinButtonDisabled(false); + } else { + setIsJoinButtonDisabled(true); + } + }, [isConditionMet]); + return ( <> - + ); } diff --git a/src/pages/Join/template/index.tsx b/src/pages/Join/template/index.tsx index 4929a371..cbc6783b 100644 --- a/src/pages/Join/template/index.tsx +++ b/src/pages/Join/template/index.tsx @@ -1,7 +1,71 @@ +import { DropDown } from 'components/molecules'; +import { InterestModal, JoinCheck, JoinForm } from 'components/organisms'; import React from 'react'; +import { IJoinConditionMet, IJoinData } from 'types/join.type'; +import { JoinButton, JoinLabel, JoinWrap, SubTitle } from './style'; -function Join(): React.ReactElement { - return
    Join
    ; +interface IProps { + isConditionMet: IJoinConditionMet; + setIsConditionMet: (value: IJoinConditionMet) => void; + userData: IJoinData; + setUserData: (value: IJoinData) => void; + isJoinButtonDisabled: boolean; + joinBtnHandler: () => void; + isInterestModalOpen: boolean; + setIsInterestModalOpen: (value: boolean) => void; + handleInterestOnClick: (interest: string) => void; + selectedInterest: string[]; + modalBtnHandler: () => Promise; + gender: string; + setGender: (gender: string) => void; } -export default Join; +function JoinTemplate({ + isConditionMet, + setIsConditionMet, + userData, + setUserData, + isJoinButtonDisabled, + joinBtnHandler, + isInterestModalOpen, + setIsInterestModalOpen, + handleInterestOnClick, + selectedInterest, + modalBtnHandler, + gender, + setGender, +}: IProps): React.ReactElement { + return ( + + 회원가입 + + 성별 + + 약관동의 + + + 가입 완료 + + + + ); +} + +export default JoinTemplate; diff --git a/src/pages/Join/template/style.ts b/src/pages/Join/template/style.ts new file mode 100644 index 00000000..20ccca9a --- /dev/null +++ b/src/pages/Join/template/style.ts @@ -0,0 +1,42 @@ +import { Button, Label } from 'components/atoms'; +import Styled, { css } from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const JoinLabel = Styled(Label)` + font-size: 40px; + font-weight: bold; + margin-bottom : 20px; +`; + +export const SubTitle = Styled.div` + ${theme('font.subhead4')} + margin-top : 40px; + margin-bottom : 8px; + width : 406px; +`; + +export const JoinButton = Styled(Button)<{ isButtonDisabled: boolean }>` + width: 406px; + height: 60px; + border-radius: 4px; + font-size : 16px; + font-weight : bold; + color : ${palette('grayscale', 0)}; + margin-top : 60px; + ${(props) => + props.isButtonDisabled + ? css` + background-color: ${palette('grayscale', 1)}; + ` + : css` + background-image: linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + `}; +`; + +export const JoinWrap = Styled.div` + display : flex; + flex-direction : column; + align-items : center; + margin-top : 100px; + margin-bottom : 250px; +`; diff --git a/src/types/join.type.ts b/src/types/join.type.ts index df9974f6..8f1e773e 100644 --- a/src/types/join.type.ts +++ b/src/types/join.type.ts @@ -16,3 +16,14 @@ export interface IJoin { gender: number; marpolicy: boolean; } + +export interface IJoinData { + email: string; + password: string; + passwordCheck: string; + nickname: string; + gender: number; + interest: string[]; + marpolicy: boolean; + policyMust: boolean; +} From b680defdaf23cd71fa14527222460a4b47846ac4 Mon Sep 17 00:00:00 2001 From: Subin Date: Tue, 10 Aug 2021 00:19:36 +0900 Subject: [PATCH 46/80] =?UTF-8?q?Refactor:=20AdminChallengeList=20?= =?UTF-8?q?=ED=85=9C=ED=94=8C=EB=A6=BF=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organisms/AdminChallengeList/index.tsx | 50 ------------------- src/components/organisms/index.ts | 1 - src/pages/AdminChallengeList/index.tsx | 22 ++++++-- .../AdminChallengeList/template/index.tsx | 37 ++++++++++++-- .../AdminChallengeList/template}/style.ts | 0 5 files changed, 53 insertions(+), 57 deletions(-) delete mode 100644 src/components/organisms/AdminChallengeList/index.tsx rename src/{components/organisms/AdminChallengeList => pages/AdminChallengeList/template}/style.ts (100%) diff --git a/src/components/organisms/AdminChallengeList/index.tsx b/src/components/organisms/AdminChallengeList/index.tsx deleted file mode 100644 index c05a8265..00000000 --- a/src/components/organisms/AdminChallengeList/index.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { getChallengeList } from 'apis'; -import { GreydfPlusIcon as PlusIcon } from 'assets/images'; -import { AdminChallengeCard } from 'components/molecules'; -import React, { useEffect, useState } from 'react'; -import { Link } from 'react-router-dom'; -import { useRecoilValue } from 'recoil'; -import { userStatusState } from 'stores/user'; -import { IAdminChallenge } from 'types/admin.type'; -import { AddCard, AddExp, AddImage, ListContainer, PageLabel, Title, Wrapper } from './style'; - -function AdminChallengeList(): React.ReactElement { - const userStatusData = useRecoilValue(userStatusState); - const [challengeDataList, setChallengeDataList] = useState(null); - - useEffect(() => { - if (userStatusData) getChallengeDataList(userStatusData.token, 30, 0); - else alert('로그인 후 이용하세요'); - }, [userStatusData]); - - const getChallengeDataList = async (token: string, limit: number, offset: number): Promise => { - const data = await getChallengeList(token, limit, offset); - data && setChallengeDataList(data); - }; - - return ( - - 관리자 페이지 - 챌린지 정보 - - - - - 챌린지 등록하기 - - - {challengeDataList?.map((data, id) => { - return ( - data && ( - - - - ) - ); - })} - - - ); -} - -export default AdminChallengeList; diff --git a/src/components/organisms/index.ts b/src/components/organisms/index.ts index 1ba4bf3e..62292efd 100644 --- a/src/components/organisms/index.ts +++ b/src/components/organisms/index.ts @@ -1,4 +1,3 @@ -export { default as AdminChallengeList } from './AdminChallengeList'; export { default as AdminChallengeOpen } from './AdminChallengeOpen'; export { default as AdminWrite } from './AdminWrite'; export { default as CategoryList } from './CategoryList'; diff --git a/src/pages/AdminChallengeList/index.tsx b/src/pages/AdminChallengeList/index.tsx index e1390138..c9094ecc 100644 --- a/src/pages/AdminChallengeList/index.tsx +++ b/src/pages/AdminChallengeList/index.tsx @@ -1,8 +1,24 @@ -import { AdminChallengeList as CAdminChallengeList } from 'components/organisms'; -import React from 'react'; +import { getChallengeList } from 'apis'; +import React, { useEffect, useState } from 'react'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import { IAdminChallenge } from 'types/admin.type'; +import AdminChallengeListTemplate from './template'; function AdminChallengeList(): React.ReactElement { - return ; + const userStatusData = useRecoilValue(userStatusState); + const [challengeDataList, setChallengeDataList] = useState(null); + + useEffect(() => { + if (userStatusData) getChallengeDataList(userStatusData.token, 30, 0); + else alert('로그인 후 이용하세요'); + }, [userStatusData]); + + const getChallengeDataList = async (token: string, limit: number, offset: number): Promise => { + const data = await getChallengeList(token, limit, offset); + data && setChallengeDataList(data); + }; + return ; } export default AdminChallengeList; diff --git a/src/pages/AdminChallengeList/template/index.tsx b/src/pages/AdminChallengeList/template/index.tsx index d82cc99a..1e1ee666 100644 --- a/src/pages/AdminChallengeList/template/index.tsx +++ b/src/pages/AdminChallengeList/template/index.tsx @@ -1,7 +1,38 @@ +import { GreydfPlusIcon as PlusIcon } from 'assets/images'; +import { AdminChallengeCard } from 'components/molecules'; import React from 'react'; +import { Link } from 'react-router-dom'; +import { IAdminChallenge } from 'types/admin.type'; +import { AddCard, AddExp, AddImage, ListContainer, PageLabel, Title, Wrapper } from './style'; -function Home(): React.ReactElement { - return
    Home
    ; +interface IProps { + challengeDataList: IAdminChallenge[] | null; } -export default Home; +function AdminChallengeListTemplate({ challengeDataList }: IProps): React.ReactElement { + return ( + + 관리자 페이지 + 챌린지 정보 + + + + + 챌린지 등록하기 + + + {challengeDataList?.map((data, id) => { + return ( + data && ( + + + + ) + ); + })} + + + ); +} + +export default AdminChallengeListTemplate; diff --git a/src/components/organisms/AdminChallengeList/style.ts b/src/pages/AdminChallengeList/template/style.ts similarity index 100% rename from src/components/organisms/AdminChallengeList/style.ts rename to src/pages/AdminChallengeList/template/style.ts From 8bc08a9281d9bc1a5638f28826efed5ec52928fb Mon Sep 17 00:00:00 2001 From: Subin Date: Tue, 10 Aug 2021 00:28:01 +0900 Subject: [PATCH 47/80] =?UTF-8?q?Refactor:=20AdminChallengeOpen=20?= =?UTF-8?q?=ED=85=9C=ED=94=8C=EB=A6=BF=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organisms/AdminChallengeOpen/index.tsx | 121 ------------------ src/components/organisms/index.ts | 1 - src/pages/AdminChallengeOpen/index.tsx | 78 ++++++++++- .../AdminChallengeOpen/template/index.tsx | 82 +++++++++++- .../AdminChallengeOpen/template}/style.ts | 0 5 files changed, 154 insertions(+), 128 deletions(-) delete mode 100644 src/components/organisms/AdminChallengeOpen/index.tsx rename src/{components/organisms/AdminChallengeOpen => pages/AdminChallengeOpen/template}/style.ts (100%) diff --git a/src/components/organisms/AdminChallengeOpen/index.tsx b/src/components/organisms/AdminChallengeOpen/index.tsx deleted file mode 100644 index 46e4dcb4..00000000 --- a/src/components/organisms/AdminChallengeOpen/index.tsx +++ /dev/null @@ -1,121 +0,0 @@ -import { challengeOpen } from 'apis'; -import { CheckOffIcon, CheckOnIcon, GreyPlusIcon } from 'assets/images'; -import { FileUpload as PhotoUpload } from 'components/atoms'; -import { AdminChallengeOpenForm } from 'components/molecules'; -import React, { useEffect, useState } from 'react'; -import { useHistory } from 'react-router-dom'; -import { useRecoilValue } from 'recoil'; -import { userStatusState } from 'stores/user'; -import { - CheckContainer, - CheckExp, - CheckImage, - ElementLabel, - OpenButton, - PageLabel, - PhotoUploadBottomDesc, - PhotoUploadContainer, - PhotoUploadImage, - PhotoUploadMiddleDesc, - SCheckBox, - Title, - UploadContainer, - Wrapper, -} from './style'; - -function AdminChallengeOpen(): React.ReactElement { - const history = useHistory(); - const userStatusData = useRecoilValue(userStatusState); - const [image, setImage] = useState(null); - const [isChecked, setIsChecked] = useState(false); - const [isButtonDisabled, setIsButtonDisabled] = useState(true); - const [isConditionMet, setIsConditionMet] = useState({ - title: false, - challengePeriod: { - start: false, - end: false, - }, - applyPeriod: { - start: false, - end: false, - }, - peopleNum: false, - }); - const [challengeOpenData, setChallengeOpenData] = useState({ - title: '', - challengePeriod: { - start: '', - end: '', - }, - applyPeriod: { - start: '', - end: '', - }, - peopleNum: 0, - }); - const checkHandler = () => { - setIsChecked(!isChecked); - }; - useEffect(() => { - if ( - isConditionMet.title && - isConditionMet.challengePeriod.start && - isConditionMet.challengePeriod.end && - isConditionMet.applyPeriod.start && - isConditionMet.applyPeriod.end && - isConditionMet.peopleNum && - image != null && - isChecked - ) { - setIsButtonDisabled(false); - } else { - setIsButtonDisabled(true); - } - }, [isConditionMet, image, isChecked]); - const btnHandler = async () => { - if (userStatusData) { - const isSuccess = await challengeOpen(userStatusData.token, { ...challengeOpenData, img: image }); - isSuccess && history.goBack(); - } else { - alert('로그인 후 이용하세요'); - } - }; - - return ( - - 관리자 페이지 - 챌린지 등록 - - - 사진 업로드 - - - - - 대표이미지 -
    - (필수) -
    - (1920px X 253px) -
    -
    -
    - - - - 위 내용을 확인하셨습니까? - - - - 등록하기 - -
    - ); -} - -export default AdminChallengeOpen; diff --git a/src/components/organisms/index.ts b/src/components/organisms/index.ts index 62292efd..7af5048f 100644 --- a/src/components/organisms/index.ts +++ b/src/components/organisms/index.ts @@ -1,4 +1,3 @@ -export { default as AdminChallengeOpen } from './AdminChallengeOpen'; export { default as AdminWrite } from './AdminWrite'; export { default as CategoryList } from './CategoryList'; export { default as ChallengeDetailCard } from './ChallengeDetailCard'; diff --git a/src/pages/AdminChallengeOpen/index.tsx b/src/pages/AdminChallengeOpen/index.tsx index 026e7deb..2b519567 100644 --- a/src/pages/AdminChallengeOpen/index.tsx +++ b/src/pages/AdminChallengeOpen/index.tsx @@ -1,8 +1,80 @@ -import { AdminChallengeOpen as CAdminChallengeOpen } from 'components/organisms'; -import React from 'react'; +import { challengeOpen } from 'apis'; +import React, { useEffect, useState } from 'react'; +import { useHistory } from 'react-router-dom'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import AdminChallengeOpenTemplate from './template'; function AdminChallengeOpen(): React.ReactElement { - return ; + const history = useHistory(); + const userStatusData = useRecoilValue(userStatusState); + const [image, setImage] = useState(null); + const [isChecked, setIsChecked] = useState(false); + const [isButtonDisabled, setIsButtonDisabled] = useState(true); + const [isConditionMet, setIsConditionMet] = useState({ + title: false, + challengePeriod: { + start: false, + end: false, + }, + applyPeriod: { + start: false, + end: false, + }, + peopleNum: false, + }); + const [challengeOpenData, setChallengeOpenData] = useState({ + title: '', + challengePeriod: { + start: '', + end: '', + }, + applyPeriod: { + start: '', + end: '', + }, + peopleNum: 0, + }); + const checkHandler = () => { + setIsChecked(!isChecked); + }; + useEffect(() => { + if ( + isConditionMet.title && + isConditionMet.challengePeriod.start && + isConditionMet.challengePeriod.end && + isConditionMet.applyPeriod.start && + isConditionMet.applyPeriod.end && + isConditionMet.peopleNum && + image != null && + isChecked + ) { + setIsButtonDisabled(false); + } else { + setIsButtonDisabled(true); + } + }, [isConditionMet, image, isChecked]); + const btnHandler = async () => { + if (userStatusData) { + const isSuccess = await challengeOpen(userStatusData.token, { ...challengeOpenData, img: image }); + isSuccess && history.goBack(); + } else { + alert('로그인 후 이용하세요'); + } + }; + return ( + + ); } export default AdminChallengeOpen; diff --git a/src/pages/AdminChallengeOpen/template/index.tsx b/src/pages/AdminChallengeOpen/template/index.tsx index d82cc99a..d75c4aeb 100644 --- a/src/pages/AdminChallengeOpen/template/index.tsx +++ b/src/pages/AdminChallengeOpen/template/index.tsx @@ -1,7 +1,83 @@ +import { CheckOffIcon, CheckOnIcon, GreyPlusIcon } from 'assets/images'; +import { FileUpload as PhotoUpload } from 'components/atoms'; +import { AdminChallengeOpenForm } from 'components/molecules'; import React from 'react'; +import { IChallengeOpen, IConditionMet } from 'types/challenge.type'; +import { + CheckContainer, + CheckExp, + CheckImage, + ElementLabel, + OpenButton, + PageLabel, + PhotoUploadBottomDesc, + PhotoUploadContainer, + PhotoUploadImage, + PhotoUploadMiddleDesc, + SCheckBox, + Title, + UploadContainer, + Wrapper, +} from './style'; -function Home(): React.ReactElement { - return
    Home
    ; +interface IProps { + isConditionMet: IConditionMet; + setIsConditionMet: (value: IConditionMet) => void; + challengeOpenData: IChallengeOpen; + setChallengeOpenData: (value: IChallengeOpen) => void; + setImage: (image: File | null) => void; + isChecked: boolean; + checkHandler: () => void; + isButtonDisabled: boolean; + btnHandler: () => Promise; } -export default Home; +function AdminChallengeOpenTemplate({ + isConditionMet, + setIsConditionMet, + challengeOpenData, + setChallengeOpenData, + setImage, + isChecked, + checkHandler, + isButtonDisabled, + btnHandler, +}: IProps): React.ReactElement { + return ( + + 관리자 페이지 + 챌린지 등록 + + + 사진 업로드 + + + + + 대표이미지 +
    + (필수) +
    + (1920px X 253px) +
    +
    +
    + + + + 위 내용을 확인하셨습니까? + + + + 등록하기 + +
    + ); +} + +export default AdminChallengeOpenTemplate; diff --git a/src/components/organisms/AdminChallengeOpen/style.ts b/src/pages/AdminChallengeOpen/template/style.ts similarity index 100% rename from src/components/organisms/AdminChallengeOpen/style.ts rename to src/pages/AdminChallengeOpen/template/style.ts From cd166c2b5af5808bcf0eda5ad5ccd3233455c179 Mon Sep 17 00:00:00 2001 From: Subin Date: Tue, 10 Aug 2021 00:35:04 +0900 Subject: [PATCH 48/80] =?UTF-8?q?Refactor:=20=EC=B1=8C=EB=A6=B0=EC=A7=80?= =?UTF-8?q?=EC=98=A4=ED=94=88=20=EC=9D=B4=EB=AF=B8=EC=A7=80=EC=97=85?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20=EB=AA=A8=EB=93=88=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChallengeOpenPhotoUpload/index.tsx | 24 +++++++++++++++ .../ChallengeOpenPhotoUpload/style.ts | 30 +++++++++++++++++++ src/components/organisms/index.ts | 1 + .../AdminChallengeOpen/template/index.tsx | 20 ++----------- .../AdminChallengeOpen/template/style.ts | 28 ----------------- 5 files changed, 58 insertions(+), 45 deletions(-) create mode 100644 src/components/organisms/ChallengeOpenPhotoUpload/index.tsx create mode 100644 src/components/organisms/ChallengeOpenPhotoUpload/style.ts diff --git a/src/components/organisms/ChallengeOpenPhotoUpload/index.tsx b/src/components/organisms/ChallengeOpenPhotoUpload/index.tsx new file mode 100644 index 00000000..8b34f313 --- /dev/null +++ b/src/components/organisms/ChallengeOpenPhotoUpload/index.tsx @@ -0,0 +1,24 @@ +import { GreyPlusIcon } from 'assets/images'; +import { FileUpload as PhotoUpload } from 'components/atoms'; +import React from 'react'; +import { PhotoUploadBottomDesc, PhotoUploadContainer, PhotoUploadImage, PhotoUploadMiddleDesc } from './style'; +interface IProps { + setImage: (image: File | null) => void; +} +function ChallengeOpenPhotoUpload({ setImage }: IProps): React.ReactElement { + return ( + + + + + 대표이미지 +
    + (필수) +
    + (1920px X 253px) +
    +
    + ); +} + +export default ChallengeOpenPhotoUpload; diff --git a/src/components/organisms/ChallengeOpenPhotoUpload/style.ts b/src/components/organisms/ChallengeOpenPhotoUpload/style.ts new file mode 100644 index 00000000..29a017d7 --- /dev/null +++ b/src/components/organisms/ChallengeOpenPhotoUpload/style.ts @@ -0,0 +1,30 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const PhotoUploadBottomDesc = Styled.div` + ${theme('font.body2_eng')} + color : ${palette('grayscale', 3)}; +`; + +export const PhotoUploadMiddleDesc = Styled.div` + ${theme('font.subhead3')} + color : ${palette('grayscale', 3)}; + text-align: center; + margin-top :4px; + margin-bottom : 20px; +`; + +export const PhotoUploadImage = Styled.img` + width : 38px; + height : 38px; +`; + +export const PhotoUploadContainer = Styled.div` + width: 262px; + height: 216px; + background-color : #f2f2f2; + display : flex; + flex-direction : column; + align-items : center; + justify-content : center; +`; diff --git a/src/components/organisms/index.ts b/src/components/organisms/index.ts index 7af5048f..4855aba7 100644 --- a/src/components/organisms/index.ts +++ b/src/components/organisms/index.ts @@ -2,6 +2,7 @@ export { default as AdminWrite } from './AdminWrite'; export { default as CategoryList } from './CategoryList'; export { default as ChallengeDetailCard } from './ChallengeDetailCard'; export { default as ChallengeEditCard } from './ChallengeEditCard'; +export { default as ChallengeOpenPhotoUpload } from './ChallengeOpenPhotoUpload'; export { default as ChallengeWriteCard } from './ChallengeWriteCard'; export { default as CommentList } from './CommentList'; export { default as ConcertCardList } from './ConcertCardList'; diff --git a/src/pages/AdminChallengeOpen/template/index.tsx b/src/pages/AdminChallengeOpen/template/index.tsx index d75c4aeb..2b6bcf71 100644 --- a/src/pages/AdminChallengeOpen/template/index.tsx +++ b/src/pages/AdminChallengeOpen/template/index.tsx @@ -1,6 +1,6 @@ -import { CheckOffIcon, CheckOnIcon, GreyPlusIcon } from 'assets/images'; -import { FileUpload as PhotoUpload } from 'components/atoms'; +import { CheckOffIcon, CheckOnIcon } from 'assets/images'; import { AdminChallengeOpenForm } from 'components/molecules'; +import { ChallengeOpenPhotoUpload } from 'components/organisms'; import React from 'react'; import { IChallengeOpen, IConditionMet } from 'types/challenge.type'; import { @@ -10,10 +10,6 @@ import { ElementLabel, OpenButton, PageLabel, - PhotoUploadBottomDesc, - PhotoUploadContainer, - PhotoUploadImage, - PhotoUploadMiddleDesc, SCheckBox, Title, UploadContainer, @@ -55,17 +51,7 @@ function AdminChallengeOpenTemplate({ /> 사진 업로드 - - - - - 대표이미지 -
    - (필수) -
    - (1920px X 253px) -
    -
    +
    diff --git a/src/pages/AdminChallengeOpen/template/style.ts b/src/pages/AdminChallengeOpen/template/style.ts index 0db0bc1d..37687ab4 100644 --- a/src/pages/AdminChallengeOpen/template/style.ts +++ b/src/pages/AdminChallengeOpen/template/style.ts @@ -2,34 +2,6 @@ import { Button, CheckBox, Label } from 'components/atoms'; import Styled, { css } from 'styled-components'; import { palette, theme } from 'styled-tools'; -export const PhotoUploadBottomDesc = Styled.div` - ${theme('font.body2_eng')} - color : ${palette('grayscale', 3)}; -`; - -export const PhotoUploadMiddleDesc = Styled.div` - ${theme('font.subhead3')} - color : ${palette('grayscale', 3)}; - text-align: center; - margin-top :4px; - margin-bottom : 20px; -`; - -export const PhotoUploadImage = Styled.img` - width : 38px; - height : 38px; -`; - -export const PhotoUploadContainer = Styled.div` - width: 262px; - height: 216px; - background-color : #f2f2f2; - display : flex; - flex-direction : column; - align-items : center; - justify-content : center; -`; - export const CheckExp = Styled.label` ${theme('font.body4')} color : ${palette('grayscale', 4)}; From 17888a490212ac7d56ec235e06525a12ba4d0671 Mon Sep 17 00:00:00 2001 From: Subin Date: Tue, 10 Aug 2021 00:57:00 +0900 Subject: [PATCH 49/80] =?UTF-8?q?Refactor:=20AdminWrite=20=ED=85=9C?= =?UTF-8?q?=ED=94=8C=EB=A6=BF=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/organisms/AdminWrite/index.tsx | 131 ------------------ src/components/organisms/index.ts | 1 - src/pages/AdminWrite/index.tsx | 120 +++++++++++++++- src/pages/AdminWrite/template/index.tsx | 42 +++++- .../AdminWrite/template}/style.ts | 0 5 files changed, 156 insertions(+), 138 deletions(-) delete mode 100644 src/components/organisms/AdminWrite/index.tsx rename src/{components/organisms/AdminWrite => pages/AdminWrite/template}/style.ts (100%) diff --git a/src/components/organisms/AdminWrite/index.tsx b/src/components/organisms/AdminWrite/index.tsx deleted file mode 100644 index 35f3b43c..00000000 --- a/src/components/organisms/AdminWrite/index.tsx +++ /dev/null @@ -1,131 +0,0 @@ -import { postConcertWrite, postNoticeWrite } from 'apis'; -import { AdminWriteForm } from 'components/molecules'; -import React, { useEffect, useState } from 'react'; -import { useHistory } from 'react-router-dom'; -import { useRecoilValue } from 'recoil'; -import { userStatusState } from 'stores/user'; -import { PageLabel, Title, Wrapper, WriteButton } from './style'; - -interface IProps { - menu: string; -} -function AdminWrite({ menu }: IProps): React.ReactElement { - const history = useHistory(); - const userStatusData = useRecoilValue(userStatusState); - const [isButtonDisabled, setIsButtonDisabled] = useState(true); - const [isConditionMet, setIsConditionMet] = useState({ - title: false, - category: false, - menu: false, - content: false, - hashtag: false, - video: false, - thumbnail: false, - nickname: false, - }); - const [writeData, setWriteData] = useState<{ - title: string; - category: string[]; - menu: string; - content: string; - hashtag: string[]; - video: File | null; - thumbnail: File | null; - nickname: string; - }>({ - title: '', - category: [''], - menu: '', - content: '', - hashtag: [''], - video: null, - thumbnail: null, - nickname: '', - }); - const handleBtnOnClick = () => { - if (writeData.menu === '공지사항') { - postNoticeHandler(); - } else { - postConcertHandler(); - } - }; - const postConcertHandler = async () => { - if (userStatusData) { - const isSuccess = await postConcertWrite(userStatusData.token, { - videoLink: writeData.video, - imgThumbnail: writeData.thumbnail, - title: writeData.title, - text: writeData.content, - interest: writeData.category, - hashtag: writeData.hashtag, - authorNickname: writeData.nickname, - }); - isSuccess && history.goBack(); - } else { - alert('로그인 후 이용하세요'); - } - }; - const postNoticeHandler = async () => { - if (userStatusData) { - const isSuccess = await postNoticeWrite(userStatusData.token, { - title: writeData.title, - text: writeData.content, - interest: writeData.category, - hashtag: writeData.hashtag, - }); - isSuccess && history.goBack(); - } else { - alert('로그인 후 이용하세요'); - } - }; - - useEffect(() => { - if (writeData.menu === 'Share Together') { - if ( - isConditionMet.title && - isConditionMet.category && - isConditionMet.menu && - isConditionMet.content && - isConditionMet.hashtag && - isConditionMet.video && - isConditionMet.thumbnail && - isConditionMet.nickname - ) { - setIsButtonDisabled(false); - } else { - setIsButtonDisabled(true); - } - } else { - if ( - isConditionMet.title && - isConditionMet.category && - isConditionMet.menu && - isConditionMet.content && - isConditionMet.hashtag - ) { - setIsButtonDisabled(false); - } else { - setIsButtonDisabled(true); - } - } - }, [isConditionMet, writeData.menu]); - - return ( - - 관리자 페이지 - 글 올리기 - - - 등록하기 - - - ); -} - -export default AdminWrite; diff --git a/src/components/organisms/index.ts b/src/components/organisms/index.ts index 4855aba7..de9380f9 100644 --- a/src/components/organisms/index.ts +++ b/src/components/organisms/index.ts @@ -1,4 +1,3 @@ -export { default as AdminWrite } from './AdminWrite'; export { default as CategoryList } from './CategoryList'; export { default as ChallengeDetailCard } from './ChallengeDetailCard'; export { default as ChallengeEditCard } from './ChallengeEditCard'; diff --git a/src/pages/AdminWrite/index.tsx b/src/pages/AdminWrite/index.tsx index 2092131e..a7b73212 100644 --- a/src/pages/AdminWrite/index.tsx +++ b/src/pages/AdminWrite/index.tsx @@ -1,13 +1,127 @@ -import { AdminWrite as CAdminWrite } from 'components/organisms'; -import React from 'react'; +import { postConcertWrite, postNoticeWrite } from 'apis'; +import React, { useEffect, useState } from 'react'; import { RouteComponentProps } from 'react-router'; +import { useHistory } from 'react-router-dom'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; +import AdminWriteTemplate from './template'; interface MatchParams { menu: string; } function AdminWrite({ match }: RouteComponentProps): React.ReactElement { const menu = match.params.menu; - return ; + const history = useHistory(); + const userStatusData = useRecoilValue(userStatusState); + const [isButtonDisabled, setIsButtonDisabled] = useState(true); + const [isConditionMet, setIsConditionMet] = useState({ + title: false, + category: false, + menu: false, + content: false, + hashtag: false, + video: false, + thumbnail: false, + nickname: false, + }); + const [writeData, setWriteData] = useState<{ + title: string; + category: string[]; + menu: string; + content: string; + hashtag: string[]; + video: File | null; + thumbnail: File | null; + nickname: string; + }>({ + title: '', + category: [''], + menu: '', + content: '', + hashtag: [''], + video: null, + thumbnail: null, + nickname: '', + }); + const handleBtnOnClick = () => { + if (writeData.menu === '공지사항') { + postNoticeHandler(); + } else { + postConcertHandler(); + } + }; + const postConcertHandler = async () => { + if (userStatusData) { + const isSuccess = await postConcertWrite(userStatusData.token, { + videoLink: writeData.video, + imgThumbnail: writeData.thumbnail, + title: writeData.title, + text: writeData.content, + interest: writeData.category, + hashtag: writeData.hashtag, + authorNickname: writeData.nickname, + }); + isSuccess && history.goBack(); + } else { + alert('로그인 후 이용하세요'); + } + }; + const postNoticeHandler = async () => { + if (userStatusData) { + const isSuccess = await postNoticeWrite(userStatusData.token, { + title: writeData.title, + text: writeData.content, + interest: writeData.category, + hashtag: writeData.hashtag, + }); + isSuccess && history.goBack(); + } else { + alert('로그인 후 이용하세요'); + } + }; + + useEffect(() => { + if (writeData.menu === 'Share Together') { + if ( + isConditionMet.title && + isConditionMet.category && + isConditionMet.menu && + isConditionMet.content && + isConditionMet.hashtag && + isConditionMet.video && + isConditionMet.thumbnail && + isConditionMet.nickname + ) { + setIsButtonDisabled(false); + } else { + setIsButtonDisabled(true); + } + } else { + if ( + isConditionMet.title && + isConditionMet.category && + isConditionMet.menu && + isConditionMet.content && + isConditionMet.hashtag + ) { + setIsButtonDisabled(false); + } else { + setIsButtonDisabled(true); + } + } + }, [isConditionMet, writeData.menu]); + + return ( + + ); } export default AdminWrite; diff --git a/src/pages/AdminWrite/template/index.tsx b/src/pages/AdminWrite/template/index.tsx index d82cc99a..402a5b80 100644 --- a/src/pages/AdminWrite/template/index.tsx +++ b/src/pages/AdminWrite/template/index.tsx @@ -1,7 +1,43 @@ +import { AdminWriteForm } from 'components/molecules'; import React from 'react'; +import { IAdminWriteConditionMet } from 'types/admin.type'; +import { IUserData } from 'types/user.type'; +import { PageLabel, Title, Wrapper, WriteButton } from './style'; -function Home(): React.ReactElement { - return
    Home
    ; +interface IProps { + menu: string; + isConditionMet: IAdminWriteConditionMet; + setIsConditionMet: (value: IAdminWriteConditionMet) => void; + writeData: IUserData; + setWriteData: (value: IUserData) => void; + isButtonDisabled: boolean; + handleBtnOnClick: () => void; +} +function AdminWriteTemplate({ + menu, + setIsConditionMet, + writeData, + setWriteData, + isConditionMet, + isButtonDisabled, + handleBtnOnClick, +}: IProps): React.ReactElement { + return ( + + 관리자 페이지 + 글 올리기 + + + 등록하기 + + + ); } -export default Home; +export default AdminWriteTemplate; diff --git a/src/components/organisms/AdminWrite/style.ts b/src/pages/AdminWrite/template/style.ts similarity index 100% rename from src/components/organisms/AdminWrite/style.ts rename to src/pages/AdminWrite/template/style.ts From 395d5b23d146603c00884494c5987fdd460fa92f Mon Sep 17 00:00:00 2001 From: Subin Date: Tue, 10 Aug 2021 02:16:49 +0900 Subject: [PATCH 50/80] =?UTF-8?q?Refactor:=20useEffect,=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=ED=95=B8=EB=93=A4=EB=9F=AC=20page=EB=8B=A8=EC=9C=84?= =?UTF-8?q?=EC=97=90=20=EB=B0=B0=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdminChallengeOpenForm/index.tsx | 111 ++++-------------- src/pages/AdminChallengeOpen/index.tsx | 104 ++++++++++++++-- .../AdminChallengeOpen/template/index.tsx | 29 +++-- 3 files changed, 134 insertions(+), 110 deletions(-) diff --git a/src/components/molecules/AdminChallengeOpenForm/index.tsx b/src/components/molecules/AdminChallengeOpenForm/index.tsx index 77ae327b..9b3776aa 100644 --- a/src/components/molecules/AdminChallengeOpenForm/index.tsx +++ b/src/components/molecules/AdminChallengeOpenForm/index.tsx @@ -1,67 +1,27 @@ import { StyledInput } from 'components/atoms'; -import React, { useEffect } from 'react'; -import { IChallengeOpen, IConditionMet } from 'types/challenge.type'; +import React from 'react'; +import { IConditionMet } from 'types/challenge.type'; import { PeopleContainer, PeriodContainer, Text, Wrapper, WriteLabel } from './style'; export interface IProps { isConditionMet: IConditionMet; - setIsConditionMet: (value: IConditionMet) => void; - challengeOpenData: IChallengeOpen; - setChallengeOpenData: (value: IChallengeOpen) => void; + handleTitleOnChange: (value: string | number) => void; + handleChallengeStOnChange: (value: string | number) => void; + handleChallengeEndOnChange: (value: string | number) => void; + handleApplyStOnChange: (value: string | number) => void; + handleApplyEndOnChange: (value: string | number) => void; + handleNumOnChange: (value: string | number) => void; } function AdminChallengeOpenForm({ isConditionMet, - setIsConditionMet, - challengeOpenData, - setChallengeOpenData, + handleTitleOnChange, + handleChallengeStOnChange, + handleChallengeEndOnChange, + handleApplyStOnChange, + handleApplyEndOnChange, + handleNumOnChange, }: IProps): React.ReactElement { - const CheckDatePattern = (date: string) => /[0-9]{4}.[0-9]{2}.[0-9]{2}$/.test(date); - - useEffect(() => { - if (challengeOpenData.title !== '') { - setIsConditionMet({ ...isConditionMet, title: true }); - } else { - setIsConditionMet({ ...isConditionMet, title: false }); - } - }, [challengeOpenData.title]); - useEffect(() => { - if (challengeOpenData.peopleNum !== 0) { - setIsConditionMet({ ...isConditionMet, peopleNum: true }); - } else { - setIsConditionMet({ ...isConditionMet, peopleNum: false }); - } - }, [challengeOpenData.peopleNum]); - - useEffect(() => { - if (CheckDatePattern(challengeOpenData.challengePeriod.start)) { - setIsConditionMet({ ...isConditionMet, challengePeriod: { ...isConditionMet.challengePeriod, start: true } }); - } else { - setIsConditionMet({ ...isConditionMet, challengePeriod: { ...isConditionMet.challengePeriod, start: false } }); - } - }, [challengeOpenData.challengePeriod.start]); - useEffect(() => { - if (CheckDatePattern(challengeOpenData.challengePeriod.end)) { - setIsConditionMet({ ...isConditionMet, challengePeriod: { ...isConditionMet.challengePeriod, end: true } }); - } else { - setIsConditionMet({ ...isConditionMet, challengePeriod: { ...isConditionMet.challengePeriod, end: false } }); - } - }, [challengeOpenData.challengePeriod.end]); - useEffect(() => { - if (CheckDatePattern(challengeOpenData.applyPeriod.start)) { - setIsConditionMet({ ...isConditionMet, applyPeriod: { ...isConditionMet.applyPeriod, start: true } }); - } else { - setIsConditionMet({ ...isConditionMet, applyPeriod: { ...isConditionMet.applyPeriod, start: false } }); - } - }, [challengeOpenData.applyPeriod.start]); - useEffect(() => { - if (CheckDatePattern(challengeOpenData.applyPeriod.end)) { - setIsConditionMet({ ...isConditionMet, applyPeriod: { ...isConditionMet.applyPeriod, end: true } }); - } else { - setIsConditionMet({ ...isConditionMet, applyPeriod: { ...isConditionMet.applyPeriod, end: false } }); - } - }, [challengeOpenData.applyPeriod.end]); - return ( 챌린지 제목 @@ -69,9 +29,7 @@ function AdminChallengeOpenForm({ placeHolder="제목을 입력하세요" width="844px" height="60px" - onChange={(value) => { - if (typeof value === 'string') setChallengeOpenData({ ...challengeOpenData, title: value }); - }} + onChange={handleTitleOnChange} isConditionMet={isConditionMet.title} margin="0 0 40px 0" /> @@ -81,13 +39,7 @@ function AdminChallengeOpenForm({ placeHolder="년도.월.일. ex) 2021.07.04" width="390px" height="60px" - onChange={(value) => { - if (typeof value === 'string') - setChallengeOpenData({ - ...challengeOpenData, - challengePeriod: { ...challengeOpenData.challengePeriod, start: value }, - }); - }} + onChange={handleChallengeStOnChange} isConditionMet={isConditionMet.challengePeriod.start} margin="0 0 40px 0" /> @@ -96,13 +48,7 @@ function AdminChallengeOpenForm({ placeHolder="년도.월.일. ex) 2021.07.04" width="390px" height="60px" - onChange={(value) => { - if (typeof value === 'string') - setChallengeOpenData({ - ...challengeOpenData, - challengePeriod: { ...challengeOpenData.challengePeriod, end: value }, - }); - }} + onChange={handleChallengeEndOnChange} isConditionMet={isConditionMet.challengePeriod.end} margin="0 0 40px 0" /> @@ -113,13 +59,7 @@ function AdminChallengeOpenForm({ placeHolder="년도.월.일. ex) 2021.07.04" width="390px" height="60px" - onChange={(value) => { - if (typeof value === 'string') - setChallengeOpenData({ - ...challengeOpenData, - applyPeriod: { ...challengeOpenData.applyPeriod, start: value }, - }); - }} + onChange={handleApplyStOnChange} isConditionMet={isConditionMet.applyPeriod.start} margin="0 0 40px 0" /> @@ -128,13 +68,7 @@ function AdminChallengeOpenForm({ placeHolder="년도.월.일. ex) 2021.07.04" width="390px" height="60px" - onChange={(value) => { - if (typeof value === 'string') - setChallengeOpenData({ - ...challengeOpenData, - applyPeriod: { ...challengeOpenData.applyPeriod, end: value }, - }); - }} + onChange={handleApplyEndOnChange} isConditionMet={isConditionMet.applyPeriod.end} margin="0 0 40px 0" /> @@ -145,12 +79,7 @@ function AdminChallengeOpenForm({ placeHolder="제한 인원 수를 입력하세요" width="390px" height="60px" - onChange={(value) => { - if (typeof value === 'string') - if (!isNaN(Number(value))) { - setChallengeOpenData({ ...challengeOpenData, peopleNum: Number(value) }); - } - }} + onChange={handleNumOnChange} isConditionMet={isConditionMet.peopleNum} margin="0 26px 40px 0" /> diff --git a/src/pages/AdminChallengeOpen/index.tsx b/src/pages/AdminChallengeOpen/index.tsx index 2b519567..3b51e872 100644 --- a/src/pages/AdminChallengeOpen/index.tsx +++ b/src/pages/AdminChallengeOpen/index.tsx @@ -38,6 +38,53 @@ function AdminChallengeOpen(): React.ReactElement { const checkHandler = () => { setIsChecked(!isChecked); }; + const btnHandler = async () => { + if (userStatusData) { + const isSuccess = await challengeOpen(userStatusData.token, { ...challengeOpenData, img: image }); + isSuccess && history.goBack(); + } else { + alert('로그인 후 이용하세요'); + } + }; + const CheckDatePattern = (date: string) => /[0-9]{4}.[0-9]{2}.[0-9]{2}$/.test(date); + const handleTitleOnChange = (value: string | number) => { + if (typeof value === 'string') setChallengeOpenData({ ...challengeOpenData, title: value }); + }; + const handleChallengeStOnChange = (value: string | number) => { + if (typeof value === 'string') + setChallengeOpenData({ + ...challengeOpenData, + challengePeriod: { ...challengeOpenData.challengePeriod, start: value }, + }); + }; + const handleChallengeEndOnChange = (value: string | number) => { + if (typeof value === 'string') + setChallengeOpenData({ + ...challengeOpenData, + challengePeriod: { ...challengeOpenData.challengePeriod, end: value }, + }); + }; + const handleApplyStOnChange = (value: string | number) => { + if (typeof value === 'string') + setChallengeOpenData({ + ...challengeOpenData, + applyPeriod: { ...challengeOpenData.applyPeriod, start: value }, + }); + }; + const handleApplyEndOnChange = (value: string | number) => { + if (typeof value === 'string') + setChallengeOpenData({ + ...challengeOpenData, + applyPeriod: { ...challengeOpenData.applyPeriod, end: value }, + }); + }; + const handleNumOnChange = (value: string | number) => { + if (typeof value === 'string') + if (!isNaN(Number(value))) { + setChallengeOpenData({ ...challengeOpenData, peopleNum: Number(value) }); + } + }; + useEffect(() => { if ( isConditionMet.title && @@ -54,25 +101,64 @@ function AdminChallengeOpen(): React.ReactElement { setIsButtonDisabled(true); } }, [isConditionMet, image, isChecked]); - const btnHandler = async () => { - if (userStatusData) { - const isSuccess = await challengeOpen(userStatusData.token, { ...challengeOpenData, img: image }); - isSuccess && history.goBack(); + useEffect(() => { + if (challengeOpenData.title !== '') { + setIsConditionMet({ ...isConditionMet, title: true }); } else { - alert('로그인 후 이용하세요'); + setIsConditionMet({ ...isConditionMet, title: false }); } - }; + }, [challengeOpenData.title]); + useEffect(() => { + if (challengeOpenData.peopleNum !== 0) { + setIsConditionMet({ ...isConditionMet, peopleNum: true }); + } else { + setIsConditionMet({ ...isConditionMet, peopleNum: false }); + } + }, [challengeOpenData.peopleNum]); + + useEffect(() => { + if (CheckDatePattern(challengeOpenData.challengePeriod.start)) { + setIsConditionMet({ ...isConditionMet, challengePeriod: { ...isConditionMet.challengePeriod, start: true } }); + } else { + setIsConditionMet({ ...isConditionMet, challengePeriod: { ...isConditionMet.challengePeriod, start: false } }); + } + }, [challengeOpenData.challengePeriod.start]); + useEffect(() => { + if (CheckDatePattern(challengeOpenData.challengePeriod.end)) { + setIsConditionMet({ ...isConditionMet, challengePeriod: { ...isConditionMet.challengePeriod, end: true } }); + } else { + setIsConditionMet({ ...isConditionMet, challengePeriod: { ...isConditionMet.challengePeriod, end: false } }); + } + }, [challengeOpenData.challengePeriod.end]); + useEffect(() => { + if (CheckDatePattern(challengeOpenData.applyPeriod.start)) { + setIsConditionMet({ ...isConditionMet, applyPeriod: { ...isConditionMet.applyPeriod, start: true } }); + } else { + setIsConditionMet({ ...isConditionMet, applyPeriod: { ...isConditionMet.applyPeriod, start: false } }); + } + }, [challengeOpenData.applyPeriod.start]); + useEffect(() => { + if (CheckDatePattern(challengeOpenData.applyPeriod.end)) { + setIsConditionMet({ ...isConditionMet, applyPeriod: { ...isConditionMet.applyPeriod, end: true } }); + } else { + setIsConditionMet({ ...isConditionMet, applyPeriod: { ...isConditionMet.applyPeriod, end: false } }); + } + }, [challengeOpenData.applyPeriod.end]); + return ( ); } diff --git a/src/pages/AdminChallengeOpen/template/index.tsx b/src/pages/AdminChallengeOpen/template/index.tsx index 2b6bcf71..76918a2f 100644 --- a/src/pages/AdminChallengeOpen/template/index.tsx +++ b/src/pages/AdminChallengeOpen/template/index.tsx @@ -2,7 +2,7 @@ import { CheckOffIcon, CheckOnIcon } from 'assets/images'; import { AdminChallengeOpenForm } from 'components/molecules'; import { ChallengeOpenPhotoUpload } from 'components/organisms'; import React from 'react'; -import { IChallengeOpen, IConditionMet } from 'types/challenge.type'; +import { IConditionMet } from 'types/challenge.type'; import { CheckContainer, CheckExp, @@ -18,26 +18,32 @@ import { interface IProps { isConditionMet: IConditionMet; - setIsConditionMet: (value: IConditionMet) => void; - challengeOpenData: IChallengeOpen; - setChallengeOpenData: (value: IChallengeOpen) => void; setImage: (image: File | null) => void; isChecked: boolean; checkHandler: () => void; isButtonDisabled: boolean; btnHandler: () => Promise; + handleTitleOnChange: (value: string | number) => void; + handleChallengeStOnChange: (value: string | number) => void; + handleChallengeEndOnChange: (value: string | number) => void; + handleApplyStOnChange: (value: string | number) => void; + handleApplyEndOnChange: (value: string | number) => void; + handleNumOnChange: (value: string | number) => void; } function AdminChallengeOpenTemplate({ + handleTitleOnChange, isConditionMet, - setIsConditionMet, - challengeOpenData, - setChallengeOpenData, setImage, isChecked, checkHandler, isButtonDisabled, btnHandler, + handleChallengeStOnChange, + handleChallengeEndOnChange, + handleApplyStOnChange, + handleApplyEndOnChange, + handleNumOnChange, }: IProps): React.ReactElement { return ( @@ -45,9 +51,12 @@ function AdminChallengeOpenTemplate({ 챌린지 등록 사진 업로드 From 29b7d3da3bde376877034fb3347a61bac04b9a6e Mon Sep 17 00:00:00 2001 From: Subin Date: Tue, 10 Aug 2021 02:22:07 +0900 Subject: [PATCH 51/80] =?UTF-8?q?Refactor:=20=ED=95=B4=EC=8B=9C=ED=83=9C?= =?UTF-8?q?=EA=B7=B8=20=EC=B6=94=EA=B0=80=EB=B6=80=EB=B6=84=20=EB=AA=A8?= =?UTF-8?q?=EB=93=88=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/index.ts | 1 - .../AdminWriteForm/index.tsx | 45 ------------- .../AdminWriteForm/style.ts | 45 +------------ .../organisms/HashTagAddForm/index.tsx | 56 +++++++++++++++++ .../organisms/HashTagAddForm/style.ts | 63 +++++++++++++++++++ src/components/organisms/index.ts | 2 + src/pages/AdminWrite/template/index.tsx | 6 +- src/pages/AdminWrite/template/style.ts | 7 +++ 8 files changed, 133 insertions(+), 92 deletions(-) rename src/components/{molecules => organisms}/AdminWriteForm/index.tsx (83%) rename src/components/{molecules => organisms}/AdminWriteForm/style.ts (65%) create mode 100644 src/components/organisms/HashTagAddForm/index.tsx create mode 100644 src/components/organisms/HashTagAddForm/style.ts diff --git a/src/components/molecules/index.ts b/src/components/molecules/index.ts index 80a45abe..d994f740 100644 --- a/src/components/molecules/index.ts +++ b/src/components/molecules/index.ts @@ -1,6 +1,5 @@ export { default as AdminChallengeCard } from './AdminChallengeCard'; export { default as AdminChallengeOpenForm } from './AdminChallengeOpenForm'; -export { default as AdminWriteForm } from './AdminWriteForm'; export { default as BadgeCard } from './BadgeCard'; export { default as CategoryButton } from './CategoryButton'; export { default as ChallengeCard } from './ChallengeCard'; diff --git a/src/components/molecules/AdminWriteForm/index.tsx b/src/components/organisms/AdminWriteForm/index.tsx similarity index 83% rename from src/components/molecules/AdminWriteForm/index.tsx rename to src/components/organisms/AdminWriteForm/index.tsx index 6209aba6..b5c0deb2 100644 --- a/src/components/molecules/AdminWriteForm/index.tsx +++ b/src/components/organisms/AdminWriteForm/index.tsx @@ -7,10 +7,6 @@ import { IAdminWriteConditionMet } from 'types/admin.type'; import { IUserData } from 'types/user.type'; import { CategoryChipsContainer, - HashTag, - HashTagContainer, - HashTagInput, - HashTagInputContainer, Icon, NicknameContainer, RowContainer, @@ -43,21 +39,8 @@ function AdminWriteForm({ const [category, setCategory] = useState('카테고리를 선택하세요'); const [menu, setMenu] = useState(''); const [content, setContent] = useState(''); - const [currentHashtag, setCurrentHashtag] = useState(''); const [videoFile, setVideoFile] = useState(null); const [thumbnail, setThumbnail] = useState(null); - const [isHashTagFocused, setIsHashTagFocused] = useState(false); - - const addHashTag = () => { - if (currentHashtag !== '' && writeData.hashtag.length < 15) { - if (writeData.hashtag[0] == '') { - setWriteData({ ...writeData, hashtag: [currentHashtag] }); - } else { - setWriteData({ ...writeData, hashtag: [...writeData.hashtag, currentHashtag] }); - } - setCurrentHashtag(''); - } - }; useEffect(() => { if (menuProps === 'sharetogether') setMenu('Share Together'); @@ -230,34 +213,6 @@ function AdminWriteForm({ - 해시태그 - - { - setCurrentHashtag(e.target.value); - }} - onFocus={() => { - setIsHashTagFocused(true); - }} - onBlur={() => { - setIsHashTagFocused(false); - }} - onKeyUp={(e) => { - if (e.keyCode === 13) { - addHashTag(); - } - }} - /> - - - {writeData.hashtag.length >= 0 && - writeData.hashtag.map((hashtag, id) => { - return hashtag != '' && #{hashtag}; - })} - ); } diff --git a/src/components/molecules/AdminWriteForm/style.ts b/src/components/organisms/AdminWriteForm/style.ts similarity index 65% rename from src/components/molecules/AdminWriteForm/style.ts rename to src/components/organisms/AdminWriteForm/style.ts index 32abb49a..a1987c63 100644 --- a/src/components/molecules/AdminWriteForm/style.ts +++ b/src/components/organisms/AdminWriteForm/style.ts @@ -64,56 +64,13 @@ export const TopRowContainer = Styled.div` display : flex; justify-content : space-between; `; -export const HashTagInput = Styled(Input)` - ${theme('font.body2')}; - width : 100%; - height : 100%; - border-radius:4px; - padding : 18px 20px; -`; -export const HashTagInputContainer = Styled.div<{ isFocused: boolean }>` - ${(props) => - props.isFocused - ? css` - border: double 1px transparent; - background-image: linear-gradient(white, white), - linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); - background-origin: border-box; - background-clip: content-box, border-box; - ` - : css` - border: 1px solid ${palette('grayscale', 2)}; - `}; - width : 100%; - height : 60px; - border-radius: 4px; -`; -export const HashTagContainer = Styled.div` - width : 100%; - display : flex; - column-gap: 10px; - flex-direction: row; - flex-wrap : wrap; - margin-top : 20px; - margin-bottom : 130px; -`; + export const WriteLabel = Styled(Label)` ${theme('font.subhead4')}; width : 100%; color: ${palette('grayscale', 9)}; margin-bottom : 8px; `; -export const HashTag = Styled.div` - ${theme('font.body2')}; - padding : 5px 10px; - background-color: #f5f5f5; - color : ${palette('grayscale', 3)}; - min-height : 31px; - max-width : 100%; - white-space : break-all; - border-radius: 50px; - margin-bottom:10px; -`; export const CategoryChipsContainer = Styled.div` width : 412px; diff --git a/src/components/organisms/HashTagAddForm/index.tsx b/src/components/organisms/HashTagAddForm/index.tsx new file mode 100644 index 00000000..a5e5b2e0 --- /dev/null +++ b/src/components/organisms/HashTagAddForm/index.tsx @@ -0,0 +1,56 @@ +import React, { useState } from 'react'; +import { IUserData } from 'types/user.type'; +import { HashTag, HashTagContainer, HashTagInput, HashTagInputContainer, Wrapper } from './style'; + +export interface IProps { + writeData: IUserData; + setWriteData: (value: IUserData) => void; +} + +function HashTagAddForm({ writeData, setWriteData }: IProps): React.ReactElement { + const [currentHashtag, setCurrentHashtag] = useState(''); + const [isHashTagFocused, setIsHashTagFocused] = useState(false); + const addHashTag = () => { + if (currentHashtag !== '' && writeData.hashtag.length < 15) { + if (writeData.hashtag[0] == '') { + setWriteData({ ...writeData, hashtag: [currentHashtag] }); + } else { + setWriteData({ ...writeData, hashtag: [...writeData.hashtag, currentHashtag] }); + } + setCurrentHashtag(''); + } + }; + return ( + + + { + setCurrentHashtag(e.target.value); + }} + onFocus={() => { + setIsHashTagFocused(true); + }} + onBlur={() => { + setIsHashTagFocused(false); + }} + onKeyUp={(e) => { + if (e.keyCode === 13) { + addHashTag(); + } + }} + /> + + + {writeData.hashtag.length >= 0 && + writeData.hashtag.map((hashtag, id) => { + return hashtag != '' && #{hashtag}; + })} + + + ); +} + +export default HashTagAddForm; diff --git a/src/components/organisms/HashTagAddForm/style.ts b/src/components/organisms/HashTagAddForm/style.ts new file mode 100644 index 00000000..d06b3bda --- /dev/null +++ b/src/components/organisms/HashTagAddForm/style.ts @@ -0,0 +1,63 @@ +import { Input } from 'components/atoms'; +import Styled, { css } from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const HashTagInput = Styled(Input)` + ${theme('font.body2')}; + width : 100%; + height : 100%; + border-radius:4px; + padding : 18px 20px; +`; + +export const HashTag = Styled.div` + ${theme('font.body2')}; + padding : 5px 10px; + background-color: #f5f5f5; + color : ${palette('grayscale', 3)}; + min-height : 31px; + max-width : 100%; + white-space : break-all; + border-radius: 50px; + margin-bottom:10px; +`; + +export const HashTagInputContainer = Styled.div<{ isFocused: boolean }>` + ${(props) => + props.isFocused + ? css` + border: double 1px transparent; + background-image: linear-gradient(white, white), + linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + background-origin: border-box; + background-clip: content-box, border-box; + ` + : css` + border: 1px solid ${palette('grayscale', 2)}; + `}; + width : 100%; + height : 60px; + border-radius: 4px; +`; + +export const HashTagContainer = Styled.div` + width : 100%; + display : flex; + column-gap: 10px; + flex-direction: row; + flex-wrap : wrap; + margin-top : 20px; + margin-bottom : 130px; +`; +export const Wrapper = Styled.div` + display : flex; + flex-direction : column; + align-items : center; + width : 844px; + input{ + border : none; + :focus{ + outline : none; + } + } +`; diff --git a/src/components/organisms/index.ts b/src/components/organisms/index.ts index de9380f9..d0261604 100644 --- a/src/components/organisms/index.ts +++ b/src/components/organisms/index.ts @@ -1,3 +1,4 @@ +export { default as AdminWriteForm } from './AdminWriteForm'; export { default as CategoryList } from './CategoryList'; export { default as ChallengeDetailCard } from './ChallengeDetailCard'; export { default as ChallengeEditCard } from './ChallengeEditCard'; @@ -23,3 +24,4 @@ export { default as NoticeList } from './NoticeList'; export { default as RegisterDetailCard } from './RegisterDetailCard'; export { default as SearchForm } from './SearchForm'; export { default as SetNewPwd } from './SetNewPwd'; +export { default as HashTagAddForm } from './HashTagAddForm'; diff --git a/src/pages/AdminWrite/template/index.tsx b/src/pages/AdminWrite/template/index.tsx index 402a5b80..ad0d9854 100644 --- a/src/pages/AdminWrite/template/index.tsx +++ b/src/pages/AdminWrite/template/index.tsx @@ -1,8 +1,8 @@ -import { AdminWriteForm } from 'components/molecules'; +import { AdminWriteForm, HashTagAddForm } from 'components/organisms'; import React from 'react'; import { IAdminWriteConditionMet } from 'types/admin.type'; import { IUserData } from 'types/user.type'; -import { PageLabel, Title, Wrapper, WriteButton } from './style'; +import { PageLabel, Title, Wrapper, WriteButton, WriteLabel } from './style'; interface IProps { menu: string; @@ -33,6 +33,8 @@ function AdminWriteTemplate({ setWriteData={setWriteData} menuProps={menu} /> + 해시태그 + 등록하기 diff --git a/src/pages/AdminWrite/template/style.ts b/src/pages/AdminWrite/template/style.ts index a6de70d2..71401e5f 100644 --- a/src/pages/AdminWrite/template/style.ts +++ b/src/pages/AdminWrite/template/style.ts @@ -17,6 +17,13 @@ export const Title = Styled(Label)` color:${palette('grayscale', 7)}; `; +export const WriteLabel = Styled(Label)` + ${theme('font.subhead4')}; + width : 844px; + color: ${palette('grayscale', 9)}; + margin-bottom : 8px; +`; + export const WriteButton = Styled(Button)<{ isButtonDisabled?: boolean }>` /* 버튼 색이 안바뀜 */ ${theme('font.subhead3')} From e5ba003f8f14ffb87b1349f542a89798caa53553 Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Tue, 10 Aug 2021 03:10:07 +0900 Subject: [PATCH 52/80] =?UTF-8?q?Style=20:=20=EC=98=A8=ED=81=B4=EB=A6=AD?= =?UTF-8?q?=20=EB=B0=96=EC=9C=BC=EB=A1=9C=20=EB=B9=BC=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../molecules/ChallengeCardBottom/index.tsx | 37 ++++++++++++------ .../molecules/ChallengeCardFold/index.tsx | 1 + .../molecules/ChallengeCardProfile/index.tsx | 38 ++++++++++++------- 3 files changed, 51 insertions(+), 25 deletions(-) diff --git a/src/components/molecules/ChallengeCardBottom/index.tsx b/src/components/molecules/ChallengeCardBottom/index.tsx index 45caaf64..f9cb38d4 100644 --- a/src/components/molecules/ChallengeCardBottom/index.tsx +++ b/src/components/molecules/ChallengeCardBottom/index.tsx @@ -7,6 +7,7 @@ import { ButtonWrapper, FoldButton, IconWrapper } from './style'; interface IProps { setIsClosed: (value: boolean) => void; + isClosed: boolean; setIsLoginModalOpen: (value: boolean) => void; isLike?: boolean; like: number; @@ -21,6 +22,7 @@ function ChallengeCardBottom({ isLike, comments, id, + isClosed, }: IProps): React.ReactElement { const userStatusData = useRecoilValue(userStatusState); const [countLikes, setCountLikes] = useState(like); @@ -50,14 +52,32 @@ function ChallengeCardBottom({ } }; + const foldHandleOnClick = () => { + setLookMoreButton(!lookMoreButton); + setIsClosed(!isClosed); + }; + + const likeCancelHandelOnClick = () => { + cancelLike(); + { + userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); + } + }; + + const likeSubmitHandelOnClick = () => { + submitLike(); + { + userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); + } + }; + return ( <> {lookMoreButton === true ? ( { - setLookMoreButton(false); - setIsClosed(true); + foldHandleOnClick(); }} > 더보기 @@ -67,8 +87,7 @@ function ChallengeCardBottom({ { - setLookMoreButton(true); - setIsClosed(false); + foldHandleOnClick(); }} > 접기 @@ -80,10 +99,7 @@ function ChallengeCardBottom({ { - cancelLike(); - { - userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); - } + likeCancelHandelOnClick(); }} alt="" /> @@ -91,10 +107,7 @@ function ChallengeCardBottom({ { - submitLike(); - { - userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); - } + likeSubmitHandelOnClick(); }} alt="" /> diff --git a/src/components/molecules/ChallengeCardFold/index.tsx b/src/components/molecules/ChallengeCardFold/index.tsx index 71167f24..27570fc0 100644 --- a/src/components/molecules/ChallengeCardFold/index.tsx +++ b/src/components/molecules/ChallengeCardFold/index.tsx @@ -27,6 +27,7 @@ function ChallengeCardFold({ id }: IProps): React.ReactElement { useEffect(() => { getCommentList(); }, [isCommentListFlag, getCommentList]); + return ( <> {isOpenComment === false ? ( diff --git a/src/components/molecules/ChallengeCardProfile/index.tsx b/src/components/molecules/ChallengeCardProfile/index.tsx index 08e7636e..d1bcb051 100644 --- a/src/components/molecules/ChallengeCardProfile/index.tsx +++ b/src/components/molecules/ChallengeCardProfile/index.tsx @@ -1,8 +1,8 @@ import { CancelChallengeScrap, ChallengeScrap } from 'apis'; import { ColorScrapIcon, DeleteIcon, EditIcon, GrayScrapIcon, MenuBarIcon } from 'assets/images'; +import { Link } from 'components/atoms'; import dayjs from 'dayjs'; import React, { useState } from 'react'; -import { useHistory } from 'react-router'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; import { @@ -39,7 +39,6 @@ function ChallengeCardProfile({ interest, id, }: IProps): React.ReactElement { - const history = useHistory(); const [isMenuBar, setIsMenuBar] = useState(true); const [scrapRender, setScrapRender] = useState(isScrap); const userStatusData = useRecoilValue(userStatusState); @@ -65,6 +64,23 @@ function ChallengeCardProfile({ } }; + const scrapCancelHandelOnClick = () => { + cancelScrap(); + userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); + }; + + const scrapSubmitHandelOnClick = () => { + submitScrap(); + userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); + }; + + //userState상태 : + // 0: 비회원, + // 1: 챌린지안하는유저, + // 2: 챌린지하는유저, + // 3: 챌린지하는유저&챌린지종료, + // 4: 관리자 + return (
    @@ -82,8 +98,7 @@ function ChallengeCardProfile({ src={GrayScrapIcon} alt="" onClick={() => { - submitScrap(); - userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); + scrapSubmitHandelOnClick(); }} /> @@ -95,8 +110,7 @@ function ChallengeCardProfile({ src={ColorScrapIcon} alt="" onClick={() => { - cancelScrap(); - userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); + scrapCancelHandelOnClick(); }} /> @@ -111,13 +125,11 @@ function ChallengeCardProfile({ > - { - history.push(`/challenge/edit/${id}`); - }} - > - - + + + + + ) : ( From fc137eeca8e6c2c458b8b3ec1081f98a763ac918 Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Tue, 10 Aug 2021 03:10:47 +0900 Subject: [PATCH 53/80] =?UTF-8?q?Style=20:=20any=20=EB=B9=BC=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/ChallengeEditForm/index.tsx | 2 +- .../molecules/ChallengeWriteButton/index.tsx | 2 +- src/components/molecules/ChallengeWriteForm/index.tsx | 2 +- .../molecules/ChallengeWriteInterest/index.tsx | 4 ++-- src/components/organisms/ChallengeEditCard/index.tsx | 4 ++-- src/components/organisms/ChallengeWriteCard/index.tsx | 10 +++++----- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/molecules/ChallengeEditForm/index.tsx b/src/components/molecules/ChallengeEditForm/index.tsx index 9919f375..c826fe9f 100644 --- a/src/components/molecules/ChallengeEditForm/index.tsx +++ b/src/components/molecules/ChallengeEditForm/index.tsx @@ -3,7 +3,7 @@ import { IByte, ITextForm } from 'types/challenge.type'; import { QuestionWrapper } from './style'; interface IProps { - handleTotalOnChange: (e: any) => void; + handleTotalOnChange: (e: React.ChangeEvent) => void; byte: IByte; ITextForm: ITextForm; } diff --git a/src/components/molecules/ChallengeWriteButton/index.tsx b/src/components/molecules/ChallengeWriteButton/index.tsx index 265d9b72..ea687028 100644 --- a/src/components/molecules/ChallengeWriteButton/index.tsx +++ b/src/components/molecules/ChallengeWriteButton/index.tsx @@ -3,7 +3,7 @@ import { BlackButton, ButtonWrapper, ColorButton } from './style'; interface IProps { countProgressBar: number; - handleSubmit: (e: any) => void; + handleSubmit: (e: React.MouseEvent) => void; } function ChallengeWriteButton({ countProgressBar, handleSubmit }: IProps): React.ReactElement { diff --git a/src/components/molecules/ChallengeWriteForm/index.tsx b/src/components/molecules/ChallengeWriteForm/index.tsx index 6d7171d4..50edc6bb 100644 --- a/src/components/molecules/ChallengeWriteForm/index.tsx +++ b/src/components/molecules/ChallengeWriteForm/index.tsx @@ -3,7 +3,7 @@ import { IByte, ITextForm } from 'types/challenge.type'; import { QuestionWrapper } from './style'; interface IProps { - totalOnChange: (e: any) => void; + totalOnChange: (e: React.ChangeEvent) => void; byte: IByte; ITextForm: ITextForm; } diff --git a/src/components/molecules/ChallengeWriteInterest/index.tsx b/src/components/molecules/ChallengeWriteInterest/index.tsx index 54a2ec76..5e69fa3c 100644 --- a/src/components/molecules/ChallengeWriteInterest/index.tsx +++ b/src/components/molecules/ChallengeWriteInterest/index.tsx @@ -69,15 +69,15 @@ function ChallengeWriteInterest({ selectedInterest, setSelectedInterest }: IProp setSelectedInterest(selectedInterest.filter((v) => v !== interest)); } } + setIsClickTag(!isClickTag); }; - const setInterestButton = (id: any, interest: string) => { + const setInterestButton = (id: number, interest: string) => { return ( { modalInterestHandler(interest); - setIsClickTag(!isClickTag); }} style={ selectedInterestStyle[interest] && selectedInterest.indexOf(interest) > -1 diff --git a/src/components/organisms/ChallengeEditCard/index.tsx b/src/components/organisms/ChallengeEditCard/index.tsx index 4a05a603..b837d20b 100644 --- a/src/components/organisms/ChallengeEditCard/index.tsx +++ b/src/components/organisms/ChallengeEditCard/index.tsx @@ -43,7 +43,7 @@ function EditCard({ id }: IEditCard): React.ReactElement { }); }; - const handleSubmit = async (e: any) => { + const handleSubmit = async (e: React.MouseEvent) => { e.preventDefault(); setTextForm({ description1: '', @@ -76,7 +76,7 @@ function EditCard({ id }: IEditCard): React.ReactElement { setCountProgressBar(count); }; - const handleTotalOnChange = (e: any) => { + const handleTotalOnChange = (e: React.ChangeEvent) => { const text_val = e.target.value; //입력한 문자 const target_byte_name = 'byte' + e.target.name.split('description')[1]; let str = ''; diff --git a/src/components/organisms/ChallengeWriteCard/index.tsx b/src/components/organisms/ChallengeWriteCard/index.tsx index ca26decb..abe0d176 100644 --- a/src/components/organisms/ChallengeWriteCard/index.tsx +++ b/src/components/organisms/ChallengeWriteCard/index.tsx @@ -11,11 +11,11 @@ import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; import { Header } from './style'; -type MyFormProps = { +interface IProps { onChangeForm: (form: { description1: string; description2: string; description3: string }) => void; -}; +} -function WriteCard({ onChangeForm }: MyFormProps): React.ReactElement { +function WriteCard({ onChangeForm }: IProps): React.ReactElement { const history = useHistory(); const userStatusData = useRecoilValue(userStatusState); const [countProgressBar, setCountProgressBar] = useState(0); //프로그래스바 @@ -43,7 +43,7 @@ function WriteCard({ onChangeForm }: MyFormProps): React.ReactElement { }); }; - const handleSubmit = async (e: any) => { + const handleSubmit = async (e: React.MouseEvent) => { setUserData({ ...userData, interest: selectedInterest }); e.preventDefault(); onChangeForm(textForm); @@ -78,7 +78,7 @@ function WriteCard({ onChangeForm }: MyFormProps): React.ReactElement { setCountProgressBar(count); }, [byte.byte1, byte.byte2, byte.byte3]); - const totalOnChange = (e: any) => { + const totalOnChange = (e: React.ChangeEvent) => { const text_val = e.target.value; //입력한 문자 const target_byte_name = 'byte' + e.target.name.split('description')[1]; let str = ''; From 3d9fef3d3ed63b23dbe9409a0e7b1f217046de2c Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Tue, 10 Aug 2021 03:11:40 +0900 Subject: [PATCH 54/80] =?UTF-8?q?Refactor=20:=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=ED=83=9C=EA=B7=B8=20=EB=B9=BC=EA=B8=B0=20?= =?UTF-8?q?=EB=B0=8F=20css=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/organisms/ChallengeDetailCard/index.tsx | 1 + src/pages/ChallengeList/template/style.ts | 1 - src/pages/ChallengeRegister/index.tsx | 6 +----- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/components/organisms/ChallengeDetailCard/index.tsx b/src/components/organisms/ChallengeDetailCard/index.tsx index 74551039..d8b25205 100644 --- a/src/components/organisms/ChallengeDetailCard/index.tsx +++ b/src/components/organisms/ChallengeDetailCard/index.tsx @@ -88,6 +88,7 @@ function ChallengeDetailCard({ { { - return ( -
    - -
    - ); + return ; }; export default ChallengeRegister; From b3c1c47c88cb56380181d5045244a64124c6ff16 Mon Sep 17 00:00:00 2001 From: Subin Date: Tue, 10 Aug 2021 11:17:27 +0900 Subject: [PATCH 55/80] =?UTF-8?q?Refactor:=20StyledInput=20onChange=20?= =?UTF-8?q?=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20=ED=83=80=EC=9E=85?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/atoms/StyledInput/index.tsx | 2 +- .../AdminChallengeOpenForm/index.tsx | 12 ++-- .../molecules/FindPwdForm/index.tsx | 4 +- .../organisms/AdminWriteForm/index.tsx | 4 +- src/components/organisms/JoinForm/index.tsx | 8 +-- src/components/organisms/LoginForm/index.tsx | 4 +- src/pages/AdminChallengeOpen/index.tsx | 57 +++++++++---------- .../AdminChallengeOpen/template/index.tsx | 12 ++-- src/pages/Login/index.tsx | 4 +- src/pages/Login/template/index.tsx | 4 +- 10 files changed, 53 insertions(+), 58 deletions(-) diff --git a/src/components/atoms/StyledInput/index.tsx b/src/components/atoms/StyledInput/index.tsx index 45bcae25..a649fb31 100644 --- a/src/components/atoms/StyledInput/index.tsx +++ b/src/components/atoms/StyledInput/index.tsx @@ -7,7 +7,7 @@ export interface IProps { className?: string; errorMsg?: string; placeHolder?: string; - onChange: (value: string | number) => void; + onChange: (value: string) => void; isConditionMet: boolean; width: string; height: string; diff --git a/src/components/molecules/AdminChallengeOpenForm/index.tsx b/src/components/molecules/AdminChallengeOpenForm/index.tsx index 9b3776aa..ecc81282 100644 --- a/src/components/molecules/AdminChallengeOpenForm/index.tsx +++ b/src/components/molecules/AdminChallengeOpenForm/index.tsx @@ -5,12 +5,12 @@ import { PeopleContainer, PeriodContainer, Text, Wrapper, WriteLabel } from './s export interface IProps { isConditionMet: IConditionMet; - handleTitleOnChange: (value: string | number) => void; - handleChallengeStOnChange: (value: string | number) => void; - handleChallengeEndOnChange: (value: string | number) => void; - handleApplyStOnChange: (value: string | number) => void; - handleApplyEndOnChange: (value: string | number) => void; - handleNumOnChange: (value: string | number) => void; + handleTitleOnChange: (value: string) => void; + handleChallengeStOnChange: (value: string) => void; + handleChallengeEndOnChange: (value: string) => void; + handleApplyStOnChange: (value: string) => void; + handleApplyEndOnChange: (value: string) => void; + handleNumOnChange: (value: string) => void; } function AdminChallengeOpenForm({ diff --git a/src/components/molecules/FindPwdForm/index.tsx b/src/components/molecules/FindPwdForm/index.tsx index 549823ad..a88f99e1 100644 --- a/src/components/molecules/FindPwdForm/index.tsx +++ b/src/components/molecules/FindPwdForm/index.tsx @@ -75,7 +75,7 @@ function FindPWDForm({ setData, isConditionMet, setIsConditionMet, errMsg }: IPr width="258px" height="60px" onChange={(value) => { - if (typeof value === 'string') setEmail(value); + setEmail(value); }} isConditionMet={isConditionMet.email} errorMsg={emailErrMsg} @@ -90,7 +90,7 @@ function FindPWDForm({ setData, isConditionMet, setIsConditionMet, errMsg }: IPr width="406px" height="60px" onChange={(value) => { - if (typeof value === 'string') setCertifiNum(value); + setCertifiNum(value); }} isConditionMet={isConditionMet.certifiNum} errorMsg={errMsg} diff --git a/src/components/organisms/AdminWriteForm/index.tsx b/src/components/organisms/AdminWriteForm/index.tsx index b5c0deb2..c71306b4 100644 --- a/src/components/organisms/AdminWriteForm/index.tsx +++ b/src/components/organisms/AdminWriteForm/index.tsx @@ -142,7 +142,7 @@ function AdminWriteForm({ width="598px" height="60px" onChange={(value) => { - if (typeof value === 'string') setWriteData({ ...writeData, title: value }); + setWriteData({ ...writeData, title: value }); }} isConditionMet={isConditionMet.title} /> @@ -154,7 +154,7 @@ function AdminWriteForm({ width="222px" height="60px" onChange={(value) => { - if (typeof value === 'string') setWriteData({ ...writeData, nickname: value }); + setWriteData({ ...writeData, nickname: value }); }} isConditionMet={isConditionMet.nickname} /> diff --git a/src/components/organisms/JoinForm/index.tsx b/src/components/organisms/JoinForm/index.tsx index 8ba463b7..dd29d288 100644 --- a/src/components/organisms/JoinForm/index.tsx +++ b/src/components/organisms/JoinForm/index.tsx @@ -69,7 +69,7 @@ function JoinForm({ isConditionMet, userData, setUserData, setIsConditionMet }: height="60px" errorMsg="올바르지 않은 형식입니다" onChange={(value) => { - if (typeof value === 'string') setUserData({ ...userData, email: value }); + setUserData({ ...userData, email: value }); }} isConditionMet={isConditionMet.email} /> @@ -80,7 +80,7 @@ function JoinForm({ isConditionMet, userData, setUserData, setIsConditionMet }: height="60px" errorMsg="영어 대문자, 소문자, 특수문자가 포함되어야 합니다" onChange={(value) => { - if (typeof value === 'string') setUserData({ ...userData, password: value }); + setUserData({ ...userData, password: value }); }} isConditionMet={isConditionMet.password} /> @@ -90,7 +90,7 @@ function JoinForm({ isConditionMet, userData, setUserData, setIsConditionMet }: height="60px" errorMsg="비밀번호가 일치하지 않습니다" onChange={(value) => { - if (typeof value === 'string') setUserData({ ...userData, passwordCheck: value }); + setUserData({ ...userData, passwordCheck: value }); }} isConditionMet={isConditionMet.passwordCheck} margin="14px 0 0 0" @@ -102,7 +102,7 @@ function JoinForm({ isConditionMet, userData, setUserData, setIsConditionMet }: height="60px" errorMsg="닉네임은 최대 6글자로 한글, 숫자, 밑줄 및 마침표만 사용할 수 있습니다" onChange={(value) => { - if (typeof value === 'string') setUserData({ ...userData, nickname: value }); + setUserData({ ...userData, nickname: value }); }} isConditionMet={isConditionMet.nickname} /> diff --git a/src/components/organisms/LoginForm/index.tsx b/src/components/organisms/LoginForm/index.tsx index 56b7b07c..7e9d3fd1 100644 --- a/src/components/organisms/LoginForm/index.tsx +++ b/src/components/organisms/LoginForm/index.tsx @@ -3,8 +3,8 @@ import React from 'react'; import { LoginformWrap } from './style'; interface IProps { - idInputChange: (value: string | number) => void; - pwdInputChange: (value: string | number) => void; + idInputChange: (value: string) => void; + pwdInputChange: (value: string) => void; isConditionMet: { email: boolean; pwd: boolean; diff --git a/src/pages/AdminChallengeOpen/index.tsx b/src/pages/AdminChallengeOpen/index.tsx index 3b51e872..17301ba6 100644 --- a/src/pages/AdminChallengeOpen/index.tsx +++ b/src/pages/AdminChallengeOpen/index.tsx @@ -47,42 +47,37 @@ function AdminChallengeOpen(): React.ReactElement { } }; const CheckDatePattern = (date: string) => /[0-9]{4}.[0-9]{2}.[0-9]{2}$/.test(date); - const handleTitleOnChange = (value: string | number) => { - if (typeof value === 'string') setChallengeOpenData({ ...challengeOpenData, title: value }); + const handleTitleOnChange = (value: string) => { + setChallengeOpenData({ ...challengeOpenData, title: value }); }; - const handleChallengeStOnChange = (value: string | number) => { - if (typeof value === 'string') - setChallengeOpenData({ - ...challengeOpenData, - challengePeriod: { ...challengeOpenData.challengePeriod, start: value }, - }); + const handleChallengeStOnChange = (value: string) => { + setChallengeOpenData({ + ...challengeOpenData, + challengePeriod: { ...challengeOpenData.challengePeriod, start: value }, + }); }; - const handleChallengeEndOnChange = (value: string | number) => { - if (typeof value === 'string') - setChallengeOpenData({ - ...challengeOpenData, - challengePeriod: { ...challengeOpenData.challengePeriod, end: value }, - }); + const handleChallengeEndOnChange = (value: string) => { + setChallengeOpenData({ + ...challengeOpenData, + challengePeriod: { ...challengeOpenData.challengePeriod, end: value }, + }); }; - const handleApplyStOnChange = (value: string | number) => { - if (typeof value === 'string') - setChallengeOpenData({ - ...challengeOpenData, - applyPeriod: { ...challengeOpenData.applyPeriod, start: value }, - }); + const handleApplyStOnChange = (value: string) => { + setChallengeOpenData({ + ...challengeOpenData, + applyPeriod: { ...challengeOpenData.applyPeriod, start: value }, + }); }; - const handleApplyEndOnChange = (value: string | number) => { - if (typeof value === 'string') - setChallengeOpenData({ - ...challengeOpenData, - applyPeriod: { ...challengeOpenData.applyPeriod, end: value }, - }); + const handleApplyEndOnChange = (value: string) => { + setChallengeOpenData({ + ...challengeOpenData, + applyPeriod: { ...challengeOpenData.applyPeriod, end: value }, + }); }; - const handleNumOnChange = (value: string | number) => { - if (typeof value === 'string') - if (!isNaN(Number(value))) { - setChallengeOpenData({ ...challengeOpenData, peopleNum: Number(value) }); - } + const handleNumOnChange = (value: string) => { + if (!isNaN(Number(value))) { + setChallengeOpenData({ ...challengeOpenData, peopleNum: Number(value) }); + } }; useEffect(() => { diff --git a/src/pages/AdminChallengeOpen/template/index.tsx b/src/pages/AdminChallengeOpen/template/index.tsx index 76918a2f..78cd9a9c 100644 --- a/src/pages/AdminChallengeOpen/template/index.tsx +++ b/src/pages/AdminChallengeOpen/template/index.tsx @@ -23,12 +23,12 @@ interface IProps { checkHandler: () => void; isButtonDisabled: boolean; btnHandler: () => Promise; - handleTitleOnChange: (value: string | number) => void; - handleChallengeStOnChange: (value: string | number) => void; - handleChallengeEndOnChange: (value: string | number) => void; - handleApplyStOnChange: (value: string | number) => void; - handleApplyEndOnChange: (value: string | number) => void; - handleNumOnChange: (value: string | number) => void; + handleTitleOnChange: (value: string) => void; + handleChallengeStOnChange: (value: string) => void; + handleChallengeEndOnChange: (value: string) => void; + handleApplyStOnChange: (value: string) => void; + handleApplyEndOnChange: (value: string) => void; + handleNumOnChange: (value: string) => void; } function AdminChallengeOpenTemplate({ diff --git a/src/pages/Login/index.tsx b/src/pages/Login/index.tsx index 13b44c3d..67cbb855 100644 --- a/src/pages/Login/index.tsx +++ b/src/pages/Login/index.tsx @@ -19,10 +19,10 @@ function Login(): React.ReactElement { pwd: true, }); - const idInputChange = (value: string | number) => { + const idInputChange = (value: string) => { if (typeof value === 'string') setLoginData({ ...loginData, email: value }); }; - const pwdInputChange = (value: string | number) => { + const pwdInputChange = (value: string) => { if (typeof value === 'string') setLoginData({ ...loginData, password: value }); }; diff --git a/src/pages/Login/template/index.tsx b/src/pages/Login/template/index.tsx index aabd2715..c5c60116 100644 --- a/src/pages/Login/template/index.tsx +++ b/src/pages/Login/template/index.tsx @@ -6,8 +6,8 @@ import { ButtonWrapper, FindPwdBtn, JoinBtn, Line, LoginBtn, LoginContainer, Log interface IProps { handleLoginBtn: () => Promise; - idInputChange: (value: string | number) => void; - pwdInputChange: (value: string | number) => void; + idInputChange: (value: string) => void; + pwdInputChange: (value: string) => void; isConditionMet: { email: boolean; pwd: boolean; From 6ab81316e96e6ab79d6e54099ebfcd0fbbf953ca Mon Sep 17 00:00:00 2001 From: JiyoungHyun Date: Tue, 10 Aug 2021 18:49:54 +0900 Subject: [PATCH 56/80] =?UTF-8?q?Style:=20=EC=BD=98=EC=84=9C=ED=8A=B8=20wa?= =?UTF-8?q?rning=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/concert.api.ts | 17 ++++++++++----- src/pages/ConcertDetail/index.tsx | 6 +++--- src/pages/ConcertDetail/template/index.tsx | 4 ++-- src/types/concert.type.ts | 24 ++++++++++++++++++++++ 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/apis/concert.api.ts b/src/apis/concert.api.ts index bc95b0cd..4679a654 100644 --- a/src/apis/concert.api.ts +++ b/src/apis/concert.api.ts @@ -1,5 +1,12 @@ import { serverAxios } from 'libs/axios'; -import { IConcert, IConcertCommentData, IConcertList, IFetchComment, IFetchParameter } from '../types/concert.type'; +import { + IConcert, + IConcertCommentData, + IConcertList, + IFetchComment, + IFetchParameter, + IUserConcert, +} from '../types/concert.type'; const PREFIX_URL = '/concert'; @@ -24,7 +31,7 @@ export const getConcertListData = async (token: string): Promise { +export const getConcertData = async (concertID: string): Promise => { try { const data = await serverAxios.get(`${PREFIX_URL}/${concertID}`, { params: { @@ -38,11 +45,11 @@ export const getConcertData = async (concertID: string) => { } } catch (e) { alert(e.response.data.message); - return undefined; + return null; } }; -export const getConcertUserData = async (token: string, concertID: string) => { +export const getConcertUserData = async (token: string, concertID: string): Promise => { try { const data = await serverAxios.get(`${PREFIX_URL}/${concertID}`, { headers: { @@ -59,7 +66,7 @@ export const getConcertUserData = async (token: string, concertID: string) => { } } catch (e) { alert(e.response.data.message); - return undefined; + return null; } }; diff --git a/src/pages/ConcertDetail/index.tsx b/src/pages/ConcertDetail/index.tsx index fe6003de..023fc10c 100644 --- a/src/pages/ConcertDetail/index.tsx +++ b/src/pages/ConcertDetail/index.tsx @@ -10,7 +10,7 @@ import React, { useCallback, useEffect, useState } from 'react'; import { RouteComponentProps } from 'react-router'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; -import { IConcert } from 'types/concert.type'; +import { IConcertComment, IUserConcert } from 'types/concert.type'; import ConcertDetailTemplate from './template'; interface MatchParams { @@ -19,8 +19,8 @@ interface MatchParams { function ConcertDetail({ match }: RouteComponentProps): React.ReactElement { const { id } = match.params; - const [concert, setConcert] = useState(null); - const [commentList, setCommentList] = useState([]); + const [concert, setConcert] = useState(null); + const [commentList, setCommentList] = useState([]); const [likeNum, setLikeNum] = useState(0); const [scrapNum, setScrapNum] = useState(0); const userStatusData = useRecoilValue(userStatusState); diff --git a/src/pages/ConcertDetail/template/index.tsx b/src/pages/ConcertDetail/template/index.tsx index 1e6499bf..bda8e084 100644 --- a/src/pages/ConcertDetail/template/index.tsx +++ b/src/pages/ConcertDetail/template/index.tsx @@ -1,10 +1,10 @@ import { DetailTitle, LoginModal } from 'components/molecules'; import { CommentList, DetailContent } from 'components/organisms'; import React from 'react'; -import { IConcert, IConcertComment } from 'types/concert.type'; +import { IConcertComment, IUserConcert } from 'types/concert.type'; import { ConcertDetailWrapper } from './style'; interface IProps { - concert: IConcert | null; + concert: IUserConcert | null; likeNum?: number; scrapNum?: number; onLike?: () => void; diff --git a/src/types/concert.type.ts b/src/types/concert.type.ts index ecb6e653..d735462c 100644 --- a/src/types/concert.type.ts +++ b/src/types/concert.type.ts @@ -19,6 +19,30 @@ export interface IConcert { authorNickname: string; __v: number; } + +export interface IUserConcert { + authorNickname: string; + commentNum: number; + comments: IConcertComment[]; + createdAt: string; + hashtag: string[]; + imgThumbnail: string; + interest: string[]; + isDeleted: boolean; + isLike: boolean; + isNotice: boolean; + isScrap: boolean; + likes: number; + scrapNum: number; + text: string; + title: string; + updatedAt: string; + user: { img: string; nickname: string; _id: string }; + videoLink: string; + __v: number; + _id: string; +} + export interface IConcertList { concerts: IConcert[]; totalConcertNum: number; From a85ac405df6fcc746656f3dfebe70a1de9f3af5c Mon Sep 17 00:00:00 2001 From: JiyoungHyun Date: Tue, 10 Aug 2021 18:57:49 +0900 Subject: [PATCH 57/80] =?UTF-8?q?Style:=20=EA=B3=B5=EC=A7=80=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20warning=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/notice.api.ts | 5 +++-- src/pages/NoticeDetail/index.tsx | 8 ++++---- src/types/notice.type.ts | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/apis/notice.api.ts b/src/apis/notice.api.ts index 858ff451..7b7d1d02 100644 --- a/src/apis/notice.api.ts +++ b/src/apis/notice.api.ts @@ -2,6 +2,7 @@ import { serverAxios } from 'libs/axios'; import { IFetchComment, IFetchParameter, + INotice, INoticeCommentData, INoticeList, ISearchNoticeList, @@ -28,11 +29,11 @@ export const getNoticeListData = async ({ limit = 8, offset = 0 }: IFetchParamet } }; -export const getNoticeData = async (noticeID: string) => { +export const getNoticeData = async (noticeID: string): Promise => { try { const data = await serverAxios.get(`${PREFIX_URL}/${noticeID}`, {}); if (data.data.status === 200) { - return data.data.data; + return data.data.data[0]; } else { return null; } diff --git a/src/pages/NoticeDetail/index.tsx b/src/pages/NoticeDetail/index.tsx index 3208cec4..34759844 100644 --- a/src/pages/NoticeDetail/index.tsx +++ b/src/pages/NoticeDetail/index.tsx @@ -1,7 +1,7 @@ import { getNoticeData } from 'apis'; import React, { useCallback, useEffect, useState } from 'react'; import { RouteComponentProps } from 'react-router'; -import { INotice } from 'types/notice.type'; +import { INotice, INoticeComment } from 'types/notice.type'; import NoticeDetailTemplate from './template'; interface MatchParams { id: string; @@ -10,13 +10,13 @@ interface MatchParams { function NoticeDetail({ match }: RouteComponentProps): React.ReactElement { const { id } = match.params; const [notice, setNotice] = useState(null); - const [commentList, setCommentList] = useState([]); + const [commentList, setCommentList] = useState([]); const [isRerender, setIsRerender] = useState(false); const getNoticeContent = useCallback(async () => { const data = await getNoticeData(id); - data[0] && setNotice(data[0]); - data[0] && setCommentList(data[0].comments); + data && setNotice(data); + data && setCommentList(data.comments); }, [id]); useEffect(() => { diff --git a/src/types/notice.type.ts b/src/types/notice.type.ts index ffb00266..e213464c 100644 --- a/src/types/notice.type.ts +++ b/src/types/notice.type.ts @@ -1,6 +1,6 @@ export interface INotice { commentNum: number; - comments: string[]; + comments: INoticeComment[]; createdAt: string; hashtag: string[]; imgThumbnail: string; From 4637b24cd338485eb0979af9281b34a7039e28b1 Mon Sep 17 00:00:00 2001 From: JiyoungHyun Date: Tue, 10 Aug 2021 21:16:11 +0900 Subject: [PATCH 58/80] =?UTF-8?q?Refactor:=20concert,=20notice=20=EB=8C=93?= =?UTF-8?q?=EA=B8=80=20=EC=82=AD=EC=A0=9C=20=EC=B2=98=EB=A6=AC=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/NoticeSingleComment/index.tsx | 6 ++++-- src/components/molecules/ReplyComment/index.tsx | 5 +++-- src/components/molecules/SingleComment/index.tsx | 6 ++++-- src/components/organisms/CommentList/index.tsx | 1 + src/components/organisms/NoticeCommentList/index.tsx | 1 + src/types/concert.type.ts | 10 +++++++--- src/types/notice.type.ts | 10 +++++++--- 7 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/components/molecules/NoticeSingleComment/index.tsx b/src/components/molecules/NoticeSingleComment/index.tsx index 6e41e566..991b3247 100644 --- a/src/components/molecules/NoticeSingleComment/index.tsx +++ b/src/components/molecules/NoticeSingleComment/index.tsx @@ -26,7 +26,7 @@ interface IProps { }; text?: string; }[]; - isDeleted?: boolean; + isDeleted: boolean; parentCommentID: string; userID: { img: string; @@ -47,6 +47,7 @@ function NoticeSingleComment({ noticeID, isRerender, setIsRerender, + isDeleted, }: IProps): React.ReactElement { const [isOpenReply, setIsOpenReply] = useState(false); const [replyValue, setReplyValue] = useState(''); @@ -75,7 +76,7 @@ function NoticeSingleComment({ {userID?.nickname} - {text} + {isDeleted ? '삭제된 댓글입니다.' : text} {isOpenReply ? '접기' : '답글보기'} @@ -94,6 +95,7 @@ function NoticeSingleComment({ img={data.userID?.img} nickname={data.userID?.nickname} text={data.text} + isDeleted={data.isDeleted} > ))} diff --git a/src/components/molecules/ReplyComment/index.tsx b/src/components/molecules/ReplyComment/index.tsx index 1db28239..1b210206 100644 --- a/src/components/molecules/ReplyComment/index.tsx +++ b/src/components/molecules/ReplyComment/index.tsx @@ -6,14 +6,15 @@ interface IProps { text?: string; className?: string; img?: string; + isDeleted?: boolean; } -function ReplyComment({ nickname, text, img }: IProps): React.ReactElement { +function ReplyComment({ nickname, text, img, isDeleted }: IProps): React.ReactElement { return ( {nickname} - {text} + {isDeleted ? '삭제된 댓글입니다.' : text} ); } diff --git a/src/components/molecules/SingleComment/index.tsx b/src/components/molecules/SingleComment/index.tsx index 5e98c144..16f96107 100644 --- a/src/components/molecules/SingleComment/index.tsx +++ b/src/components/molecules/SingleComment/index.tsx @@ -26,7 +26,7 @@ interface IProps { }; text?: string; }[]; - isDeleted?: boolean; + isDeleted: boolean; parentCommentID: string; userID: { img: string; @@ -47,6 +47,7 @@ function SingleComment({ concertID, isRerender, setIsRerender, + isDeleted, }: IProps): React.ReactElement { const [isOpenReply, setIsOpenReply] = useState(false); const [replyValue, setReplyValue] = useState(''); @@ -75,7 +76,7 @@ function SingleComment({ {userID?.nickname} - {text} + {isDeleted ? '삭제된 댓글입니다.' : text} {isOpenReply ? '접기' : '답글보기'} @@ -94,6 +95,7 @@ function SingleComment({ img={data.userID?.img} nickname={data.userID?.nickname} text={data.text} + isDeleted={data.isDeleted} > ))} diff --git a/src/components/organisms/CommentList/index.tsx b/src/components/organisms/CommentList/index.tsx index 998b1b20..d27a0c84 100644 --- a/src/components/organisms/CommentList/index.tsx +++ b/src/components/organisms/CommentList/index.tsx @@ -52,6 +52,7 @@ function CommentList({ commentList, concertID, isRerender, setIsRerender }: IPro concertID={concertID} isRerender={isRerender} setIsRerender={setIsRerender} + isDeleted={data.isDeleted} > ))} diff --git a/src/components/organisms/NoticeCommentList/index.tsx b/src/components/organisms/NoticeCommentList/index.tsx index c16988e0..1d93d453 100644 --- a/src/components/organisms/NoticeCommentList/index.tsx +++ b/src/components/organisms/NoticeCommentList/index.tsx @@ -52,6 +52,7 @@ function NoticeCommentList({ commentList, noticeID, isRerender, setIsRerender }: noticeID={noticeID} isRerender={isRerender} setIsRerender={setIsRerender} + isDeleted={data.isDeleted} > ))} diff --git a/src/types/concert.type.ts b/src/types/concert.type.ts index d735462c..4044feca 100644 --- a/src/types/concert.type.ts +++ b/src/types/concert.type.ts @@ -50,12 +50,16 @@ export interface IConcertList { export interface IConcertComment { childrenComment: { + idDeleted: boolean; _id: string; - nickname: string; + userID: { + img: string; + _id: string; + nickname: string; + }; text: string; - createdAt?: string; }[]; - isDeleted?: boolean; + isDeleted: boolean; _id: string; userID: { img: string; diff --git a/src/types/notice.type.ts b/src/types/notice.type.ts index e213464c..d7b34ba2 100644 --- a/src/types/notice.type.ts +++ b/src/types/notice.type.ts @@ -28,12 +28,16 @@ export interface ISearchNoticeList { export interface INoticeComment { childrenComment: { + idDeleted: boolean; _id: string; - nickname: string; + userID: { + img: string; + _id: string; + nickname: string; + }; text: string; - createdAt?: string; }[]; - isDeleted?: boolean; + isDeleted: boolean; _id: string; userID: { img: string; From 19d43793faf847584fddd9210517b1df74e925fc Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Mon, 9 Aug 2021 01:05:07 +0900 Subject: [PATCH 59/80] =?UTF-8?q?Refactor:=20=EC=B1=8C=EB=A6=B0=EC=A7=80?= =?UTF-8?q?=20=EB=AA=A8=EB=8B=AC=EC=B0=BD=20=EB=AA=A8=EB=93=88=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organisms/MyPageCommentModal/index.tsx | 60 ++++++++++ .../organisms/MyPageCommentModal/style.ts | 104 ++++++++++++++++++ src/pages/MyPage/template/index.tsx | 44 ++------ src/pages/MyPage/template/style.ts | 104 +----------------- 4 files changed, 175 insertions(+), 137 deletions(-) create mode 100644 src/components/organisms/MyPageCommentModal/index.tsx create mode 100644 src/components/organisms/MyPageCommentModal/style.ts diff --git a/src/components/organisms/MyPageCommentModal/index.tsx b/src/components/organisms/MyPageCommentModal/index.tsx new file mode 100644 index 00000000..883047e7 --- /dev/null +++ b/src/components/organisms/MyPageCommentModal/index.tsx @@ -0,0 +1,60 @@ +import { Modal } from 'components/atoms'; +import { ChallengeModalComment } from 'components/molecules'; +import dayjs from 'dayjs'; +import React from 'react'; +import { IChallenge } from 'types/challenge.type'; +import * as S from './style'; + +export interface IProps { + isFolded: boolean; + isChallengeModalOpen: boolean; + challenge: IChallenge | null; + handleCommentFold: () => void; + setIsChallengeModalOpen: (value: boolean) => void; + handleChallengeModalOpen: () => void; +} + +function MyPageCommentModal({ + isFolded, + isChallengeModalOpen, + challenge, + handleCommentFold, + setIsChallengeModalOpen, + handleChallengeModalOpen, +}: IProps): React.ReactElement { + return ( + + + + + + +
    +
    {challenge?.user?.nickname}
    +
    {dayjs().format('MM.DD')}
    +
    +
    {challenge?.interest?.map((item: string) => `#${item} `)}
    +
    +
    + +

    잘한 점

    +

    {challenge?.good}

    +

    못한 점

    +

    {challenge?.bad}

    +

    배운 점

    +

    {challenge?.learn}

    +
    + {isFolded ? '더보기' : '접기'} + + {challenge?.comments.map((comment) => ( + + ))} + +
    + 닫기 +
    +
    + ); +} + +export default MyPageCommentModal; diff --git a/src/components/organisms/MyPageCommentModal/style.ts b/src/components/organisms/MyPageCommentModal/style.ts new file mode 100644 index 00000000..9cafaf1c --- /dev/null +++ b/src/components/organisms/MyPageCommentModal/style.ts @@ -0,0 +1,104 @@ +import { Button, Img } from 'components/atoms'; +import Styled from 'styled-components'; +import { ifProp, palette, theme } from 'styled-tools'; + +export const ChallengeModalWrapper = Styled.div` + position: fixed; + top:0; + right:0; + bottom:0; + left:0; + margin:auto; + border-radius: 18px; + width: 844px; + height: 607px; +`; + +export const ModalWrapper = Styled.div` + width: 100%; + height: 544px; + border-radius: 18px 18px 0 0; + overflow: auto; + display: flex; + flex-direction: column; + align-items: center; + background-color: #fff; +`; + +export const ModalUserInfo = Styled.div` + display: flex; + margin: 40px 30px 20px 30px; + width: calc(100% - 60px); + height: 80px; +`; + +export const ModalUserImg = Styled(Img)` + margin-right: 15px; + border-radius: 50%; + width: 80px; + height: 80px; +`; + +export const ModalUserInfoWrapper = Styled.div` + display: flex; + justify-content: center; + flex-direction: column; + + div:first-child { + ${theme('font.subhead5')}; + display: flex; + align-items: center; + color: ${palette('grayscale', 7)}; + + div:nth-child(2) { + ${theme('font.body2')}; + margin: auto 10px; + color: ${palette('grayscale', 4)}; + } + } + + div:nth-child(2) { + ${theme('font.subhead2')}; + color: ${palette('grayscale', 5)}; + } +`; + +export const CommentWrapper = Styled.div` + margin: 0 60px; + width: calc(100% - 120px); +`; + +export const CloseButton = Styled(Button)` + ${theme('font.subhead3')}; + position: absolute; + bottom: 0px; + width: 100%; + height: 63px; + color: #fff; + background-color: ${palette('grayscale', 7)}; + border-radius: 0 0 18px 18px; +`; + +export const MoreButton = Styled(Button)` + ${theme('font.subhead4')}; + color: ${palette('primary', 5)}; + margin: 50px 0; +`; + +export const TextArea = Styled.div<{ isFolded: boolean }>` + margin: 0 60px; + width: calc(100% - 120px); + h3 { + ${theme('font.subhead3')}; + margin: 30px 0 6px 0; + color: ${palette('grayscale', 7)}; + } + p { + ${theme('font.body3')}; + color: ${palette('grayscale', 6)}; + word-wrap: break-word; + overflow: ${ifProp('isFolded', 'hidden')}; + text-overflow: ${ifProp('isFolded', 'ellipsis')}; + white-space: ${ifProp('isFolded', 'nowrap')}; + } +`; diff --git a/src/pages/MyPage/template/index.tsx b/src/pages/MyPage/template/index.tsx index aa56d079..4ec382c7 100644 --- a/src/pages/MyPage/template/index.tsx +++ b/src/pages/MyPage/template/index.tsx @@ -1,7 +1,6 @@ -import { Modal } from 'components/atoms'; -import { ChallengeModalComment, DeleteModal, MyPageSection } from 'components/molecules'; +import { DeleteModal, MyPageSection } from 'components/molecules'; import { MyCommentList, MyPageHeader } from 'components/organisms'; -import dayjs from 'dayjs'; +import MyPageCommentModal from 'components/organisms/MyPageCommentModal'; import React from 'react'; import { IChallenge, IChallengeData } from 'types/challenge.type'; import { IConcert } from 'types/concert.type'; @@ -149,37 +148,14 @@ function MyPageTemplate({ setIsDeleteModalOpen={setIsModalOpened} onClickDeleteButton={deleteSelectedCommentList} /> - - - - - - -
    -
    {challenge?.user?.nickname}
    -
    {dayjs().format('MM.DD')}
    -
    -
    {challenge?.interest?.map((item: string) => `#${item} `)}
    -
    -
    - -

    잘한 점

    -

    {challenge?.good}

    -

    못한 점

    -

    {challenge?.bad}

    -

    배운 점

    -

    {challenge?.learn}

    -
    - {isFolded ? '더보기' : '접기'} - - {challenge?.comments.map((comment) => ( - - ))} - -
    - 닫기 -
    -
    + ); } diff --git a/src/pages/MyPage/template/style.ts b/src/pages/MyPage/template/style.ts index d0bd41f0..6daea096 100644 --- a/src/pages/MyPage/template/style.ts +++ b/src/pages/MyPage/template/style.ts @@ -1,107 +1,5 @@ -import { Button, Img } from 'components/atoms'; import Styled from 'styled-components'; -import { ifProp, palette, theme } from 'styled-tools'; - -export const ChallengeModalWrapper = Styled.div` - position: fixed; - top:0; - right:0; - bottom:0; - left:0; - margin:auto; - border-radius: 18px; - width: 844px; - height: 607px; -`; - -export const CommentWrapper = Styled.div` - margin: 0 60px; - width: calc(100% - 120px); -`; - -export const CloseButton = Styled(Button)` - ${theme('font.subhead3')}; - position: absolute; - bottom: 0px; - width: 100%; - height: 63px; - color: #fff; - background-color: ${palette('grayscale', 7)}; - border-radius: 0 0 18px 18px; -`; - -export const MoreButton = Styled(Button)` - ${theme('font.subhead4')}; - color: ${palette('primary', 5)}; - margin: 50px 0; -`; - -export const TextArea = Styled.div<{ isFolded: boolean }>` - margin: 0 60px; - width: calc(100% - 120px); - h3 { - ${theme('font.subhead3')}; - margin: 30px 0 6px 0; - color: ${palette('grayscale', 7)}; - } - p { - ${theme('font.body3')}; - color: ${palette('grayscale', 6)}; - word-wrap: break-word; - overflow: ${ifProp('isFolded', 'hidden')}; - text-overflow: ${ifProp('isFolded', 'ellipsis')}; - white-space: ${ifProp('isFolded', 'nowrap')}; - } -`; - -export const ModalWrapper = Styled.div` -width: 100%; -height: 544px; -border-radius: 18px 18px 0 0; -overflow: auto; -display: flex; -flex-direction: column; -align-items: center; -background-color: #fff; -`; - -export const ModalUserInfo = Styled.div` -display: flex; -margin: 40px 30px 20px 30px; -width: calc(100% - 60px); -height: 80px; -`; - -export const ModalUserImg = Styled(Img)` -margin-right: 15px; -border-radius: 50%; -width: 80px; -height: 80px; -`; - -export const ModalUserInfoWrapper = Styled.div` - display: flex; - justify-content: center; - flex-direction: column; - - div:first-child { - ${theme('font.subhead5')}; - display: flex; - align-items: center; - color: ${palette('grayscale', 7)}; - - div:nth-child(2) { - ${theme('font.body2')}; - margin: auto 10px; - color: ${palette('grayscale', 4)}; - } - } - - div:nth-child(2) { - ${theme('font.subhead2')}; - color: ${palette('grayscale', 5)}; - } -`; +import { palette, theme } from 'styled-tools'; export const SwitchRadio = Styled.input` display: none; From e66b34d81b24139ba084f7a2345205b3c65fabf4 Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Mon, 9 Aug 2021 01:05:22 +0900 Subject: [PATCH 60/80] =?UTF-8?q?Fix:=20=EB=AA=A8=EB=8B=AC=20=ED=95=B8?= =?UTF-8?q?=EB=93=A4=EB=A7=81=20=ED=95=A8=EC=88=98=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/MyPage/index.tsx | 7 ++++++- src/pages/MyPage/template/index.tsx | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pages/MyPage/index.tsx b/src/pages/MyPage/index.tsx index 7d29dd00..b2d45b65 100644 --- a/src/pages/MyPage/index.tsx +++ b/src/pages/MyPage/index.tsx @@ -43,10 +43,14 @@ function MyPage(): React.ReactElement { }; const handleCommentFold = () => { - !isFolded && setIsChallengeModalOpen(false); setIsFolded(!isFolded); }; + const handleChallengeModalOpen = () => { + setIsChallengeModalOpen(false); + setIsFolded(true); + }; + const handleModalOpen = () => { setIsModalOpened(true); }; @@ -186,6 +190,7 @@ function MyPage(): React.ReactElement { handleCommentFold={handleCommentFold} fetchLearnMyselfData={fetchLearnMyselfData} deleteSelectedCommentList={deleteSelectedCommentList} + handleChallengeModalOpen={handleChallengeModalOpen} /> ); } diff --git a/src/pages/MyPage/template/index.tsx b/src/pages/MyPage/template/index.tsx index 4ec382c7..a17394de 100644 --- a/src/pages/MyPage/template/index.tsx +++ b/src/pages/MyPage/template/index.tsx @@ -36,7 +36,8 @@ export interface IProps { handleModalOpen: () => void; handleCommentFold: () => void; fetchLearnMyselfData: (id: string) => Promise; - deleteSelectedCommentList: () => void; + deleteSelectedCommentList: () => Promise; + handleChallengeModalOpen: () => void; } function MyPageTemplate({ @@ -68,6 +69,7 @@ function MyPageTemplate({ handleCommentFold, fetchLearnMyselfData, deleteSelectedCommentList, + handleChallengeModalOpen, }: IProps): React.ReactElement { return ( From b6b24bd9e841c3a6a5f3efcad681f1eff453468a Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Mon, 9 Aug 2021 01:38:19 +0900 Subject: [PATCH 61/80] =?UTF-8?q?Etc:=20=EB=A7=88=EC=9D=B4=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EB=8C=93=EA=B8=80=EB=AA=A8=EB=8B=AC=20?= =?UTF-8?q?=EC=9D=B8=EB=8D=B1=EC=8A=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/organisms/index.ts | 1 + src/pages/MyPage/template/index.tsx | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/organisms/index.ts b/src/components/organisms/index.ts index d0261604..8e12f03b 100644 --- a/src/components/organisms/index.ts +++ b/src/components/organisms/index.ts @@ -17,6 +17,7 @@ export { default as JoinCheck } from './JoinCheck'; export { default as JoinForm } from './JoinForm'; export { default as LoginForm } from './LoginForm'; export { default as MyCommentList } from './MyCommentList'; +export { default as MyPageCommentModal } from './MyPageCommentModal'; export { default as MyPageHeader } from './MyPageHeader'; export { default as NoticeCommentList } from './NoticeCommentList'; export { default as NoticeHeader } from './NoticeHeader'; diff --git a/src/pages/MyPage/template/index.tsx b/src/pages/MyPage/template/index.tsx index a17394de..3554c4c7 100644 --- a/src/pages/MyPage/template/index.tsx +++ b/src/pages/MyPage/template/index.tsx @@ -1,6 +1,5 @@ import { DeleteModal, MyPageSection } from 'components/molecules'; -import { MyCommentList, MyPageHeader } from 'components/organisms'; -import MyPageCommentModal from 'components/organisms/MyPageCommentModal'; +import { MyCommentList, MyPageCommentModal, MyPageHeader } from 'components/organisms'; import React from 'react'; import { IChallenge, IChallengeData } from 'types/challenge.type'; import { IConcert } from 'types/concert.type'; From 1a8af55754aa417ee94c2d76a4d1f3bef693e837 Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Tue, 10 Aug 2021 11:00:53 +0900 Subject: [PATCH 62/80] =?UTF-8?q?Fix:=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20=EC=88=98=EC=A0=95=20=EC=95=88=EB=90=98=EB=8A=94=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/user.api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apis/user.api.ts b/src/apis/user.api.ts index 5aea03a2..434e5632 100644 --- a/src/apis/user.api.ts +++ b/src/apis/user.api.ts @@ -62,7 +62,7 @@ export const updateUserInfo = async ( body.append('img', img); } body.append('nickname', nickname); - body.append('interest', `[${interest.join()}]`); + body.append('interest', `[${interest.map((item) => `"${item}"`).join(', ')}]`); body.append('gender', String(gender)); body.append('marpolicy', String(marpolicy)); From 4ebcf967b78e3025e774b98eb883a52742bb2a71 Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Tue, 10 Aug 2021 11:01:59 +0900 Subject: [PATCH 63/80] =?UTF-8?q?Etc:=20=ED=83=80=EC=9E=85=EC=A0=95?= =?UTF-8?q?=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/atoms/StyledInput/index.tsx | 2 +- src/types/setting.type.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 src/types/setting.type.ts diff --git a/src/components/atoms/StyledInput/index.tsx b/src/components/atoms/StyledInput/index.tsx index a649fb31..790f8d77 100644 --- a/src/components/atoms/StyledInput/index.tsx +++ b/src/components/atoms/StyledInput/index.tsx @@ -34,7 +34,7 @@ function StyledInput({ { + onChange={(e: React.ChangeEvent) => { onChange(e.target.value); }} onFocus={() => { diff --git a/src/types/setting.type.ts b/src/types/setting.type.ts new file mode 100644 index 00000000..4eb35eef --- /dev/null +++ b/src/types/setting.type.ts @@ -0,0 +1,9 @@ +export interface ISettingUserInfo { + nickname: string; + img: string; + marpolicy: boolean; + _id: string; + email: string; + gender: number; + interest: string[]; +} From 9e89c1397279df868b9bd4c4c4d46d5c9b1e4e90 Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Tue, 10 Aug 2021 11:02:15 +0900 Subject: [PATCH 64/80] =?UTF-8?q?Refactor:=20=ED=8E=98=EC=9D=B4=EC=A7=80?= =?UTF-8?q?=20-=20=ED=85=9C=ED=94=8C=EB=A6=BF=20=EA=B4=80=EC=8B=AC?= =?UTF-8?q?=EC=82=AC=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Setting/index.tsx | 253 +++++----------------- src/pages/Setting/template/index.tsx | 186 +++++++++++++++- src/pages/Setting/{ => template}/style.ts | 0 3 files changed, 236 insertions(+), 203 deletions(-) rename src/pages/Setting/{ => template}/style.ts (100%) diff --git a/src/pages/Setting/index.tsx b/src/pages/Setting/index.tsx index 8f098677..225f746a 100644 --- a/src/pages/Setting/index.tsx +++ b/src/pages/Setting/index.tsx @@ -1,43 +1,10 @@ -import { Switch, withStyles } from '@material-ui/core'; import { getUserInfo, updateUserInfo } from 'apis'; -import { EditWhiteIcon, XIcon } from 'assets/images'; -import { StyledInput } from 'components/atoms'; -import { DropDown, DropDownMulti } from 'components/molecules'; import React, { useEffect, useRef, useState } from 'react'; import { useHistory, withRouter } from 'react-router-dom'; import { useRecoilValue, useSetRecoilState } from 'recoil'; -import { interestList } from 'resources/string'; import { userState, userStatusState } from 'stores/user'; -import { - Btn, - CategoryContainer, - Container, - DropdownWrapper, - EditBtn, - Email, - InterestList, - InterestTagCntnr, - NicknameInputContainer, - PolicyCntnr, - ProfileContainer, - ProfileImg, - ProfileInput, - PwBtn, - Text, - TextWrapper, - Txt, - TxtSmall, -} from './style'; - -interface IUserInfo { - nickname: string; - img: string; - marpolicy: boolean; - _id: string; - email: string; - gender: number; - interest: string[]; -} +import { ISettingUserInfo } from 'types/setting.type'; +import SettingTemplate from './template'; function Setting(): React.ReactElement { // for edit btn @@ -47,7 +14,7 @@ function Setting(): React.ReactElement { // for user info const setUserData = useSetRecoilState(userState); const userStatusData = useRecoilValue(userStatusState); - const [userInfo, setUserInfo] = useState({ + const [userInfo, setUserInfo] = useState({ nickname: '', img: '', marpolicy: true, @@ -61,6 +28,39 @@ function Setting(): React.ReactElement { const imgInput = useRef(null); const [img, setImg] = useState({}); const [isEmpty, setIsEmpty] = useState(true); + + const handlePasswordBtnClicked = () => { + history.push('/setting/password/set'); + }; + + const handleUserMarpolicy = (e: React.ChangeEvent) => + setUserInfo({ + ...userInfo, + marpolicy: e.target.checked, + }); + + const handleUserGender = (e: string) => + setUserInfo({ + ...userInfo, + gender: e === '남성' ? 0 : e === '여성' ? 1 : 2, + }); + + const handleUserInterest = (e: string) => { + !userInfo.interest.includes(String(e)) && + userInfo.interest.length < 5 && + setUserInfo({ + ...userInfo, + interest: userInfo.interest.concat([String(e)]), + }); + }; + + const handleUserNickname = (nickname: string | number) => { + setUserInfo({ + ...userInfo, + nickname: String(nickname), + }); + }; + const handleInputImg = (e: React.ChangeEvent) => { if (e.target.files) { setUserInfo({ @@ -81,6 +81,10 @@ function Setting(): React.ReactElement { }; const handleClickEdit = async () => { + if (!isBtnAtv) { + return; + } + let data = null; if (!isEmpty) { data = await updateUserInfo( @@ -123,171 +127,20 @@ function Setting(): React.ReactElement { }, [userInfo]); return ( -
    - - - - - - - 아이디 - {userInfo.email} - 닉네임 - - - setUserInfo({ - ...userInfo, - nickname: String(e), - }) - } - isConditionMet={userInfo.nickname !== ''} - errorMsg="닉네임을 입력해주세요" - /> - - 카테고리 - - { - !userInfo.interest.includes(String(e)) && - userInfo.interest.length < 5 && - setUserInfo({ - ...userInfo, - interest: userInfo.interest.concat([String(e)]), - }); - }} - defaultMsg="카테고리를 선택해 주세요 (최대 5개)" - itemList={interestList} - /> - - - {userInfo.interest.map((item: string, idx: number) => { - return ; - })} - - 성별 - - - setUserInfo({ - ...userInfo, - gender: e === '남성' ? 0 : e === '여성' ? 1 : 2, - }) - } - defaultMsg="성별 선택" - itemList={['남성', '여성', '선택안함']} - page="joinform" - isSetting={true} - /> - - 비밀번호 변경 - history.push('/setting/password/set')}>비밀번호 변경하기 - - - 이메일 수신 설정 - 오투에서 진행하는 챌린지, 이벤트, 프로모션에 관한 광고를 수신하겠습니다. - - ) => - setUserInfo({ - ...userInfo, - marpolicy: e.target.checked, - }) - } - name="checkedB" - /> - - { - console.log(''); - } - } - > - 수정완료 - - -
    + ); } export default withRouter(Setting); - -const InterestTag = ({ setList, text }: { setList: (e: string) => void; text: string }) => { - return ( - -
    {text}
    - setList(e.target.id)} /> -
    - ); -}; - -const IOSSwitch = withStyles((theme) => ({ - root: { - width: 42, - height: 26, - padding: 0, - margin: theme.spacing(1), - }, - switchBase: { - 'padding': 1, - '&$checked': { - 'transform': 'translateX(16px)', - 'color': theme.palette.common.white, - '& + $track': { - backgroundColor: '#3d3d3d', - opacity: 1, - border: '#dfdfdf', - }, - }, - '&$focusVisible $thumb': { - color: '#3d3d3d', - border: '6px solid #dfdfdf', - }, - }, - thumb: { - width: 24, - height: 24, - }, - track: { - borderRadius: 26 / 2, - border: `1px solid ${theme.palette.grey[400]}`, - backgroundColor: theme.palette.grey[50], - opacity: 1, - transition: theme.transitions.create(['background-color', 'border']), - }, - checked: {}, - focusVisible: {}, -}))(({ classes, ...props }: any) => { - return ( - - ); -}); diff --git a/src/pages/Setting/template/index.tsx b/src/pages/Setting/template/index.tsx index 0577c789..49e1540d 100644 --- a/src/pages/Setting/template/index.tsx +++ b/src/pages/Setting/template/index.tsx @@ -1,7 +1,187 @@ +import { Switch, withStyles } from '@material-ui/core'; +import { EditWhiteIcon, XIcon } from 'assets/images'; +import { StyledInput } from 'components/atoms'; +import { DropDown, DropDownMulti } from 'components/molecules'; import React from 'react'; +import { interestList } from 'resources/string'; +import { ISettingUserInfo } from 'types/setting.type'; +import { + Btn, + CategoryContainer, + Container, + DropdownWrapper, + EditBtn, + Email, + InterestList, + InterestTagCntnr, + NicknameInputContainer, + PolicyCntnr, + ProfileContainer, + ProfileImg, + ProfileInput, + PwBtn, + Text, + TextWrapper, + Txt, + TxtSmall, +} from './style'; -function Setting(): React.ReactElement { - return
    Setting
    ; +export interface IProps { + userInfo: ISettingUserInfo; + imgInput: React.RefObject; + isBtnAtv: boolean; + handleInputImg: (e: React.ChangeEvent) => void; + handleUserNickname: (nickname: string | number) => void; + handleClickDel: (e: string) => void; + handleUserInterest: (e: string) => void; + handleUserGender: (e: string) => void; + handleUserMarpolicy: (e: React.ChangeEvent) => void; + handleClickEdit: () => Promise; + handlePasswordBtnClicked: () => void; } -export default Setting; +function SettingTemplate({ + userInfo, + imgInput, + isBtnAtv, + handleInputImg, + handleUserNickname, + handleClickDel, + handleUserInterest, + handleUserGender, + handleUserMarpolicy, + handleClickEdit, + handlePasswordBtnClicked, +}: IProps): React.ReactElement { + return ( + + + + + + + 아이디 + {userInfo.email} + 닉네임 + + + + 카테고리 + + + + + {userInfo.interest.map((item: string, idx: number) => { + return ; + })} + + 성별 + + + + 비밀번호 변경 + 비밀번호 변경하기 + + + 이메일 수신 설정 + 오투에서 진행하는 챌린지, 이벤트, 프로모션에 관한 광고를 수신하겠습니다. + + + + + 수정완료 + + + ); +} + +export default SettingTemplate; + +const InterestTag = ({ setList, text }: { setList: (e: string) => void; text: string }) => { + return ( + +
    {text}
    + setList(e.target.id)} /> +
    + ); +}; + +const IOSSwitch = withStyles((theme) => ({ + root: { + width: 42, + height: 26, + padding: 0, + margin: theme.spacing(1), + }, + switchBase: { + 'padding': 1, + '&$checked': { + 'transform': 'translateX(16px)', + 'color': theme.palette.common.white, + '& + $track': { + backgroundColor: '#3d3d3d', + opacity: 1, + border: '#dfdfdf', + }, + }, + '&$focusVisible $thumb': { + color: '#3d3d3d', + border: '6px solid #dfdfdf', + }, + }, + thumb: { + width: 24, + height: 24, + }, + track: { + borderRadius: 26 / 2, + border: `1px solid ${theme.palette.grey[400]}`, + backgroundColor: theme.palette.grey[50], + opacity: 1, + transition: theme.transitions.create(['background-color', 'border']), + }, + checked: {}, + focusVisible: {}, +}))(({ classes, ...props }: any) => { + return ( + + ); +}); diff --git a/src/pages/Setting/style.ts b/src/pages/Setting/template/style.ts similarity index 100% rename from src/pages/Setting/style.ts rename to src/pages/Setting/template/style.ts From c33ab9e4ac92dc80db38699c1ab994a43c3adab8 Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Tue, 10 Aug 2021 11:02:28 +0900 Subject: [PATCH 65/80] =?UTF-8?q?Style:=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EB=AA=85=20=ED=8F=B4=EB=8D=94=EC=97=90=20=EB=A7=9E?= =?UTF-8?q?=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/DropDownMulti/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/molecules/DropDownMulti/index.tsx b/src/components/molecules/DropDownMulti/index.tsx index 019ce05e..b8a26cb3 100644 --- a/src/components/molecules/DropDownMulti/index.tsx +++ b/src/components/molecules/DropDownMulti/index.tsx @@ -10,7 +10,7 @@ export interface IProps { itemList: string[]; } -function DropDown({ setState, state, defaultMsg, itemList }: IProps): React.ReactElement { +function DropDownMulti({ setState, state, defaultMsg, itemList }: IProps): React.ReactElement { const [isOpen, setIsOpen] = useState(false); //드롭다운이 열렸는지 const [isChecked, setIsChecked] = useState(false); //값이 선택이 되었는지 const handleOnChange = (e: React.ChangeEvent): void => { @@ -56,4 +56,4 @@ function DropDown({ setState, state, defaultMsg, itemList }: IProps): React.Reac ); } -export default DropDown; +export default DropDownMulti; From 721fd7beef5d6797d2394fd4b425d18d8f16e0cf Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Tue, 10 Aug 2021 17:01:10 +0900 Subject: [PATCH 66/80] =?UTF-8?q?Fix:=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20number=ED=83=80=EC=9E=85=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Setting/template/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Setting/template/index.tsx b/src/pages/Setting/template/index.tsx index 49e1540d..133560d8 100644 --- a/src/pages/Setting/template/index.tsx +++ b/src/pages/Setting/template/index.tsx @@ -31,7 +31,7 @@ export interface IProps { imgInput: React.RefObject; isBtnAtv: boolean; handleInputImg: (e: React.ChangeEvent) => void; - handleUserNickname: (nickname: string | number) => void; + handleUserNickname: (nickname: string) => void; handleClickDel: (e: string) => void; handleUserInterest: (e: string) => void; handleUserGender: (e: string) => void; From 05bcbbd76767a8a065b515c6c0ec596f898fbd92 Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Tue, 10 Aug 2021 20:56:34 +0900 Subject: [PATCH 67/80] =?UTF-8?q?Refactor:=20=ED=86=A0=EA=B8=80=20?= =?UTF-8?q?=EC=8A=A4=EC=9C=84=EC=B9=98=20=EA=B5=AC=ED=98=84=20=EB=B0=8F=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../molecules/ToggleSwitch/index.tsx | 20 +++++++ .../molecules/ToggleSwitch/style.ts | 36 ++++++++++++ src/components/molecules/index.ts | 1 + src/pages/Setting/template/index.tsx | 58 +------------------ 4 files changed, 59 insertions(+), 56 deletions(-) create mode 100644 src/components/molecules/ToggleSwitch/index.tsx create mode 100644 src/components/molecules/ToggleSwitch/style.ts diff --git a/src/components/molecules/ToggleSwitch/index.tsx b/src/components/molecules/ToggleSwitch/index.tsx new file mode 100644 index 00000000..47e71b3d --- /dev/null +++ b/src/components/molecules/ToggleSwitch/index.tsx @@ -0,0 +1,20 @@ +import React from 'react'; +import * as S from './style'; + +interface IProps { + checked: boolean; + onChange: (e: React.ChangeEvent) => void; +} + +function ToggleSwitch({ checked, onChange }: IProps): React.ReactElement { + return ( + + + + + + + ); +} + +export default ToggleSwitch; diff --git a/src/components/molecules/ToggleSwitch/style.ts b/src/components/molecules/ToggleSwitch/style.ts new file mode 100644 index 00000000..6fb56cd3 --- /dev/null +++ b/src/components/molecules/ToggleSwitch/style.ts @@ -0,0 +1,36 @@ +import { CheckBox, Label } from 'components/atoms'; +import Styled from 'styled-components'; +import { ifProp, palette } from 'styled-tools'; + +export const ToggleSwitchContainer = Styled.div<{ checked: boolean }>` + width: 48px; + height: 26px; + background-color: ${ifProp('checked', palette('grayscale', 7), palette('grayscale', 1))}; + transition: background-color 0.1s linear; + position: relative; + border-radius: 50px; +`; + +export const SwitchCheckbox = Styled(CheckBox)` + display: none; + + &:checked + label div { + transform: translateX(22px); + } +`; + +export const SwitchLabel = Styled(Label)` + cursor: pointer; + background-color: ${palette('grayscale', 1)}; +`; + +export const Ball = Styled.div` + position: absolute; + height: 20px; + width: 20px; + border-radius: 50%; + top: 3px; + left: 3px; + transition: transform 0.1s linear; + background-color: ${palette('grayscale', 0)}; +`; diff --git a/src/components/molecules/index.ts b/src/components/molecules/index.ts index d994f740..d2ff30d7 100644 --- a/src/components/molecules/index.ts +++ b/src/components/molecules/index.ts @@ -43,3 +43,4 @@ export { default as ChallengeReCommentList, default as ReplyComment } from './Re export { default as SearchBar } from './SearchBar'; export { default as SingleComment } from './SingleComment'; export { default as SpeakerExpCard } from './SpeakerExpCard'; +export { default as ToggleSwitch } from './ToggleSwitch'; diff --git a/src/pages/Setting/template/index.tsx b/src/pages/Setting/template/index.tsx index 133560d8..08804c71 100644 --- a/src/pages/Setting/template/index.tsx +++ b/src/pages/Setting/template/index.tsx @@ -1,7 +1,6 @@ -import { Switch, withStyles } from '@material-ui/core'; import { EditWhiteIcon, XIcon } from 'assets/images'; import { StyledInput } from 'components/atoms'; -import { DropDown, DropDownMulti } from 'components/molecules'; +import { DropDown, DropDownMulti, ToggleSwitch } from 'components/molecules'; import React from 'react'; import { interestList } from 'resources/string'; import { ISettingUserInfo } from 'types/setting.type'; @@ -113,7 +112,7 @@ function SettingTemplate({ 이메일 수신 설정 오투에서 진행하는 챌린지, 이벤트, 프로모션에 관한 광고를 수신하겠습니다. - + 수정완료 @@ -132,56 +131,3 @@ const InterestTag = ({ setList, text }: { setList: (e: string) => void; text: st ); }; - -const IOSSwitch = withStyles((theme) => ({ - root: { - width: 42, - height: 26, - padding: 0, - margin: theme.spacing(1), - }, - switchBase: { - 'padding': 1, - '&$checked': { - 'transform': 'translateX(16px)', - 'color': theme.palette.common.white, - '& + $track': { - backgroundColor: '#3d3d3d', - opacity: 1, - border: '#dfdfdf', - }, - }, - '&$focusVisible $thumb': { - color: '#3d3d3d', - border: '6px solid #dfdfdf', - }, - }, - thumb: { - width: 24, - height: 24, - }, - track: { - borderRadius: 26 / 2, - border: `1px solid ${theme.palette.grey[400]}`, - backgroundColor: theme.palette.grey[50], - opacity: 1, - transition: theme.transitions.create(['background-color', 'border']), - }, - checked: {}, - focusVisible: {}, -}))(({ classes, ...props }: any) => { - return ( - - ); -}); From 32a69821295a34c34d24b075305cf0c486ec4f05 Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Tue, 10 Aug 2021 20:56:54 +0900 Subject: [PATCH 68/80] =?UTF-8?q?Env:=20material-ui=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 217 ---------------------------------------------- package.json | 1 - 2 files changed, 218 deletions(-) diff --git a/package-lock.json b/package-lock.json index 11a4c674..ccab836c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1911,88 +1911,6 @@ } } }, - "@material-ui/core": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/@material-ui/core/-/core-4.12.1.tgz", - "integrity": "sha512-C6hYsjkWCTfBx9FaqxhCZCITBagh7fyCKFtHyvO3tTOcBw6NJaktdhNZ2n82jQdQdgfFvg6OOxi7OOzsAdAcBQ==", - "requires": { - "@babel/runtime": "^7.4.4", - "@material-ui/styles": "^4.11.4", - "@material-ui/system": "^4.12.1", - "@material-ui/types": "5.1.0", - "@material-ui/utils": "^4.11.2", - "@types/react-transition-group": "^4.2.0", - "clsx": "^1.0.4", - "hoist-non-react-statics": "^3.3.2", - "popper.js": "1.16.1-lts", - "prop-types": "^15.7.2", - "react-is": "^16.8.0 || ^17.0.0", - "react-transition-group": "^4.4.0" - } - }, - "@material-ui/styles": { - "version": "4.11.4", - "resolved": "https://registry.npmjs.org/@material-ui/styles/-/styles-4.11.4.tgz", - "integrity": "sha512-KNTIZcnj/zprG5LW0Sao7zw+yG3O35pviHzejMdcSGCdWbiO8qzRgOYL8JAxAsWBKOKYwVZxXtHWaB5T2Kvxew==", - "requires": { - "@babel/runtime": "^7.4.4", - "@emotion/hash": "^0.8.0", - "@material-ui/types": "5.1.0", - "@material-ui/utils": "^4.11.2", - "clsx": "^1.0.4", - "csstype": "^2.5.2", - "hoist-non-react-statics": "^3.3.2", - "jss": "^10.5.1", - "jss-plugin-camel-case": "^10.5.1", - "jss-plugin-default-unit": "^10.5.1", - "jss-plugin-global": "^10.5.1", - "jss-plugin-nested": "^10.5.1", - "jss-plugin-props-sort": "^10.5.1", - "jss-plugin-rule-value-function": "^10.5.1", - "jss-plugin-vendor-prefixer": "^10.5.1", - "prop-types": "^15.7.2" - }, - "dependencies": { - "csstype": { - "version": "2.6.17", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.17.tgz", - "integrity": "sha512-u1wmTI1jJGzCJzWndZo8mk4wnPTZd1eOIYTYvuEyOQGfmDl3TrabCCfKnOC86FZwW/9djqTl933UF/cS425i9A==" - } - } - }, - "@material-ui/system": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/@material-ui/system/-/system-4.12.1.tgz", - "integrity": "sha512-lUdzs4q9kEXZGhbN7BptyiS1rLNHe6kG9o8Y307HCvF4sQxbCgpL2qi+gUk+yI8a2DNk48gISEQxoxpgph0xIw==", - "requires": { - "@babel/runtime": "^7.4.4", - "@material-ui/utils": "^4.11.2", - "csstype": "^2.5.2", - "prop-types": "^15.7.2" - }, - "dependencies": { - "csstype": { - "version": "2.6.17", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.17.tgz", - "integrity": "sha512-u1wmTI1jJGzCJzWndZo8mk4wnPTZd1eOIYTYvuEyOQGfmDl3TrabCCfKnOC86FZwW/9djqTl933UF/cS425i9A==" - } - } - }, - "@material-ui/types": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@material-ui/types/-/types-5.1.0.tgz", - "integrity": "sha512-7cqRjrY50b8QzRSYyhSpx4WRw2YuO0KKIGQEVk5J8uoz2BanawykgZGoWEqKm7pVIbzFDN0SpPcVV4IhOFkl8A==" - }, - "@material-ui/utils": { - "version": "4.11.2", - "resolved": "https://registry.npmjs.org/@material-ui/utils/-/utils-4.11.2.tgz", - "integrity": "sha512-Uul8w38u+PICe2Fg2pDKCaIG7kOyhowZ9vjiC1FsVwPABTW8vPPKfF6OvxRq3IiBaI1faOJmgdvMG7rMJARBhA==", - "requires": { - "@babel/runtime": "^7.4.4", - "prop-types": "^15.7.2", - "react-is": "^16.8.0 || ^17.0.0" - } - }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -2598,14 +2516,6 @@ "@types/react-router": "*" } }, - "@types/react-transition-group": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.2.tgz", - "integrity": "sha512-KibDWL6nshuOJ0fu8ll7QnV/LVTo3PzQ9aCPnRUYPfX7eZohHwLIdNHj7pftanREzHNP4/nJa8oeM73uSiavMQ==", - "requires": { - "@types/react": "*" - } - }, "@types/resolve": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", @@ -4412,11 +4322,6 @@ "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=" }, - "clsx": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.1.tgz", - "integrity": "sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA==" - }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -4925,15 +4830,6 @@ } } }, - "css-vendor": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/css-vendor/-/css-vendor-2.0.8.tgz", - "integrity": "sha512-x9Aq0XTInxrkuFeHKbYC7zWY8ai7qJ04Kxd9MnvbC1uO5DagxoHQjm4JvG+vCdXOoFtCjbL2XSZfxmoYa9uQVQ==", - "requires": { - "@babel/runtime": "^7.8.3", - "is-in-browser": "^1.0.2" - } - }, "css-what": { "version": "3.4.2", "resolved": "https://registry.npmjs.org/css-what/-/css-what-3.4.2.tgz", @@ -5441,15 +5337,6 @@ "utila": "~0.4" } }, - "dom-helpers": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", - "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==", - "requires": { - "@babel/runtime": "^7.8.7", - "csstype": "^3.0.2" - } - }, "dom-serializer": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", @@ -7774,11 +7661,6 @@ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==" }, - "hyphenate-style-name": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz", - "integrity": "sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ==" - }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -8122,11 +8004,6 @@ "is-extglob": "^2.1.1" } }, - "is-in-browser": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-in-browser/-/is-in-browser-1.1.3.tgz", - "integrity": "sha1-Vv9NtoOgeMYILrldrX3GLh0E+DU=" - }, "is-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", @@ -9934,84 +9811,6 @@ "universalify": "^2.0.0" } }, - "jss": { - "version": "10.7.1", - "resolved": "https://registry.npmjs.org/jss/-/jss-10.7.1.tgz", - "integrity": "sha512-5QN8JSVZR6cxpZNeGfzIjqPEP+ZJwJJfZbXmeABNdxiExyO+eJJDy6WDtqTf8SDKnbL5kZllEpAP71E/Lt7PXg==", - "requires": { - "@babel/runtime": "^7.3.1", - "csstype": "^3.0.2", - "is-in-browser": "^1.1.3", - "tiny-warning": "^1.0.2" - } - }, - "jss-plugin-camel-case": { - "version": "10.7.1", - "resolved": "https://registry.npmjs.org/jss-plugin-camel-case/-/jss-plugin-camel-case-10.7.1.tgz", - "integrity": "sha512-+ioIyWvmAfgDCWXsQcW1NMnLBvRinOVFkSYJUgewQ6TynOcSj5F1bSU23B7z0p1iqK0PPHIU62xY1iNJD33WGA==", - "requires": { - "@babel/runtime": "^7.3.1", - "hyphenate-style-name": "^1.0.3", - "jss": "10.7.1" - } - }, - "jss-plugin-default-unit": { - "version": "10.7.1", - "resolved": "https://registry.npmjs.org/jss-plugin-default-unit/-/jss-plugin-default-unit-10.7.1.tgz", - "integrity": "sha512-tW+dfYVNARBQb/ONzBwd8uyImigyzMiAEDai+AbH5rcHg5h3TtqhAkxx06iuZiT/dZUiFdSKlbe3q9jZGAPIwA==", - "requires": { - "@babel/runtime": "^7.3.1", - "jss": "10.7.1" - } - }, - "jss-plugin-global": { - "version": "10.7.1", - "resolved": "https://registry.npmjs.org/jss-plugin-global/-/jss-plugin-global-10.7.1.tgz", - "integrity": "sha512-FbxCnu44IkK/bw8X3CwZKmcAnJqjAb9LujlAc/aP0bMSdVa3/MugKQRyeQSu00uGL44feJJDoeXXiHOakBr/Zw==", - "requires": { - "@babel/runtime": "^7.3.1", - "jss": "10.7.1" - } - }, - "jss-plugin-nested": { - "version": "10.7.1", - "resolved": "https://registry.npmjs.org/jss-plugin-nested/-/jss-plugin-nested-10.7.1.tgz", - "integrity": "sha512-RNbICk7FlYKaJyv9tkMl7s6FFfeLA3ubNIFKvPqaWtADK0KUaPsPXVYBkAu4x1ItgsWx67xvReMrkcKA0jSXfA==", - "requires": { - "@babel/runtime": "^7.3.1", - "jss": "10.7.1", - "tiny-warning": "^1.0.2" - } - }, - "jss-plugin-props-sort": { - "version": "10.7.1", - "resolved": "https://registry.npmjs.org/jss-plugin-props-sort/-/jss-plugin-props-sort-10.7.1.tgz", - "integrity": "sha512-eyd5FhA+J0QrpqXxO7YNF/HMSXXl4pB0EmUdY4vSJI4QG22F59vQ6AHtP6fSwhmBdQ98Qd9gjfO+RMxcE39P1A==", - "requires": { - "@babel/runtime": "^7.3.1", - "jss": "10.7.1" - } - }, - "jss-plugin-rule-value-function": { - "version": "10.7.1", - "resolved": "https://registry.npmjs.org/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.7.1.tgz", - "integrity": "sha512-fGAAImlbaHD3fXAHI3ooX6aRESOl5iBt3LjpVjxs9II5u9tzam7pqFUmgTcrip9VpRqYHn8J3gA7kCtm8xKwHg==", - "requires": { - "@babel/runtime": "^7.3.1", - "jss": "10.7.1", - "tiny-warning": "^1.0.2" - } - }, - "jss-plugin-vendor-prefixer": { - "version": "10.7.1", - "resolved": "https://registry.npmjs.org/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.7.1.tgz", - "integrity": "sha512-1UHFmBn7hZNsHXTkLLOL8abRl8vi+D1EVzWD4WmLFj55vawHZfnH1oEz6TUf5Y61XHv0smdHabdXds6BgOXe3A==", - "requires": { - "@babel/runtime": "^7.3.1", - "css-vendor": "^2.0.8", - "jss": "10.7.1" - } - }, "jsx-ast-utils": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.2.0.tgz", @@ -11359,11 +11158,6 @@ "ts-pnp": "^1.1.6" } }, - "popper.js": { - "version": "1.16.1-lts", - "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1-lts.tgz", - "integrity": "sha512-Kjw8nKRl1m+VrSFCoVGPph93W/qrSO7ZkqPpTf7F4bk/sqcfWK019dWBUpE/fBOsOQY1dks/Bmcbfn1heM/IsA==" - }, "portfinder": { "version": "1.0.28", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", @@ -13045,17 +12839,6 @@ "workbox-webpack-plugin": "5.1.4" } }, - "react-transition-group": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.2.tgz", - "integrity": "sha512-/RNYfRAMlZwDSr6z4zNKV6xu53/e2BuaBbGhbyYIXTrmgu/bGHzmqOs7mJSJBHy9Ud+ApHx3QjrkKSp1pxvlFg==", - "requires": { - "@babel/runtime": "^7.5.5", - "dom-helpers": "^5.0.1", - "loose-envify": "^1.4.0", - "prop-types": "^15.6.2" - } - }, "read-pkg": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", diff --git a/package.json b/package.json index 33fcc6e4..99f409ad 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,6 @@ "version": "0.1.0", "private": true, "dependencies": { - "@material-ui/core": "^4.12.1", "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^11.2.7", "@testing-library/user-event": "^12.8.3", From 36745709cc0911f30e5aad3aabcee5d90c8cf396 Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Tue, 10 Aug 2021 21:11:20 +0900 Subject: [PATCH 69/80] =?UTF-8?q?Fix:=20atom=20import=20=EC=98=A4=EB=A5=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/FindPwdForm/style.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/molecules/FindPwdForm/style.ts b/src/components/molecules/FindPwdForm/style.ts index c0ff8b89..5f6cbe44 100644 --- a/src/components/molecules/FindPwdForm/style.ts +++ b/src/components/molecules/FindPwdForm/style.ts @@ -1,5 +1,4 @@ -import { Button } from '@material-ui/core'; -import { Label } from 'components/atoms'; +import { Button, Label } from 'components/atoms'; import Styled from 'styled-components'; import { palette, theme } from 'styled-tools'; From 2a244fcc1e04b3e43cccdcb1685c7e0c5a5deb76 Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Tue, 10 Aug 2021 21:42:52 +0900 Subject: [PATCH 70/80] =?UTF-8?q?Refactor:=20=EC=82=AD=EC=A0=9C=EA=B0=80?= =?UTF-8?q?=EB=8A=A5=ED=95=9C=20=ED=83=9C=EA=B7=B8=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../molecules/RemovableTag/index.tsx | 23 +++++++++++++++++++ .../molecules/RemovableTag/style.ts | 22 ++++++++++++++++++ src/components/molecules/index.ts | 1 + src/pages/Setting/template/index.tsx | 16 +++---------- src/pages/Setting/template/style.ts | 20 ---------------- 5 files changed, 49 insertions(+), 33 deletions(-) create mode 100644 src/components/molecules/RemovableTag/index.tsx create mode 100644 src/components/molecules/RemovableTag/style.ts diff --git a/src/components/molecules/RemovableTag/index.tsx b/src/components/molecules/RemovableTag/index.tsx new file mode 100644 index 00000000..a68c4e25 --- /dev/null +++ b/src/components/molecules/RemovableTag/index.tsx @@ -0,0 +1,23 @@ +import { XIcon } from 'assets/images'; +import React from 'react'; +import * as S from './style'; + +interface IProps { + setList: (e: string) => void; + text: string; +} + +function RemovableTag({ setList, text }: IProps): React.ReactElement { + const handleOnClick = (e: React.MouseEvent) => { + setList(e.currentTarget.id); + }; + + return ( + +
    {text}
    + +
    + ); +} + +export default RemovableTag; diff --git a/src/components/molecules/RemovableTag/style.ts b/src/components/molecules/RemovableTag/style.ts new file mode 100644 index 00000000..c1cff06e --- /dev/null +++ b/src/components/molecules/RemovableTag/style.ts @@ -0,0 +1,22 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const RemovableContainer = Styled.div` + ${theme('font.subhead3')}; + margin-right: 10px; + padding: 12px 30px; + border-radius: 60px; + border: solid 1px ${palette('primary', 5)}; + display: flex; + flex-direction: row; + align-items: center; + color: ${palette('primary', 5)}; + + div { + margin-right: 10px; + } + + img { + width: 14px; + } +`; diff --git a/src/components/molecules/index.ts b/src/components/molecules/index.ts index d2ff30d7..6f93f4e1 100644 --- a/src/components/molecules/index.ts +++ b/src/components/molecules/index.ts @@ -39,6 +39,7 @@ export { default as RegisterCard } from './RegisterCard'; export { default as RegisterCompletedModal } from './RegisterCompletedModal'; export { default as RegisterConfirmModal } from './RegisterConfirmModal'; export { default as RegisterHeader } from './RegisterHeader'; +export { default as RemovableTag } from './RemovableTag'; export { default as ChallengeReCommentList, default as ReplyComment } from './ReplyComment'; export { default as SearchBar } from './SearchBar'; export { default as SingleComment } from './SingleComment'; diff --git a/src/pages/Setting/template/index.tsx b/src/pages/Setting/template/index.tsx index 08804c71..dd2e068e 100644 --- a/src/pages/Setting/template/index.tsx +++ b/src/pages/Setting/template/index.tsx @@ -1,6 +1,6 @@ -import { EditWhiteIcon, XIcon } from 'assets/images'; +import { EditWhiteIcon } from 'assets/images'; import { StyledInput } from 'components/atoms'; -import { DropDown, DropDownMulti, ToggleSwitch } from 'components/molecules'; +import { DropDown, DropDownMulti, RemovableTag, ToggleSwitch } from 'components/molecules'; import React from 'react'; import { interestList } from 'resources/string'; import { ISettingUserInfo } from 'types/setting.type'; @@ -12,7 +12,6 @@ import { EditBtn, Email, InterestList, - InterestTagCntnr, NicknameInputContainer, PolicyCntnr, ProfileContainer, @@ -91,7 +90,7 @@ function SettingTemplate({ {userInfo.interest.map((item: string, idx: number) => { - return ; + return ; })} 성별 @@ -122,12 +121,3 @@ function SettingTemplate({ } export default SettingTemplate; - -const InterestTag = ({ setList, text }: { setList: (e: string) => void; text: string }) => { - return ( - -
    {text}
    - setList(e.target.id)} /> -
    - ); -}; diff --git a/src/pages/Setting/template/style.ts b/src/pages/Setting/template/style.ts index a123fbc6..34ebdc4c 100644 --- a/src/pages/Setting/template/style.ts +++ b/src/pages/Setting/template/style.ts @@ -141,23 +141,3 @@ export const Btn = Styled.div` justify-content: center; color: ${palette('grayscale', 0)}; `; - -export const InterestTagCntnr = Styled.div` - ${theme('font.subhead3')}; - margin-right: 10px; - padding: 12px 30px; - border-radius: 60px; - border: solid 1px ${palette('primary', 5)}; - display: flex; - flex-direction: row; - align-items: center; - color: ${palette('primary', 5)}; - - div { - margin-right: 10px; - } - - img { - width: 14px; - } -`; From d6eca23519b1d94c833bc92630756cbee0011e96 Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Tue, 10 Aug 2021 21:44:32 +0900 Subject: [PATCH 71/80] =?UTF-8?q?Style:=20Setting=20=EC=8A=A4=ED=83=80?= =?UTF-8?q?=EC=9D=BC=20import=20=EB=B0=A9=EC=8B=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Setting/template/index.tsx | 80 +++++++++++----------------- 1 file changed, 31 insertions(+), 49 deletions(-) diff --git a/src/pages/Setting/template/index.tsx b/src/pages/Setting/template/index.tsx index dd2e068e..c66dabbb 100644 --- a/src/pages/Setting/template/index.tsx +++ b/src/pages/Setting/template/index.tsx @@ -4,25 +4,7 @@ import { DropDown, DropDownMulti, RemovableTag, ToggleSwitch } from 'components/ import React from 'react'; import { interestList } from 'resources/string'; import { ISettingUserInfo } from 'types/setting.type'; -import { - Btn, - CategoryContainer, - Container, - DropdownWrapper, - EditBtn, - Email, - InterestList, - NicknameInputContainer, - PolicyCntnr, - ProfileContainer, - ProfileImg, - ProfileInput, - PwBtn, - Text, - TextWrapper, - Txt, - TxtSmall, -} from './style'; +import * as S from './style'; export interface IProps { userInfo: ISettingUserInfo; @@ -52,24 +34,24 @@ function SettingTemplate({ handlePasswordBtnClicked, }: IProps): React.ReactElement { return ( - - - + + + - - - 아이디 - {userInfo.email} - 닉네임 - + + 아이디 + {userInfo.email} + 닉네임 + - - 카테고리 - + + 카테고리 + - - + + {userInfo.interest.map((item: string, idx: number) => { return ; })} - - 성별 - + + 성별 + - - 비밀번호 변경 - 비밀번호 변경하기 - - - 이메일 수신 설정 - 오투에서 진행하는 챌린지, 이벤트, 프로모션에 관한 광고를 수신하겠습니다. - + + 비밀번호 변경 + 비밀번호 변경하기 + + + 이메일 수신 설정 + 오투에서 진행하는 챌린지, 이벤트, 프로모션에 관한 광고를 수신하겠습니다. + - - + + 수정완료 - - + + ); } From dceff58c8d3d90073ed52e5194f882b0e784ed5d Mon Sep 17 00:00:00 2001 From: YeongWoooo Date: Wed, 11 Aug 2021 00:46:43 +0900 Subject: [PATCH 72/80] =?UTF-8?q?Refactor:=20SettingView=20=EC=95=84?= =?UTF-8?q?=ED=86=A0=EB=AF=B9=20=EB=94=94=EC=9E=90=EC=9D=B8=20=ED=8C=A8?= =?UTF-8?q?=ED=84=B4=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/atoms/StyledInput/index.tsx | 32 +++-- src/components/atoms/StyledInput/style.ts | 30 ++-- src/components/molecules/DropDown/index.tsx | 32 +++-- src/components/molecules/DropDown/style.ts | 10 +- .../molecules/DropDownMulti/index.tsx | 33 ++--- .../molecules/DropDownMulti/style.ts | 7 + src/components/molecules/FormInput/index.tsx | 50 +++++++ src/components/molecules/FormInput/style.ts | 15 ++ .../molecules/ProfileEdit/index.tsx | 30 ++++ src/components/molecules/ProfileEdit/style.ts | 32 +++++ src/components/molecules/index.ts | 2 + .../organisms/SettingForm/index.tsx | 95 +++++++++++++ src/components/organisms/SettingForm/style.ts | 95 +++++++++++++ src/components/organisms/index.ts | 3 +- src/pages/Setting/template/index.tsx | 82 ++--------- src/pages/Setting/template/style.ts | 134 +----------------- 16 files changed, 424 insertions(+), 258 deletions(-) create mode 100644 src/components/molecules/FormInput/index.tsx create mode 100644 src/components/molecules/FormInput/style.ts create mode 100644 src/components/molecules/ProfileEdit/index.tsx create mode 100644 src/components/molecules/ProfileEdit/style.ts create mode 100644 src/components/organisms/SettingForm/index.tsx create mode 100644 src/components/organisms/SettingForm/style.ts diff --git a/src/components/atoms/StyledInput/index.tsx b/src/components/atoms/StyledInput/index.tsx index 790f8d77..30f222f2 100644 --- a/src/components/atoms/StyledInput/index.tsx +++ b/src/components/atoms/StyledInput/index.tsx @@ -7,12 +7,13 @@ export interface IProps { className?: string; errorMsg?: string; placeHolder?: string; - onChange: (value: string) => void; + onChange?: (value: string) => void; isConditionMet: boolean; width: string; height: string; isPw?: boolean; margin?: string; + readOnly?: boolean; } function StyledInput({ @@ -25,25 +26,36 @@ function StyledInput({ height, isPw, margin, + readOnly = false, }: IProps): React.ReactElement { - const [isFocused, setIsfocused] = useState(false); + const [isFocused, setIsFocused] = useState(false); + + const handleOnChange = (e: React.ChangeEvent) => { + onChange?.(e.target.value); + }; + + const handleOnFocus = () => { + setIsFocused(true); + }; return ( - + ) => { - onChange(e.target.value); - }} - onFocus={() => { - setIsfocused(true); - }} + onChange={handleOnChange} + onFocus={handleOnFocus} // onBlur={(e) => { - // setIsfocused(false); + // setIsFocused(false); // }} type={isPw ? 'password' : 'text'} + readOnly={readOnly} /> {isFocused && !isConditionMet && } diff --git a/src/components/atoms/StyledInput/style.ts b/src/components/atoms/StyledInput/style.ts index 33ab8ff5..e8ec87fb 100644 --- a/src/components/atoms/StyledInput/style.ts +++ b/src/components/atoms/StyledInput/style.ts @@ -1,32 +1,34 @@ import Styled, { css } from 'styled-components'; -import { palette, theme } from 'styled-tools'; +import { ifProp, palette, theme } from 'styled-tools'; -export const Input = Styled.input` - border : none; - ${theme('font.body1')}; - font-size: 16px; - color : ${palette('grayscale', 9)}; - text-align: left; - width : 100%; - height : 100%; +export const Input = Styled.input<{ readOnly: boolean }>` + border: none; + ${ifProp('readOnly', theme('font.subhead3'), theme('font.body3'))}; + color: ${ifProp({ readOnly: true }, palette('grayscale', 4), palette('grayscale', 9))}; + background: ${ifProp('readOnly', palette('grayscale', 1))}; + width: 100%; + height: 100%; padding: 18px 20px; border-radius: 4px; - font-style: AppleSDGothicNeo; :placeholder{ - color : ${palette('grayscale', 2)} + color: ${palette('grayscale', 2)}; } :focus{ - outline : none; + outline: none; } `; -export const InputContainer = Styled.div<{ width: string; height: string; condition: number }>` +export const InputContainer = Styled.div<{ width: string; height: string; condition: number; readOnly: boolean }>` /* condition -1 : 기본 0 : 컨디션 X 1 : 컨디션 O */ ${(props) => - props.condition == -1 + props.readOnly + ? css` + border: solid 1px ${palette('grayscale', 2)}; + ` + : props.condition == -1 ? css` border: solid 1px ${palette('grayscale', 2)}; ` diff --git a/src/components/molecules/DropDown/index.tsx b/src/components/molecules/DropDown/index.tsx index b956597d..38625ba4 100644 --- a/src/components/molecules/DropDown/index.tsx +++ b/src/components/molecules/DropDown/index.tsx @@ -1,8 +1,9 @@ import { ArrowDownIcon, ArrowUpIcon } from 'assets/images'; import React, { useEffect, useState } from 'react'; -import { Arrow, Input, Item, Label, Line, ListContainer, SummaryInner, SummaryOuter, SummaryValue } from './style'; +import * as S from './style'; export interface IProps { + title?: string; className?: string; setState: (value: string) => void; state: string; @@ -12,7 +13,7 @@ export interface IProps { isSetting?: boolean; } -function DropDown({ setState, state, defaultMsg, itemList, page, isSetting }: IProps): React.ReactElement { +function DropDown({ title, setState, state, defaultMsg, itemList, page, isSetting }: IProps): React.ReactElement { const [isOpen, setIsOpen] = useState(false); //드롭다운이 열렸는지 const [isChecked, setIsChecked] = useState(false); //값이 선택이 되었는지 const handleOnChange = (e: React.ChangeEvent): void => { @@ -36,32 +37,33 @@ function DropDown({ setState, state, defaultMsg, itemList, page, isSetting }: IP return ( <> - - {title}} + + - {state} - - - + {state} + + + {isOpen && ( - + {itemList.map((item, id) => { return (
    - - {id !== itemList.length - 1 && } + + + {item} + + {id !== itemList.length - 1 && }
    ); })} -
    + )} ); diff --git a/src/components/molecules/DropDown/style.ts b/src/components/molecules/DropDown/style.ts index 51c925a3..f717f694 100644 --- a/src/components/molecules/DropDown/style.ts +++ b/src/components/molecules/DropDown/style.ts @@ -1,9 +1,15 @@ import Styled, { css } from 'styled-components'; import { palette, theme } from 'styled-tools'; +export const Title = Styled.div` + ${theme('font.subhead4')}; + width: 844px; + margin-bottom: 10px; + color: ${palette('grayscale', 9)}; +`; + export const Item = Styled.span<{ page: string }>` - ${theme('font.body1')}; - font-size: 16px; + ${theme('font.body3')}; width : 100%; display: block; color:${(props) => (props.page === 'adminwrite' ? `${palette('grayscale', 9)}` : `${palette('grayscale', 4)}`)}; diff --git a/src/components/molecules/DropDownMulti/index.tsx b/src/components/molecules/DropDownMulti/index.tsx index b8a26cb3..44549a40 100644 --- a/src/components/molecules/DropDownMulti/index.tsx +++ b/src/components/molecules/DropDownMulti/index.tsx @@ -1,16 +1,16 @@ import { ArrowDownIcon, ArrowUpIcon } from 'assets/images'; import React, { useEffect, useState } from 'react'; -import { Arrow, Input, Item, Label, Line, ListContainer, SummaryInner, SummaryOuter, SummaryValue } from './style'; +import * as S from './style'; export interface IProps { - className?: string; + title?: string; setState: (value: string) => void; state: string[]; defaultMsg: string; itemList: string[]; } -function DropDownMulti({ setState, state, defaultMsg, itemList }: IProps): React.ReactElement { +function DropDownMulti({ title, setState, state, defaultMsg, itemList }: IProps): React.ReactElement { const [isOpen, setIsOpen] = useState(false); //드롭다운이 열렸는지 const [isChecked, setIsChecked] = useState(false); //값이 선택이 되었는지 const handleOnChange = (e: React.ChangeEvent): void => { @@ -31,26 +31,27 @@ function DropDownMulti({ setState, state, defaultMsg, itemList }: IProps): React return ( <> - - - {state.length === 0 ? defaultMsg : state.join(', ')} - - - + {title && 카테고리} + + + {state.length === 0 ? defaultMsg : state.join(', ')} + + + {isOpen && ( - + {itemList.map((item, id) => { return (
    - - {id !== itemList.length - 1 && } + + + {item} + + {id !== itemList.length - 1 && }
    ); })} -
    + )} ); diff --git a/src/components/molecules/DropDownMulti/style.ts b/src/components/molecules/DropDownMulti/style.ts index d07d4fc6..beb1950a 100644 --- a/src/components/molecules/DropDownMulti/style.ts +++ b/src/components/molecules/DropDownMulti/style.ts @@ -1,6 +1,13 @@ import Styled, { css } from 'styled-components'; import { palette, theme } from 'styled-tools'; +export const Title = Styled.div` + ${theme('font.subhead4')}; + width: 844px; + margin-bottom: 10px; + color: ${palette('grayscale', 9)}; +`; + export const Item = Styled.span` ${theme('font.body1')}; font-size: 16px; diff --git a/src/components/molecules/FormInput/index.tsx b/src/components/molecules/FormInput/index.tsx new file mode 100644 index 00000000..c7ce13fb --- /dev/null +++ b/src/components/molecules/FormInput/index.tsx @@ -0,0 +1,50 @@ +import { StyledInput } from 'components/atoms'; +import React from 'react'; +import * as S from './style'; + +interface IProps { + title: string; + width: string; + height: string; + isConditionMet: boolean; + onChange?: (value: string) => void; + placeHolder?: string; + errorMsg?: string; + readOnly?: boolean; + isPw?: boolean; + margin?: string; +} + +function FormInput({ + title, + width, + height, + isConditionMet, + placeHolder, + onChange, + errorMsg, + readOnly, + isPw, + margin, +}: IProps): React.ReactElement { + return ( + + {title} + + + + + ); +} + +export default FormInput; diff --git a/src/components/molecules/FormInput/style.ts b/src/components/molecules/FormInput/style.ts new file mode 100644 index 00000000..641d9278 --- /dev/null +++ b/src/components/molecules/FormInput/style.ts @@ -0,0 +1,15 @@ +import Styled from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const FormInputContainer = Styled.div``; + +export const InputWrapper = Styled.div` + margin-bottom: 50px; +`; + +export const Title = Styled.div` + ${theme('font.subhead4')}; + width: 844px; + margin-bottom: 10px; + color: ${palette('grayscale', 9)}; +`; diff --git a/src/components/molecules/ProfileEdit/index.tsx b/src/components/molecules/ProfileEdit/index.tsx new file mode 100644 index 00000000..9a37a9b1 --- /dev/null +++ b/src/components/molecules/ProfileEdit/index.tsx @@ -0,0 +1,30 @@ +import { EditWhiteIcon } from 'assets/images'; +import React from 'react'; +import { ISettingUserInfo } from 'types/setting.type'; +import * as S from './style'; + +interface IProps { + userInfo: ISettingUserInfo; + imgInput: React.RefObject; + handleInputImg: (e: React.ChangeEvent) => void; +} + +function ProfileEdit({ userInfo, imgInput, handleInputImg }: IProps): React.ReactElement { + return ( + + + + + + ); +} + +export default ProfileEdit; diff --git a/src/components/molecules/ProfileEdit/style.ts b/src/components/molecules/ProfileEdit/style.ts new file mode 100644 index 00000000..5b6217d5 --- /dev/null +++ b/src/components/molecules/ProfileEdit/style.ts @@ -0,0 +1,32 @@ +import { Input } from 'components/atoms'; +import Styled from 'styled-components'; + +export const ProfileContainer = Styled.div` + margin-bottom: 90px; +`; + +interface IProfileImg { + url: string; +} +export const ProfileImg = Styled.div` + width: 150px; + height: 150px; + border-radius: 75px; + background: url(${(props) => props.url}) center center / cover; +`; + +export const EditButton = Styled.img` + cursor: pointer; + + position: relative; + top: -54px; + left: 105px; + + width: 45px; + height: 45px; +`; + +export const ProfileInput = Styled(Input)` + width: 0; + height: 0; +`; diff --git a/src/components/molecules/index.ts b/src/components/molecules/index.ts index 6f93f4e1..f21cb3b5 100644 --- a/src/components/molecules/index.ts +++ b/src/components/molecules/index.ts @@ -29,12 +29,14 @@ export { default as DropDown } from './DropDown'; export { default as DropDownMulti } from './DropDownMulti'; export { default as EditorForm } from './EditorForm'; export { default as FindPwdForm } from './FindPwdForm'; +export { default as FormInput } from './FormInput'; export { default as HamDropDown } from './HamDropDown'; export { default as LoginModal } from './LoginModal'; export { default as MyPageConcertCard } from './MyPageConcertCard'; export { default as MyPageSection } from './MyPageSection'; export { default as MyPageSlider } from './MyPageSlider'; export { default as NoticeSingleComment } from './NoticeSingleComment'; +export { default as ProfileEdit } from './ProfileEdit'; export { default as RegisterCard } from './RegisterCard'; export { default as RegisterCompletedModal } from './RegisterCompletedModal'; export { default as RegisterConfirmModal } from './RegisterConfirmModal'; diff --git a/src/components/organisms/SettingForm/index.tsx b/src/components/organisms/SettingForm/index.tsx new file mode 100644 index 00000000..291ff77c --- /dev/null +++ b/src/components/organisms/SettingForm/index.tsx @@ -0,0 +1,95 @@ +import { DropDown, DropDownMulti, FormInput, ProfileEdit, RemovableTag, ToggleSwitch } from 'components/molecules'; +import React from 'react'; +import { interestList } from 'resources/string'; +import { ISettingUserInfo } from 'types/setting.type'; +import * as S from './style'; + +export interface IProps { + userInfo: ISettingUserInfo; + imgInput: React.RefObject; + isBtnAtv: boolean; + handleInputImg: (e: React.ChangeEvent) => void; + handleUserNickname: (nickname: string) => void; + handleClickDel: (e: string) => void; + handleUserInterest: (e: string) => void; + handleUserGender: (e: string) => void; + handleUserMarpolicy: (e: React.ChangeEvent) => void; + handleClickEdit: () => Promise; + handlePasswordBtnClicked: () => void; +} + +function SettingForm({ + userInfo, + imgInput, + isBtnAtv, + handleInputImg, + handleUserNickname, + handleClickDel, + handleUserInterest, + handleUserGender, + handleUserMarpolicy, + handleClickEdit, + handlePasswordBtnClicked, +}: IProps): React.ReactElement { + return ( + + + + + + + + + {userInfo.interest.map((item: string, idx: number) => { + return ; + })} + + + + + 비밀번호 변경 + 비밀번호 변경하기 + + + 이메일 수신 설정 + 오투에서 진행하는 챌린지, 이벤트, 프로모션에 관한 광고를 수신하겠습니다. + + + + + 수정완료 + + + ); +} + +export default SettingForm; diff --git a/src/components/organisms/SettingForm/style.ts b/src/components/organisms/SettingForm/style.ts new file mode 100644 index 00000000..1a918af0 --- /dev/null +++ b/src/components/organisms/SettingForm/style.ts @@ -0,0 +1,95 @@ +import Styled, { css } from 'styled-components'; +import { palette, theme } from 'styled-tools'; + +export const Container = Styled.div` + width: 100%; + padding: 100px 0 400px 0; + + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +`; + +export const TextWrapper = Styled.div` + display: flex; + flex-direction: column; +`; + +export const DropdownWrapper = Styled.div` + margin-bottom: 50px; +`; + +export const InterestList = Styled.div` + width: 844px; + display: flex; + flex-direction: row; + flex-wrap: wrap; + margin-bottom: 50px; +`; + +export const CategoryWrapper = Styled.div` + margin-bottom: 20px; +`; + +export const Txt = Styled.div` + ${theme('font.subhead4')}; + width: 844px; + margin-bottom: 10px; + color: ${palette('grayscale', 9)}; +`; + +export const Text = Styled(Txt)` + width: auto; +`; + +export const TxtSmall = Styled.div` + ${theme('font.body3')}; + color: ${palette('grayscale', 5)}; +`; + +export const PolicyCntnr = Styled.div` + width: 844px; + margin-bottom: 50px; + + display: flex; + flex-direction: row; + align-items: flex-end; + justify-content: space-between; +`; + +export const PwBtn = Styled.div` + ${theme('font.body3')}; + cursor: pointer; + width: 844px; + height: 60px; + margin-bottom: 50px; + border-radius: 4px; + border: 1px solid ${palette('grayscale', 1)}; + background-color: white; + display: flex; + align-items: center; + justify-content: center; + color: ${palette('grayscale', 9)}; +`; + +interface IBtn { + isActive: boolean; +} +export const Btn = Styled.div` + ${theme('font.subhead3')}; + cursor: pointer; + width: 844px; + height: 60px; + border-radius: 4px; + background-color: ${palette('grayscale', 1)}; + ${(props) => + props.isActive && + css` + background-image: linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); + `} + display: flex; + align-items: center; + justify-content: center; + color: ${palette('grayscale', 0)}; +`; diff --git a/src/components/organisms/index.ts b/src/components/organisms/index.ts index 8e12f03b..062c1efc 100644 --- a/src/components/organisms/index.ts +++ b/src/components/organisms/index.ts @@ -11,6 +11,7 @@ export { default as DetailContent } from './DetailContent'; export { default as FindPwd } from './FindPwd'; export { default as Footer } from './Footer'; export { default as Hamburger } from './Hamburger'; +export { default as HashTagAddForm } from './HashTagAddForm'; export { default as Header } from './Header'; export { default as InterestModal } from './InterestModal'; export { default as JoinCheck } from './JoinCheck'; @@ -25,4 +26,4 @@ export { default as NoticeList } from './NoticeList'; export { default as RegisterDetailCard } from './RegisterDetailCard'; export { default as SearchForm } from './SearchForm'; export { default as SetNewPwd } from './SetNewPwd'; -export { default as HashTagAddForm } from './HashTagAddForm'; +export { default as SettingForm } from './SettingForm'; diff --git a/src/pages/Setting/template/index.tsx b/src/pages/Setting/template/index.tsx index c66dabbb..bdbb4be3 100644 --- a/src/pages/Setting/template/index.tsx +++ b/src/pages/Setting/template/index.tsx @@ -1,8 +1,5 @@ -import { EditWhiteIcon } from 'assets/images'; -import { StyledInput } from 'components/atoms'; -import { DropDown, DropDownMulti, RemovableTag, ToggleSwitch } from 'components/molecules'; +import { SettingForm } from 'components/organisms'; import React from 'react'; -import { interestList } from 'resources/string'; import { ISettingUserInfo } from 'types/setting.type'; import * as S from './style'; @@ -35,69 +32,20 @@ function SettingTemplate({ }: IProps): React.ReactElement { return ( - - - - - - 아이디 - {userInfo.email} - 닉네임 - - - - 카테고리 - - - - - {userInfo.interest.map((item: string, idx: number) => { - return ; - })} - - 성별 - - - - 비밀번호 변경 - 비밀번호 변경하기 - - - 이메일 수신 설정 - 오투에서 진행하는 챌린지, 이벤트, 프로모션에 관한 광고를 수신하겠습니다. - - - - - 수정완료 - + + {/* TODO: 회원탈퇴 버튼 들어갈 부분 */} ); } diff --git a/src/pages/Setting/template/style.ts b/src/pages/Setting/template/style.ts index 34ebdc4c..fe741176 100644 --- a/src/pages/Setting/template/style.ts +++ b/src/pages/Setting/template/style.ts @@ -1,6 +1,4 @@ -import { Input } from 'components/atoms'; -import Styled, { css } from 'styled-components'; -import { palette, theme } from 'styled-tools'; +import Styled from 'styled-components'; export const Container = Styled.div` width: 100%; @@ -11,133 +9,3 @@ export const Container = Styled.div` align-items: center; justify-content: center; `; - -export const ProfileInput = Styled(Input)` - width: 0; - height: 0; -`; - -export const TextWrapper = Styled.div` - display: flex; - flex-direction: column; -`; - -export const DropdownWrapper = Styled.div` - margin-bottom: 50px; -`; - -export const InterestList = Styled.div` - width: 844px; - display: flex; - flex-direction: row; - flex-wrap: wrap; - margin-bottom: 50px; -`; - -export const CategoryContainer = Styled.div` - margin-bottom: 20px; -`; - -export const NicknameInputContainer = Styled.div` - margin-bottom: 50px; -`; - -export const ProfileContainer = Styled.div` - margin-bottom: 90px; -`; - -interface IProfileImg { - url: string; -} -export const ProfileImg = Styled.div` - width: 150px; - height: 150px; - border-radius: 75px; - background: url(${(props) => props.url}) center center / cover; -`; - -export const EditBtn = Styled.img` - cursor: pointer; - - position: relative; - top: -54px; - left: 105px; - - width: 45px; - height: 45px; -`; - -export const Txt = Styled.div` - ${theme('font.subhead4')}; - width: 844px; - margin-bottom: 10px; - color: ${palette('grayscale', 9)}; -`; - -export const Text = Styled(Txt)` - width: auto; -`; - -export const TxtSmall = Styled.div` - ${theme('font.body3')}; - color: ${palette('grayscale', 5)}; -`; - -export const Email = Styled.div` - ${theme('font.subhead3')}; - width: 844px; - height: 60px; - margin-bottom: 50px; - padding: 18px 20px 18px 20px; - border-radius: 4px; - background-color: ${palette('grayscale', 1)}; - display: flex; - align-items: center; - color: ${palette('grayscale', 4)}; -`; - -export const PolicyCntnr = Styled.div` - width: 844px; - margin-bottom: 50px; - - display: flex; - flex-direction: row; - align-items: flex-end; - justify-content: space-between; -`; - -export const PwBtn = Styled.div` - ${theme('font.body3')}; - cursor: pointer; - width: 844px; - height: 60px; - margin-bottom: 50px; - border-radius: 4px; - border: 1px solid ${palette('grayscale', 1)}; - background-color: white; - display: flex; - align-items: center; - justify-content: center; - color: ${palette('grayscale', 9)}; -`; - -interface IBtn { - isActive: boolean; -} -export const Btn = Styled.div` - ${theme('font.subhead3')}; - cursor: pointer; - width: 844px; - height: 60px; - border-radius: 4px; - background-color: ${palette('grayscale', 1)}; - ${(props) => - props.isActive && - css` - background-image: linear-gradient(to right, ${palette('primary', 3)}, ${palette('primary', 0)}); - `} - display: flex; - align-items: center; - justify-content: center; - color: ${palette('grayscale', 0)}; -`; From e080b1a606d8063fb6d8dc345eb3818e677baf9c Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Wed, 11 Aug 2021 01:56:00 +0900 Subject: [PATCH 73/80] =?UTF-8?q?Refactor=20:=20=EB=8C=93=EA=B8=80?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/ChallengeSingleComment/index.tsx | 8 ++++++-- src/types/challenge.type.ts | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/molecules/ChallengeSingleComment/index.tsx b/src/components/molecules/ChallengeSingleComment/index.tsx index fe8fb955..1989de55 100644 --- a/src/components/molecules/ChallengeSingleComment/index.tsx +++ b/src/components/molecules/ChallengeSingleComment/index.tsx @@ -6,6 +6,7 @@ import { CommentFold, CommentWrapper, RecommentWrapper, SingleCommentWrapper } f interface IProps { commentData: ICommentData; challengeID: string; + comments: number; commentListFlag: boolean; setCommentListFlag: (value: boolean) => void; } @@ -13,10 +14,11 @@ interface IProps { function ChallengeSingleComment({ commentData, challengeID, + comments, commentListFlag, setCommentListFlag, }: IProps): React.ReactElement { - const { childrenComment, _id, userID, text } = commentData; + const { childrenComment, _id, userID, text, isDeleted } = commentData; const [openReply, setOpenReply] = useState(false); const onClickReplyOpen = () => { @@ -28,7 +30,7 @@ function ChallengeSingleComment({

    {userID?.nickname}

    -

    {text}

    +

    {isDeleted ? '삭제된 댓글입니다.' : text}

    {openReply ? '접기' : '답글보기'}
    @@ -38,6 +40,7 @@ function ChallengeSingleComment({ className="reply__write" isComment={false} //답글부분 challengeID={challengeID} + comments={comments} commentListFlag={commentListFlag} setCommentListFlag={setCommentListFlag} parentCommentId={_id} @@ -49,6 +52,7 @@ function ChallengeSingleComment({ img={data.userID?.img} nickname={data.userID?.nickname} text={data.text} + isDeleted={data.isDeleted} /> ))} diff --git a/src/types/challenge.type.ts b/src/types/challenge.type.ts index 9333fa31..57cbfcab 100644 --- a/src/types/challenge.type.ts +++ b/src/types/challenge.type.ts @@ -35,6 +35,7 @@ export interface IChallenge { export interface ICommentData { childrenComment: { + isDeleted?: boolean; _id: string; userID: { img: string; @@ -50,6 +51,7 @@ export interface ICommentData { nickname: string; }; text: string; + isDeleted?: boolean; } export interface IChallengeData { From 03982d97a528e524c4e2bf36c12be0c98c2ba585 Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Wed, 11 Aug 2021 01:57:41 +0900 Subject: [PATCH 74/80] =?UTF-8?q?Refactor=20:=20=EB=B9=84=ED=9A=8C?= =?UTF-8?q?=EC=9B=90=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=EB=AA=A8=EB=8B=AC=20?= =?UTF-8?q?=EB=9D=84=EC=9A=B0=EA=B8=B0=20=EB=B0=8F=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=EB=AA=A8=EB=8B=AC=20=EB=B2=84=EA=B7=B8css=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../molecules/ChallengeCommentWrite/index.tsx | 22 ++++++++++++++++--- src/components/molecules/LoginModal/style.ts | 5 +++-- .../molecules/RegisterCard/index.tsx | 20 +++++++++++++++-- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/src/components/molecules/ChallengeCommentWrite/index.tsx b/src/components/molecules/ChallengeCommentWrite/index.tsx index 809896c4..f5d38ad1 100644 --- a/src/components/molecules/ChallengeCommentWrite/index.tsx +++ b/src/components/molecules/ChallengeCommentWrite/index.tsx @@ -1,4 +1,5 @@ import { postChallengeComment } from 'apis'; +import { LoginModal } from 'components/molecules'; import React, { useState } from 'react'; import { useRecoilValue } from 'recoil'; import { userStatusState } from 'stores/user'; @@ -7,6 +8,7 @@ import { CommentSubmitButton, CommentWriteWrapper } from './style'; export interface IProps { className?: string; isComment: boolean; + comments: number; challengeID: string; commentListFlag: boolean; setCommentListFlag: (value: boolean) => void; @@ -16,12 +18,17 @@ export interface IProps { function ChallengeCommentWrite({ className, isComment, + comments, challengeID, commentListFlag, setCommentListFlag, parentCommentId, }: IProps): React.ReactElement { + const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); const userStatusData = useRecoilValue(userStatusState); + const [userStateNum, setUserState] = useState(userStatusData ? userStatusData.userType : 0); + const [commentIsRender, setCommentIsRender] = useState(false); + const [commentCount, setCommentCount] = useState(comments); const [value, setValue] = useState(''); const handleChange = (event: React.ChangeEvent) => { @@ -29,9 +36,14 @@ function ChallengeCommentWrite({ }; const btnHandler = async (e: React.MouseEvent) => { - e.preventDefault(); - if (isComment) await postComment(); - else await postReComment(); + if (userStateNum === 0) { + e.preventDefault(); + return setIsLoginModalOpen(true); + } else { + e.preventDefault(); + if (isComment) await postComment(); + else await postReComment(); + } }; const postComment = async () => { @@ -40,6 +52,9 @@ function ChallengeCommentWrite({ await postChallengeComment(userStatusData.token, challengeID, { parentID: null, text: value }); } setCommentListFlag(!commentListFlag); + setCommentIsRender(true); + setCommentCount(commentCount + 1); + console.log(commentCount); }; const postReComment = async () => { @@ -56,6 +71,7 @@ function ChallengeCommentWrite({ {isComment ? '댓글 작성' : '답글 작성'} + ); } diff --git a/src/components/molecules/LoginModal/style.ts b/src/components/molecules/LoginModal/style.ts index 4a0d985c..28a12719 100644 --- a/src/components/molecules/LoginModal/style.ts +++ b/src/components/molecules/LoginModal/style.ts @@ -25,8 +25,10 @@ export const LoginNoticeDetail = Styled.div` `; export const ButtonContainer = Styled.div` - padding-top:50px; + padding:50px 100px 0px 100px; text-align: center; + justify-content : space-between; + display:flex; `; export const CancelButton = Styled(Button)` @@ -35,7 +37,6 @@ export const CancelButton = Styled(Button)` `; export const LoginButton = Styled(Button)` - padding-left:170px; color: ${palette('primary', 5)}; ${theme('font.subhead4')}; `; diff --git a/src/components/molecules/RegisterCard/index.tsx b/src/components/molecules/RegisterCard/index.tsx index b7d36a1a..f2199cbc 100644 --- a/src/components/molecules/RegisterCard/index.tsx +++ b/src/components/molecules/RegisterCard/index.tsx @@ -1,5 +1,8 @@ import { MinusIcon, PlusIcon } from 'assets/images'; -import React from 'react'; +import { LoginModal } from 'components/molecules'; +import React, { useState } from 'react'; +import { useRecoilValue } from 'recoil'; +import { userStatusState } from 'stores/user'; import { IAdminChallengePeriod } from 'types/admin.type'; import { BoxWrapper, CardDetailWrapper, CardSettingWrapper, ChallengeSetting, RegisterButton } from './style'; @@ -18,12 +21,24 @@ function RegisterCard({ registerCount, setRegisterCount, }: IProps): React.ReactElement { + const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); + const userStatusData = useRecoilValue(userStatusState); + const [userStateNum, setUserState] = useState(userStatusData ? userStatusData.userType : 0); + function minusCount() { if (registerCount > 0) { setRegisterCount(registerCount - 1); } } + function registerAuthority() { + if (userStateNum === 0) { + return setIsLoginModalOpen(true); + } else { + setIsOpenModal(true); + } + } + const getRestDay = (dateString: string): number => { const date = new Date( parseInt(dateString.substr(0, 4)), @@ -69,12 +84,13 @@ function RegisterCard({ + ); From d155f7485c9db424d4ca1e287027b0b4a2d417fc Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Wed, 11 Aug 2021 01:59:46 +0900 Subject: [PATCH 75/80] =?UTF-8?q?Refactor=20:=20=EB=9F=B0=EB=A7=88?= =?UTF-8?q?=EC=85=80=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20=EC=84=A0?= =?UTF-8?q?=ED=83=9D=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../molecules/ChallengeHeader/index.tsx | 16 +++------------- .../molecules/ChallengeHeader/style.ts | 9 +++++---- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/components/molecules/ChallengeHeader/index.tsx b/src/components/molecules/ChallengeHeader/index.tsx index ea7a6fcc..325f1253 100644 --- a/src/components/molecules/ChallengeHeader/index.tsx +++ b/src/components/molecules/ChallengeHeader/index.tsx @@ -41,13 +41,7 @@ interface IProps { // 3: 챌린지하는유저&챌린지종료, // 4: 관리자 -function ChallengeHeader({ - isClickedEntire, - setIsClickedEntire, - challengeList, - setChallengeList, - generationNum, -}: IProps): React.ReactElement { +function ChallengeHeader({ challengeList, setChallengeList, generationNum }: IProps): React.ReactElement { const userStatusData = useRecoilValue(userStatusState); const [selectedCategory, setSelectedCategory] = useState('전체'); const [keyword, setKeyword] = useState(''); @@ -97,13 +91,9 @@ function ChallengeHeader({ }; const reRenderCategory = (category: string) => { - if (category === '전체') { - setSelectedCategory(''); - setIsClickedEntire(!isClickedEntire); - } else { - setSelectedCategory(category); - } + setSelectedCategory(category); }; + const reRenderKeyword = (keyword: string) => { setKeyword(keyword); }; diff --git a/src/components/molecules/ChallengeHeader/style.ts b/src/components/molecules/ChallengeHeader/style.ts index aab71c0a..21b9b02a 100644 --- a/src/components/molecules/ChallengeHeader/style.ts +++ b/src/components/molecules/ChallengeHeader/style.ts @@ -51,8 +51,9 @@ export const HeaderWrapper = Styled.div` } h5{ position: fixed; - top: 807px; + top: 607px; left: 180px; + opacity: 0.07; border-radius:100%; background: ${palette('primary', 5)}; width: 200px; @@ -67,7 +68,7 @@ export const WriteButton = Styled.button` border:none; border-radius:100%; background-color:${palette('grayscale', 0)}; - height:64px; + height:0px; img{ align-items:center; @@ -83,7 +84,7 @@ export const AllFeedButtom = Styled.button` border-radius:100%; background-color:${palette('grayscale', 0)}; padding-bottom: 40px; - height:64px; + height:0px; img{ align-items:center; @@ -98,7 +99,7 @@ export const MyFeedButtom = Styled.button` border:none; border-radius:100%; background-color:${palette('grayscale', 0)}; - height:64px; + height:0px; img{ align-items:center; From 8f0eed4b70839ef3296ced72544047a2e7a3b9db Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Wed, 11 Aug 2021 02:00:06 +0900 Subject: [PATCH 76/80] =?UTF-8?q?Refactor=20:=20=EC=B1=8C=EB=A6=B0?= =?UTF-8?q?=EC=A7=80=20=EC=8B=A0=EC=B2=AD=20=EB=AA=A8=EB=8B=AC=20=EC=B7=A8?= =?UTF-8?q?=EC=86=8C=EB=B2=84=ED=8A=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../molecules/RegisterConfirmModal/index.tsx | 19 +++++++++++++++++-- .../molecules/RegisterConfirmModal/style.ts | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/components/molecules/RegisterConfirmModal/index.tsx b/src/components/molecules/RegisterConfirmModal/index.tsx index d45ef39a..e049e871 100644 --- a/src/components/molecules/RegisterConfirmModal/index.tsx +++ b/src/components/molecules/RegisterConfirmModal/index.tsx @@ -1,10 +1,18 @@ -import { CautionIcon, CheckIcon } from 'assets/images'; +import { CautionIcon, CheckIcon, XIcon } from 'assets/images'; import { Modal } from 'components/atoms'; import React from 'react'; import { useRecoilState } from 'recoil'; import { userState } from 'stores/user'; import { IAdminChallengePeriod } from 'types/admin.type'; -import { CautionWrapper, ConfirmDetail, ConfirmModalWrapper, DetailContent, ModalButton } from './style'; +import { + CautionWrapper, + ConfirmDetail, + ConfirmModalWrapper, + DetailContent, + ImgIcon, + ModalButton, + XButton, +} from './style'; interface IProps { isOpenModal: boolean; @@ -27,6 +35,13 @@ function RegisterConfirmModal({ return ( + { + setIsOpenModal(false); + }} + > + +

    잠깐! 확인하고 신청 완료하세요

    아래 정보를 확인해주세요

    diff --git a/src/components/molecules/RegisterConfirmModal/style.ts b/src/components/molecules/RegisterConfirmModal/style.ts index e6766d08..5ea3b40b 100644 --- a/src/components/molecules/RegisterConfirmModal/style.ts +++ b/src/components/molecules/RegisterConfirmModal/style.ts @@ -1,6 +1,24 @@ +import { Button, Img } from 'components/atoms'; import Styled from 'styled-components'; import { palette, theme } from 'styled-tools'; +export const XButton = Styled(Button)` +width:24px; +height:24px; +float:right; +margin-right:30px; +margin-top:30px; +cursor: pointer; + +`; + +export const ImgIcon = Styled(Img)` + width:24px; + height:24px; + float:right; + cursor: pointer; +`; + export const ConfirmModalWrapper = Styled.div` position: fixed; top:0; From 41e026394a502ad3715335166c798af69dd5442e Mon Sep 17 00:00:00 2001 From: Hyoin-Kim Date: Wed, 11 Aug 2021 19:03:58 +0900 Subject: [PATCH 77/80] =?UTF-8?q?Refactor=20:=20=EB=B9=84=ED=9A=8C?= =?UTF-8?q?=EC=9B=90=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EB=AA=A8=EB=8B=AC?= =?UTF-8?q?=EB=9D=84=EC=9A=B0=EA=B8=B0=20=EB=B0=8F=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=EC=BD=94=EB=93=9C=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../molecules/ChallengeCardFold/index.tsx | 20 +++++++++++++++---- .../molecules/ChallengeComment/index.tsx | 4 ++++ .../molecules/ChallengeCommentWrite/index.tsx | 7 +------ .../molecules/ChallengeHeader/index.tsx | 2 -- .../ChallengeSingleComment/index.tsx | 4 ++-- src/pages/ChallengeList/index.tsx | 5 +---- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/components/molecules/ChallengeCardFold/index.tsx b/src/components/molecules/ChallengeCardFold/index.tsx index 27570fc0..38b0cdf4 100644 --- a/src/components/molecules/ChallengeCardFold/index.tsx +++ b/src/components/molecules/ChallengeCardFold/index.tsx @@ -8,12 +8,15 @@ import { CommentButton, CommentFoldButton } from './style'; interface IProps { id: string; + comments: number; + setIsLoginModalOpen: (value: boolean) => void; } -function ChallengeCardFold({ id }: IProps): React.ReactElement { +function ChallengeCardFold({ id, comments, setIsLoginModalOpen }: IProps): React.ReactElement { + const userStatusData = useRecoilValue(userStatusState); + const [userStateNum, setUserState] = useState(userStatusData ? userStatusData.userType : 0); const [isOpenComment, setIsOpenComment] = useState(false); const [isFoldComment, setIsFoldComment] = useState(true); - const userStatusData = useRecoilValue(userStatusState); const [isCommentListFlag, setIsCommentListFlag] = useState(false); const [myCommentList, setMyCommentList] = useState(null); @@ -28,13 +31,21 @@ function ChallengeCardFold({ id }: IProps): React.ReactElement { getCommentList(); }, [isCommentListFlag, getCommentList]); + function commentAuthorization() { + if (userStateNum === 0) { + return setIsLoginModalOpen(true); + } else { + setIsOpenComment(true); + getCommentList(); + } + } + return ( <> {isOpenComment === false ? ( { - setIsOpenComment(true); - getCommentList(); + commentAuthorization(); }} > 댓글 펼치기 @@ -45,6 +56,7 @@ function ChallengeCardFold({ id }: IProps): React.ReactElement { diff --git a/src/components/molecules/ChallengeComment/index.tsx b/src/components/molecules/ChallengeComment/index.tsx index a77c2516..ff664338 100644 --- a/src/components/molecules/ChallengeComment/index.tsx +++ b/src/components/molecules/ChallengeComment/index.tsx @@ -6,6 +6,7 @@ import { CommentListWrapper } from './style'; interface IProps { commentList: Array | null; challengeID: string; + comments: number; commentListFlag: boolean; setCommentListFlag: (value: boolean) => void; } @@ -14,6 +15,7 @@ function ChallengeComment({ commentList, challengeID, commentListFlag, + comments, setCommentListFlag, }: IProps): React.ReactElement { return ( @@ -22,6 +24,7 @@ function ChallengeComment({ className="comment__write" isComment={true} //댓글부분 challengeID={challengeID} + comments={comments} commentListFlag={commentListFlag} setCommentListFlag={setCommentListFlag} /> @@ -29,6 +32,7 @@ function ChallengeComment({ (false); - const [commentCount, setCommentCount] = useState(comments); const [value, setValue] = useState(''); const handleChange = (event: React.ChangeEvent) => { @@ -52,9 +50,6 @@ function ChallengeCommentWrite({ await postChallengeComment(userStatusData.token, challengeID, { parentID: null, text: value }); } setCommentListFlag(!commentListFlag); - setCommentIsRender(true); - setCommentCount(commentCount + 1); - console.log(commentCount); }; const postReComment = async () => { diff --git a/src/components/molecules/ChallengeHeader/index.tsx b/src/components/molecules/ChallengeHeader/index.tsx index 325f1253..ebceda6d 100644 --- a/src/components/molecules/ChallengeHeader/index.tsx +++ b/src/components/molecules/ChallengeHeader/index.tsx @@ -30,8 +30,6 @@ interface IProps { challengeList: IChallengeDataList[] | null; setChallengeList: (value: IChallengeDataList[]) => void; generationNum: string; - isClickedEntire: boolean; - setIsClickedEntire: (value: boolean) => void; } //userState상태 : diff --git a/src/components/molecules/ChallengeSingleComment/index.tsx b/src/components/molecules/ChallengeSingleComment/index.tsx index 1989de55..50d54a14 100644 --- a/src/components/molecules/ChallengeSingleComment/index.tsx +++ b/src/components/molecules/ChallengeSingleComment/index.tsx @@ -6,16 +6,16 @@ import { CommentFold, CommentWrapper, RecommentWrapper, SingleCommentWrapper } f interface IProps { commentData: ICommentData; challengeID: string; - comments: number; commentListFlag: boolean; + comments: number; setCommentListFlag: (value: boolean) => void; } function ChallengeSingleComment({ commentData, challengeID, - comments, commentListFlag, + comments, setCommentListFlag, }: IProps): React.ReactElement { const { childrenComment, _id, userID, text, isDeleted } = commentData; diff --git a/src/pages/ChallengeList/index.tsx b/src/pages/ChallengeList/index.tsx index d1cce3a1..80ba4bc1 100644 --- a/src/pages/ChallengeList/index.tsx +++ b/src/pages/ChallengeList/index.tsx @@ -15,7 +15,6 @@ function ChallengeView({ match }: RouteComponentProps): React.React const { generationNum } = match.params; const [challengeList, setChallengeList] = useState(null); const userStatusData = useRecoilValue(userStatusState); - const [isClickedEntire, setIsClickedEntire] = useState(false); const getChallengeList = useCallback( async (token: string | null, offset: number, limit: number): Promise => { @@ -27,7 +26,7 @@ function ChallengeView({ match }: RouteComponentProps): React.React React.useEffect(() => { getChallengeList(userStatusData && userStatusData.token, 0, 10); - }, [getChallengeList, isClickedEntire, userStatusData]); + }, [getChallengeList, userStatusData]); return (
    @@ -35,8 +34,6 @@ function ChallengeView({ match }: RouteComponentProps): React.React challengeList={challengeList} setChallengeList={setChallengeList} generationNum={generationNum} - isClickedEntire={isClickedEntire} - setIsClickedEntire={setIsClickedEntire} /> Date: Wed, 11 Aug 2021 19:04:30 +0900 Subject: [PATCH 78/80] =?UTF-8?q?Refactor=20:=20=EC=82=AD=EC=A0=9C/?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EB=AA=A8=EB=8B=AC=20css=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/DeleteModal/style.ts | 3 ++- src/components/molecules/LoginModal/style.ts | 3 ++- .../molecules/RegisterConfirmModal/style.ts | 13 ++++++------- .../organisms/ChallengeDetailCard/index.tsx | 9 +++++---- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/components/molecules/DeleteModal/style.ts b/src/components/molecules/DeleteModal/style.ts index 921fba5a..d5176618 100644 --- a/src/components/molecules/DeleteModal/style.ts +++ b/src/components/molecules/DeleteModal/style.ts @@ -48,7 +48,8 @@ export const Wrapper = Styled.div` left:0; margin:auto; border-radius: 16px; - background-color: #FFFFFF; + border: solid 1px ${palette('grayscale', 4)}; + background-color: ${palette('grayscale', 0)}; width: 500px; height: 312px; `; diff --git a/src/components/molecules/LoginModal/style.ts b/src/components/molecules/LoginModal/style.ts index 28a12719..45d6c43e 100644 --- a/src/components/molecules/LoginModal/style.ts +++ b/src/components/molecules/LoginModal/style.ts @@ -49,7 +49,8 @@ export const LoginModalWrapper = Styled.div` left:0; margin:auto; border-radius: 16px; - background-color: #FFFFFF; + border: solid 1px ${palette('grayscale', 4)}; + background-color: ${palette('grayscale', 0)}; width: 500px; height: 312px; `; diff --git a/src/components/molecules/RegisterConfirmModal/style.ts b/src/components/molecules/RegisterConfirmModal/style.ts index 5ea3b40b..01c4d0c5 100644 --- a/src/components/molecules/RegisterConfirmModal/style.ts +++ b/src/components/molecules/RegisterConfirmModal/style.ts @@ -3,13 +3,12 @@ import Styled from 'styled-components'; import { palette, theme } from 'styled-tools'; export const XButton = Styled(Button)` -width:24px; -height:24px; -float:right; -margin-right:30px; -margin-top:30px; -cursor: pointer; - + width:24px; + height:24px; + float:right; + margin-right:30px; + margin-top:30px; + cursor: pointer; `; export const ImgIcon = Styled(Img)` diff --git a/src/components/organisms/ChallengeDetailCard/index.tsx b/src/components/organisms/ChallengeDetailCard/index.tsx index d8b25205..e5c64eea 100644 --- a/src/components/organisms/ChallengeDetailCard/index.tsx +++ b/src/components/organisms/ChallengeDetailCard/index.tsx @@ -21,7 +21,7 @@ interface IProps { bad?: string; learn?: string; like: number; - comments?: number; + comments: number; isLike?: boolean; isScrap?: boolean; id: string; @@ -52,11 +52,12 @@ function ChallengeDetailCard({ const [isMine, setIsMine] = useState(false); const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); + const [isRerender, setIsRerender] = useState(false); useEffect(() => { setIsMine(nickname === userStateNickname); - document.body.style.overflow = isDeleteModalOpen === true ? 'hidden' : 'unset'; - }, [isDeleteModalOpen, nickname, userStateNickname]); + document.body.style.overflow = isDeleteModalOpen || isLoginModalOpen === true ? 'hidden' : 'unset'; + }, [isDeleteModalOpen, isLoginModalOpen, nickname, userStateNickname]); const deleteClickHandler = async () => { if (userStatusData) { @@ -97,7 +98,7 @@ function ChallengeDetailCard({ id={id} /> } - + Date: Wed, 11 Aug 2021 19:05:01 +0900 Subject: [PATCH 79/80] =?UTF-8?q?Refactor=20:=20=EB=9F=B0=EB=A7=88?= =?UTF-8?q?=EC=85=80=20=EC=B1=8C=EB=A6=B0=EC=A7=80=20=EC=B9=B4=EB=93=9C=20?= =?UTF-8?q?=EC=8B=9C=EA=B0=84=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../molecules/ChallengeCardProfile/index.tsx | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/components/molecules/ChallengeCardProfile/index.tsx b/src/components/molecules/ChallengeCardProfile/index.tsx index d1bcb051..1df69cd3 100644 --- a/src/components/molecules/ChallengeCardProfile/index.tsx +++ b/src/components/molecules/ChallengeCardProfile/index.tsx @@ -44,6 +44,28 @@ function ChallengeCardProfile({ const userStatusData = useRecoilValue(userStatusState); const [userStateNum, setUserState] = useState(userStatusData ? userStatusData.userType : 0); + const timeForToday = (value: any) => { + const today = new Date(); + const timeValue = new Date(value); + + const betweenTime = Math.floor((today.getTime() - timeValue.getTime()) / 1000 / 60); + if (betweenTime < 1) { + return '방금전'; + } else if (betweenTime < 60) { + return `${betweenTime}분전`; + } + + const betweenTimeHour = Math.floor(betweenTime / 60); + if (betweenTimeHour < 24) { + return `${betweenTimeHour}시간전`; + } + + const betweenTimeDay = Math.floor(betweenTime / 60 / 24); + if (betweenTimeDay < 365) { + return dayjs(createdAt).format('YY.MM.DD'); + } + }; + const submitScrap = async () => { if (userStatusData) { const token = userStatusData.token; @@ -74,6 +96,10 @@ function ChallengeCardProfile({ userStateNum === 0 ? setIsLoginModalOpen(true) : setIsLoginModalOpen(false); }; + const menuTimer = setTimeout(function () { + setIsMenuBar(true); + }, 8000); + //userState상태 : // 0: 비회원, // 1: 챌린지안하는유저, @@ -88,7 +114,7 @@ function ChallengeCardProfile({

    {nickname}

    -

    {dayjs(createdAt).format('MM.DD')}

    +

    {timeForToday(createdAt)}

    {userStateNum === 0 || userStateNum === 1 || userStateNum === 2 || isMine === false ? ( scrapRender === false ? ( @@ -139,6 +165,7 @@ function ChallengeCardProfile({ alt="" onClick={() => { setIsMenuBar(false); + menuTimer; }} /> From 92f232626b77a28ebfeed435668fbed5e68b7aa6 Mon Sep 17 00:00:00 2001 From: Subin Date: Thu, 12 Aug 2021 15:38:16 +0900 Subject: [PATCH 80/80] =?UTF-8?q?Refactor:=20=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=EC=95=A0=EB=8B=88=EB=A9=94=EC=9D=B4=EC=85=98=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 85 ---------------------- package.json | 1 - src/pages/Home/index.tsx | 150 +++++++++++++++++---------------------- 3 files changed, 64 insertions(+), 172 deletions(-) diff --git a/package-lock.json b/package-lock.json index ccab836c..e76a5f3d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1217,23 +1217,6 @@ "resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz", "integrity": "sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg==" }, - "@emotion/cache": { - "version": "11.4.0", - "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.4.0.tgz", - "integrity": "sha512-Zx70bjE7LErRO9OaZrhf22Qye1y4F7iDl+ITjet0J+i+B88PrAOBkKvaAWhxsZf72tDLajwCgfCjJ2dvH77C3g==", - "requires": { - "@emotion/memoize": "^0.7.4", - "@emotion/sheet": "^1.0.0", - "@emotion/utils": "^1.0.0", - "@emotion/weak-memoize": "^0.2.5", - "stylis": "^4.0.3" - } - }, - "@emotion/hash": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", - "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" - }, "@emotion/is-prop-valid": { "version": "0.8.8", "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz", @@ -1247,37 +1230,6 @@ "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz", "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==" }, - "@emotion/react": { - "version": "11.4.0", - "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.4.0.tgz", - "integrity": "sha512-4XklWsl9BdtatLoJpSjusXhpKv9YVteYKh9hPKP1Sxl+mswEFoUe0WtmtWjxEjkA51DQ2QRMCNOvKcSlCQ7ivg==", - "requires": { - "@babel/runtime": "^7.13.10", - "@emotion/cache": "^11.4.0", - "@emotion/serialize": "^1.0.2", - "@emotion/sheet": "^1.0.1", - "@emotion/utils": "^1.0.0", - "@emotion/weak-memoize": "^0.2.5", - "hoist-non-react-statics": "^3.3.1" - } - }, - "@emotion/serialize": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.0.2.tgz", - "integrity": "sha512-95MgNJ9+/ajxU7QIAruiOAdYNjxZX7G2mhgrtDWswA21VviYIRP1R5QilZ/bDY42xiKsaktP4egJb3QdYQZi1A==", - "requires": { - "@emotion/hash": "^0.8.0", - "@emotion/memoize": "^0.7.4", - "@emotion/unitless": "^0.7.5", - "@emotion/utils": "^1.0.0", - "csstype": "^3.0.2" - } - }, - "@emotion/sheet": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.0.1.tgz", - "integrity": "sha512-GbIvVMe4U+Zc+929N1V7nW6YYJtidj31lidSmdYcWozwoBIObXBnaJkKNDjZrLm9Nc0BR+ZyHNaRZxqNZbof5g==" - }, "@emotion/stylis": { "version": "0.8.5", "resolved": "https://registry.npmjs.org/@emotion/stylis/-/stylis-0.8.5.tgz", @@ -1288,16 +1240,6 @@ "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz", "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" }, - "@emotion/utils": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.0.0.tgz", - "integrity": "sha512-mQC2b3XLDs6QCW+pDQDiyO/EdGZYOygE8s5N5rrzjSI4M3IejPE/JPndCBwRT9z982aqQNi6beWs1UeayrQxxA==" - }, - "@emotion/weak-memoize": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz", - "integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==" - }, "@eslint/eslintrc": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.2.tgz", @@ -12516,23 +12458,6 @@ "whatwg-fetch": "^3.4.1" } }, - "react-awesome-reveal": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/react-awesome-reveal/-/react-awesome-reveal-3.8.1.tgz", - "integrity": "sha512-cB+XubgAa7QJ9ibkHePiVGTOzRKokqdDOP+yLfQtw5uu+xsAR/kwktLntMZev+1GBz2NhlcpbYvKqEbVIkKfLw==", - "requires": { - "@emotion/react": "^11.4.0", - "react-intersection-observer": "^8.32.0", - "react-is": "^17.0.2" - }, - "dependencies": { - "react-is": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", - "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" - } - } - }, "react-dev-utils": { "version": "11.0.4", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-11.0.4.tgz", @@ -12699,11 +12624,6 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz", "integrity": "sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew==" }, - "react-intersection-observer": { - "version": "8.32.0", - "resolved": "https://registry.npmjs.org/react-intersection-observer/-/react-intersection-observer-8.32.0.tgz", - "integrity": "sha512-RlC6FvS3MFShxTn4FHAy904bVjX5Nn4/eTjUkurW0fHK+M/fyQdXuyCy9+L7yjA+YMGogzzSJNc7M4UtfSKvtw==" - }, "react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -14492,11 +14412,6 @@ } } }, - "stylis": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.10.tgz", - "integrity": "sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg==" - }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", diff --git a/package.json b/package.json index 99f409ad..95e730a2 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "axios": "^0.21.1", "dayjs": "^1.10.6", "react": "^17.0.2", - "react-awesome-reveal": "3.8.1", "react-dom": "^17.0.2", "react-quill": "1.3.5", "react-router-dom": "^5.2.0", diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index 35d467f2..c026485a 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -1,4 +1,3 @@ -import { keyframes } from '@emotion/react'; import { getGeneration } from 'apis'; import { CommunicationKingFillIcon, @@ -22,8 +21,8 @@ import { } from 'assets/images'; import { BadgeCard, SpeakerExpCard } from 'components/molecules'; import React, { useEffect, useState } from 'react'; -import Reveal from 'react-awesome-reveal'; import { Link } from 'react-router-dom'; +import { keyframes } from 'styled-components'; import { BadgeWrapper, ChallengeBtn, @@ -86,30 +85,25 @@ function Home(): React.ReactElement { return ( - - - O2 - - 함께 성장하는 공간,
    - 창업가들이 마시는 산소 -
    - 답답한 창업 여정에 시원한 산소 한 모금 - - 챌린지 보러가기 - -
    -
    + + O2 + + 함께 성장하는 공간,
    + 창업가들이 마시는 산소 +
    + 답답한 창업 여정에 시원한 산소 한 모금 + + 챌린지 보러가기 + +
    - - Learn Myself - 나에게 배우다, 나를 배우다. - - 오늘의 잘한 점과 못한 점, 배운 점을 기록해요. -
    - 배운 점을 적용하며 더 성장한 내일의 나를 만들어요. -
    -
    - {/* */} + Learn Myself + 나에게 배우다, 나를 배우다. + + 오늘의 잘한 점과 못한 점, 배운 점을 기록해요. +
    + 배운 점을 적용하며 더 성장한 내일의 나를 만들어요. +
    @@ -119,62 +113,54 @@ function Home(): React.ReactElement { {/*
    */}
    - - Share Together - 경험을 나누다, 함께 성장하다. - - 누구나 O2 Speaker가 될 수 있어요. -
    - O2 People 앞에서 당신의 이야기를 나눠주세요. -
    -
    + Share Together + 경험을 나누다, 함께 성장하다. + + 누구나 O2 Speaker가 될 수 있어요. +
    + O2 People 앞에서 당신의 이야기를 나눠주세요. +
    - - Share Together 인기글 - - 내가 힘들 때 버틸 수 있었던
    - 3가지 -
    - - 창업을 하다보면 정말 생각하지 못했던 어려운 일들이
    - 많이 일어나는건 누구나 알고계실거라 생각합니다.
    - 중간에 포기하고 싶어지는 순간에 앵엘님의 -
    - [내가 힘들 때 버틸 수 있었던 3가지] 강연으로 나만의
    - 버팀목도 한번 만들어보세요. -
    -
    + Share Together 인기글 + + 내가 힘들 때 버틸 수 있었던
    + 3가지 +
    + + 창업을 하다보면 정말 생각하지 못했던 어려운 일들이
    + 많이 일어나는건 누구나 알고계실거라 생각합니다.
    + 중간에 포기하고 싶어지는 순간에 앵엘님의 +
    + [내가 힘들 때 버틸 수 있었던 3가지] 강연으로 나만의
    + 버팀목도 한번 만들어보세요. +
    - - Share Together 인기글 - - CEO라는 꿈.
    - 정말 나를 위한 유일한 길일까? -
    - - 여러분은 자신의 꿈에 얼마나 큰 확신을 가지고있나요?
    - 아마 꿈을 향해 나아가면서도 끊임없이 ‘내가 잘 하고 있는 것인가?‘,
    - ‘이게 정말 나를 위한 길인가?’ 이런 생각이 드실거라 생각합니다.
    - 깡토님의 [CEO라는 꿈. 정말 나를 위한 유일한 길일까?] 강연에서는 불안 -
    - 하기만 CEO라는 꿈을 어떻게 이룰 수 있었는지,
    - 깡토님의 실제 스토리를 여러분들께 들려드립니다. -
    -
    + Share Together 인기글 + + CEO라는 꿈.
    + 정말 나를 위한 유일한 길일까? +
    + + 여러분은 자신의 꿈에 얼마나 큰 확신을 가지고있나요?
    + 아마 꿈을 향해 나아가면서도 끊임없이 ‘내가 잘 하고 있는 것인가?‘,
    + ‘이게 정말 나를 위한 길인가?’ 이런 생각이 드실거라 생각합니다.
    + 깡토님의 [CEO라는 꿈. 정말 나를 위한 유일한 길일까?] 강연에서는 불안 +
    + 하기만 CEO라는 꿈을 어떻게 이룰 수 있었는지,
    + 깡토님의 실제 스토리를 여러분들께 들려드립니다. +
    - - To Be an O2 Speaker - 뱃지를 모아 O2 Speaker가 되어보세요! - + To Be an O2 Speaker + 뱃지를 모아 O2 Speaker가 되어보세요! {/* */} @@ -184,10 +170,8 @@ function Home(): React.ReactElement { {/* */} - - O2 Badge - 열심히 활동하면 멋진 오투의 뱃지들을 받을 수 있어요. - + O2 Badge + 열심히 활동하면 멋진 오투의 뱃지들을 받을 수 있어요. {/* */} - - More - + More @@ -297,11 +279,9 @@ function Home(): React.ReactElement {
    챌린지를 시작해 보세요 - - - More - - + + More +
    Share Together @@ -310,11 +290,9 @@ function Home(): React.ReactElement {
    들어보세요! - - - More - - + + More +