Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

회고 생성 플로우 (API 연동 제외) #56

Merged
merged 60 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
7aaf2a0
feat: #35 회고 생성 틀 작성
leeminhee119 Jul 18, 2024
a7688d1
feat: #35 회고명, 한줄설명 입력 페이지
leeminhee119 Jul 18, 2024
e2dde15
feat: #35 뒤로 가기 버튼 이벤트핸들러 등록
leeminhee119 Jul 18, 2024
0663bca
fix: #35 DefaultLayout을 단계별 컴포넌트 내부로 이동
leeminhee119 Jul 18, 2024
42ca08b
refactor: #35 DefaultLayout, ProgressBar 밖으로 이동
leeminhee119 Jul 18, 2024
b8a922e
feat: #35 defaultlayout에 단계별 theme 정의
leeminhee119 Jul 18, 2024
2dd5de3
feat: #11 카드 컴포넌트 작성
leeminhee119 Jul 18, 2024
92a6539
feat: #35 팁 추가
leeminhee119 Jul 18, 2024
75650c8
feat: #35 #11 템플릿 카드
leeminhee119 Jul 18, 2024
1228cb5
fix: #11 카드 height 제거
leeminhee119 Jul 18, 2024
3379cf8
feat: #35 질문 리스트
leeminhee119 Jul 18, 2024
9943b4e
style: #35 프로그레스바, 헤더 사이 간격 추가
leeminhee119 Jul 18, 2024
1d47269
feat: #35 질문 리스트 페이지 생성
leeminhee119 Jul 19, 2024
828fe44
refactor: #35 orderlabel, typography를 questionListItem으로 이동
leeminhee119 Jul 19, 2024
9b95e04
refactor: #1 디자인토큰 타입 readonly
leeminhee119 Jul 19, 2024
9921261
feat: #35 추가버튼 추가, ic_plus svg 색상 넣을 수 있게 변경
leeminhee119 Jul 19, 2024
42398f4
feat: #35 추가 질문 삭제 기능
leeminhee119 Jul 19, 2024
ae1efd9
fix: #35 full modal 작성
leeminhee119 Jul 19, 2024
13d2a02
fix: #11 바텀시트 z-index, 훅 ref 옵셔널 체이닝
leeminhee119 Jul 19, 2024
51860f6
feat: #35 탭 추가
leeminhee119 Jul 19, 2024
d1573fd
feat: #35 추천 질문
leeminhee119 Jul 19, 2024
26d691b
feat: #35 추천질문 추가
leeminhee119 Jul 19, 2024
da2b1b1
fix: #11 ref 누락 수정
leeminhee119 Jul 22, 2024
c6bbf24
feat: #35 회고명, 한줄소개 상태 저장
leeminhee119 Jul 22, 2024
04a3615
chore: #35 변수명 변경, 스타일 조정
leeminhee119 Jul 22, 2024
afba4e7
refactor: #35 수정 컨텍스트 삭제, 스타일 수정
leeminhee119 Jul 22, 2024
2cb859e
fix: #35 직접작성, 추천 질문 추가하기 로직 분리
leeminhee119 Jul 22, 2024
261313d
chore: #35 file, folder 이름 변경, 위치 이동
leeminhee119 Jul 22, 2024
05141e0
fix: #35 바텀시트 직접 작성한 질문 상태 반영
leeminhee119 Jul 23, 2024
8015058
fix: #35 추천 질문 데이터 작성, 체크박스 변경
leeminhee119 Jul 23, 2024
16a6ccf
fix: #35 추가하기 누르면 체크 상태 초기화
leeminhee119 Jul 23, 2024
bd4e7f6
chore: #35 필수 질문 상수로 분리
leeminhee119 Jul 23, 2024
7d7be07
refactor: #35 질문 수정 플로우 각 단계를 동일 계층으로
leeminhee119 Jul 23, 2024
d298f93
feat: #35 템플릿 수정 확인, 제목 수정, 툴팁
leeminhee119 Jul 23, 2024
12a0fc7
feat: #35 날짜 선택
leeminhee119 Jul 24, 2024
8d7b736
feat: #35 달력 커스텀 스타일
leeminhee119 Jul 24, 2024
7dada7b
feat: #35 시간 선택 오전/오후 탭 작성
leeminhee119 Jul 25, 2024
06919ad
feat: #35 회고 마감 날짜, 시간 입력
leeminhee119 Jul 25, 2024
c612998
feat: #35 날짜 input style
leeminhee119 Jul 25, 2024
c31248d
fix: #35 회고 마감 단계 프로그레스바 조건문 추가
leeminhee119 Jul 25, 2024
fb4d442
fix: #35 goNext 콜백 제거
leeminhee119 Jul 25, 2024
c45cfc0
feat: #35 회고 생성 완료 페이지
leeminhee119 Jul 25, 2024
719300c
feat: #35 드래그앤드롭으로 질문 순서 변경
leeminhee119 Jul 26, 2024
cc0beb6
style: #35 isDragging props 전달해 조건부 그림자 스타일 추가
leeminhee119 Jul 26, 2024
1ab450e
style: #35 기타 스타일링
leeminhee119 Jul 26, 2024
bbeeef9
refactor: #35 QuestionListItem 타이포그래피 내부에 적용
leeminhee119 Jul 26, 2024
a0e187f
fix: #35 바텀시트 종료 아이콘 헤더 수정
leeminhee119 Jul 26, 2024
e8d3a61
style: #35 캘린더 간격 조정
leeminhee119 Jul 26, 2024
733bab9
chore: #35 DeleteItemButton 컴포넌트 삭제, 내부에 바로 작성
leeminhee119 Jul 26, 2024
8f2316f
chore: #35 불필요한 파일 제거, 폴더 구조 정리
leeminhee119 Jul 26, 2024
7f41808
fix: #35 아이콘 부모 높이 제거
leeminhee119 Jul 26, 2024
b577c90
style: #35 툴팁 bounce animation
leeminhee119 Jul 26, 2024
6f94489
chore: #35 바운스 애니메이션 크게
leeminhee119 Jul 26, 2024
c4be456
fix: #35 프로그레스바 조건 추가
leeminhee119 Jul 26, 2024
dc5cfab
fix: #35 수정 완료 후 뒤로가기 시 수정 페이지로 리턴하기 (수정 여부 상태 관리)
leeminhee119 Jul 29, 2024
c526743
chore: #35 불필요한 import 제거
leeminhee119 Jul 29, 2024
2c6c360
fix: #35 바텀시트 overflow 처리
leeminhee119 Jul 31, 2024
25bb543
chore: #35 barrel file 추가, import 경로 수정, 안쓰는 파일 제거
leeminhee119 Jul 31, 2024
01c2668
chore: #35 bounce 이름 수정
leeminhee119 Jul 31, 2024
02312bf
chore: #35 캘린더 중복 css 제거, px -> em
leeminhee119 Jul 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
"@emotion/styled": "^11.11.5",
"@tanstack/react-query": "^5.49.2",
"@tanstack/react-query-devtools": "^5.49.2",
"@types/react-beautiful-dnd": "^13.1.8",
"axios": "^1.7.2",
"framer-motion": "^11.2.13",
"jotai": "^2.8.4",
"jotai-devtools": "^0.10.0",
"js-cookie": "^3.0.5",
"prettier": "^3.2.5",
"react": "^18.2.0",
"react-beautiful-dnd": "^13.1.1",
"react-calendar": "^5.0.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.24.0"
},
Expand Down
3,363 changes: 1,777 additions & 1,586 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions src/app/retrospectCreate/RetrospectCreate.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import { css } from "@emotion/react";
import { useAtom } from "jotai";
import { createContext } from "react";
import { useNavigate } from "react-router-dom";

import { Icon } from "@/component/common/Icon";
import { ProgressBar } from "@/component/common/ProgressBar";
import { Spacing } from "@/component/common/Spacing";
import { DueDate, MainInfo, CustomTemplate, Start } from "@/component/retrospectCreate";
import { PATHS } from "@/config/paths";
import { useMultiStepForm } from "@/hooks/useMultiStepForm";
import { DefaultLayout } from "@/layout/DefaultLayout";
import { dueDateAtom } from "@/store/retrospect/retrospectCreate";
import { DESIGN_SYSTEM_COLOR } from "@/style/variable";

type RetrospectCreateContextState = {
totalStepsCnt: number;
goNext: ReturnType<typeof useMultiStepForm>["goNext"];
};

export const RetrospectCreateContext = createContext<RetrospectCreateContextState>({ totalStepsCnt: 0, goNext: () => {} });

export function RetrospectCreate() {
const navigate = useNavigate();
const steps = ["start", "mainInfo", "customTemplate", "dueDate"] as const;
const themeMap = {
start: {
background: "dark",
iconColor: DESIGN_SYSTEM_COLOR.white,
},
mainInfo: {
background: "default",
iconColor: DESIGN_SYSTEM_COLOR.black,
},
customTemplate: {
background: "gray",
iconColor: DESIGN_SYSTEM_COLOR.black,
},
dueDate: {
background: "default",
iconColor: DESIGN_SYSTEM_COLOR.black,
},
} as const;

// const [mainInfo] = useAtom(mainInfoAtom);
// const [questions] = useAtom(questionsAtom);
const [date] = useAtom(dueDateAtom);

const { currentStep, goNext, goPrev, totalStepsCnt, currentStepIndex } = useMultiStepForm({
steps,
redirectPath: PATHS.completeRetrospectCreate(),
});

const conditionalIncrementPage = () => {
if (currentStep === "dueDate") {
if (!date.date || !date.time) {
return currentStepIndex - 1;
}
}
return currentStepIndex;
};

const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
/*TODO - API 연동*/
};

return (
<DefaultLayout
LeftComp={
<Icon icon={"ic_arrow_back"} onClick={() => (currentStepIndex === 0 ? navigate(-1) : goPrev())} color={themeMap[currentStep]["iconColor"]} />
}
theme={themeMap[currentStep]["background"]}
>
<div
css={css`
visibility: ${currentStep === "start" ? "hidden" : "visible"};
`}
>
<ProgressBar curPage={conditionalIncrementPage()} lastPage={totalStepsCnt - 1} />
</div>
<Spacing size={2.9} />
<form
onSubmit={handleSubmit}
css={css`
flex: 1 1 0;
`}
>
<RetrospectCreateContext.Provider value={{ totalStepsCnt, goNext }}>
{currentStep === "start" && <Start />}
{currentStep === "mainInfo" && <MainInfo />}
{currentStep === "customTemplate" && <CustomTemplate />}
{currentStep === "dueDate" && <DueDate />}
</RetrospectCreateContext.Provider>
</form>
</DefaultLayout>
);
}
26 changes: 26 additions & 0 deletions src/app/retrospectCreate/RetrospectCreateComplete.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { useNavigate } from "react-router-dom";

import { ButtonProvider } from "@/component/common/button";
import { Header } from "@/component/common/header";
import { Spacing } from "@/component/common/Spacing";
import { DefaultLayout } from "@/layout/DefaultLayout";

export function RetrospectCreateComplete() {
const navigate = useNavigate();
return (
<DefaultLayout>
<Spacing size={2.9} />
<Header title={"회고가 완성되었어요!\n바로 회고를 작성해볼까요?"} contents="다음 회고에서도 해당 템플릿으로 제공해드릴게요!" />
<ButtonProvider sort="horizontal">
<ButtonProvider.Gray onClick={() => navigate(-1)}>끝내기</ButtonProvider.Gray>
<ButtonProvider.Primary
onClick={() => {
/**TODO - 해당 템플릿을 가지고 회고 작성 페이지로 이동 */
}}
>
작성하기
</ButtonProvider.Primary>
</ButtonProvider>
</DefaultLayout>
);
}
16 changes: 8 additions & 8 deletions src/assets/svgs/bottom-sheet/ic_quit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/svgs/calendar/ic_next_chevron.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/svgs/calendar/ic_prev_chevron.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/assets/svgs/calendar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as ic_next_chevron } from "./ic_next_chevron.svg?react";
export { default as ic_prev_chevron } from "./ic_prev_chevron.svg?react";
3 changes: 3 additions & 0 deletions src/assets/svgs/common/ic_arrow_back.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/svgs/common/ic_chevron_down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/svgs/common/ic_delete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions src/assets/svgs/common/ic_handle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/svgs/common/ic_pencil.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/svgs/common/ic_plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/assets/svgs/common/ic_plus_thin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/svgs/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ export { default as ic_chart } from "./ic_chart.svg?react";
export { default as ic_arrow_left } from "./ic_arrow_left.svg?react";

export { default as basicProfile } from "./basicProfile.svg?react";
export { default as ic_arrow_back } from "./ic_arrow_back.svg?react";
export { default as ic_delete } from "./ic_delete.svg?react";
export { default as ic_handle } from "./ic_handle.svg?react";
export { default as ic_pencil } from "./ic_pencil.svg?react";
export { default as ic_chevron_down } from "./ic_chevron_down.svg?react";
export { default as ic_plus_thin } from "./ic_plus_thin.svg?react";
1 change: 1 addition & 0 deletions src/assets/svgs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from "./common";
export * from "./toast";
export * from "./bottom-sheet";
export * from "./space";
export * from "./calendar";
10 changes: 6 additions & 4 deletions src/component/BottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import { useBottomSheet, useSetBottomSheet } from "@/hooks/useBottomSheet.ts";
export type BottomSheetType = {
title?: string;
contents: ReactElement;
handler: boolean;
handler?: boolean;
quitButton?: boolean;
sheetHeight?: number;
};

export function BottomSheet({ title, contents, handler = false, sheetHeight = 349 }: BottomSheetType) {
export function BottomSheet({ title, contents, handler = false, quitButton = true, sheetHeight = 349 }: BottomSheetType) {
const { sheet, content } = useSetBottomSheet({ handler, sheetHeight });
const { bottomSheetState } = useBottomSheet();
const [height, _] = useState(sheetHeight);
Expand All @@ -34,6 +35,7 @@ export function BottomSheet({ title, contents, handler = false, sheetHeight = 34
transform: translate3d(-50%, -50%, 0);
background-color: ${bottomSheetState ? `rgba(24, 24, 24, 60%)` : `transparent`};
transition: 0.4s all;
z-index: 10001;

${!bottomSheetState &&
css`
Expand All @@ -58,14 +60,14 @@ export function BottomSheet({ title, contents, handler = false, sheetHeight = 34
box-shadow: 0 4rem 4rem rgba(0, 0, 0, 0.25);
transition: transform 200ms ease-out;
z-index: 10001;
padding: 3rem 3rem 3.3rem 3rem;
padding: 2rem;
box-sizing: border-box;
background-color: #fff;
height: ${height}px;
transform: translate3d(-50%, ${bottomSheetState ? `-${height}px` : `0%`}, 0);
`}
>
<BottomSheetHeader title={title} handler={handler} />
<BottomSheetHeader title={title} handler={handler} quitButton={quitButton} />
<BottomSheetContent ref={content}>{contents}</BottomSheetContent>
</div>
</Portal>
Expand Down
22 changes: 16 additions & 6 deletions src/component/BottomSheet/component/BottomSheetHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ import { css } from "@emotion/react";
import { BottomSheetType } from "@/component/BottomSheet/BottomSheet.tsx";
import { Icon } from "@/component/common/Icon";
import { useBottomSheet } from "@/hooks/useBottomSheet.ts";
import { DESIGN_SYSTEM_COLOR } from "@/style/variable";

export function BottomSheetHeader({ title, handler }: Pick<BottomSheetType, "title" | "handler">) {
export function BottomSheetHeader({ title, handler, quitButton }: Pick<BottomSheetType, "title" | "handler" | "quitButton">) {
const { closeBottomSheet } = useBottomSheet();

if (!title && !handler) return;
if (!title && !handler && !quitButton) return;
return (
<div
css={css`
position: relative;
display: flex;
${title &&
css`
border-top-left-radius: 1.2rem;
border-bottom-right-radius: 1.2rem;
padding-top: 1.2rem;
padding-bottom: 1.4rem;
`}
`}
>
Expand All @@ -33,6 +33,8 @@ export function BottomSheetHeader({ title, handler }: Pick<BottomSheetType, "tit
border-radius: 5rem;
background-color: rgba(60, 60, 67, 0.3);
margin: auto;
margin-top: 1.2rem;
margin-bottom: 1.4rem;
cursor: ns-resize;
`}
/>
Expand All @@ -56,10 +58,18 @@ export function BottomSheetHeader({ title, handler }: Pick<BottomSheetType, "tit
>
{title}
</span>
{/* FIXME: 아이콘 영역 */}
<Icon icon={"ic_quit"} size={2.4} onClick={closeBottomSheet} />
</div>
)}
{quitButton && (
<button
onClick={closeBottomSheet}
css={css`
margin-left: auto;
`}
>
<Icon icon={"ic_quit"} size={2.4} color={DESIGN_SYSTEM_COLOR.dark} />
</button>
)}
</div>
);
}
34 changes: 34 additions & 0 deletions src/component/common/Card/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { css, Interpolation, Theme } from "@emotion/react";

type CardProps = {
width?: string;
rounded?: keyof typeof BORDER_RADIUS;
shadow?: boolean;
padding?: string;
children: React.ReactNode;
styles?: Interpolation<Theme>;
} & React.HTMLAttributes<HTMLDivElement>;

const BORDER_RADIUS = {
sm: ".8rem",
md: "1.2rem",
} as const;

export function Card({ width = "100%", rounded = "sm", shadow = true, padding = "2rem", styles, children }: CardProps) {
return (
<div
css={[
css`
width: ${width};
border-radius: ${BORDER_RADIUS[rounded]};
background-color: #fff; // FIXME - design token
box-shadow: ${shadow ? "0 .4rem 1.2rem rgba(0 0 0 / 4%)" : "none"};
padding: ${padding};
`,
styles,
]}
>
{children}
</div>
);
}
1 change: 1 addition & 0 deletions src/component/common/Card/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Card } from "./Card";
2 changes: 1 addition & 1 deletion src/component/common/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const Icon = memo(function Icon({ icon, color = DEFAULT_ICON_COLOR, size
onClick={onClick}
css={css`
color: ${color};
cursor: ${onClick ? "pointer" : "default"};
cursor: ${onClick ? "pointer" : "inherit"};
width: ${widthRem};
height: auto;
`}
Expand Down
Loading
Loading