Skip to content

Commit f163b25

Browse files
authored
Merge pull request #194 from SOPT-36-NINEDOT/refactor/#193/myHistory
[Refactor] 나의 히스토리 뷰 리팩토링
2 parents d3c2867 + d1a9410 commit f163b25

File tree

7 files changed

+28
-24
lines changed

7 files changed

+28
-24
lines changed

src/page/history/History.css.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export const titleContainer = style({
2424
});
2525

2626
export const descriptionContainer = style({
27-
marginTop: '2rem',
28-
padding: '7.6rem 5rem',
27+
marginTop: '2.3rem',
28+
padding: '6.7rem 8.6rem',
2929
backgroundColor: colors.grey2,
3030
borderRadius: '12px',
3131
color: colors.grey11,
@@ -37,7 +37,7 @@ export const descriptionContainer = style({
3737
});
3838

3939
export const streakTrackerWrapper = style({
40-
paddingTop: '8rem',
40+
paddingTop: '7.7rem',
4141
paddingBottom: '9.8rem',
4242
});
4343

src/page/history/History.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import StreakTracker from '@/page/history/StreakTrackerSection/StreakTrackerSect
55
import { useGetHistory } from '@/api/domain/history/hook/useGetHistory';
66
import { useMandalartId } from '@/common/hook/useMandalartId';
77
import Loading from '@/common/component/Loading/Loading';
8+
import { useAuthStore } from '@/store/useAuthStore';
89

910
const STREAK_BANNER_MESSAGE = '작은 실천을 66일 이어가면 나의 목표에 도달합니다';
1011
const STREAK_DESCRIPTION_MESSAGE = '하루에 하나라도 실천하면 오늘의 점이 찍혀요!';
@@ -14,6 +15,7 @@ const History = () => {
1415
const mandalartId = useMandalartId();
1516

1617
const { data, isLoading } = useGetHistory(mandalartId);
18+
const user = useAuthStore((state) => state.user);
1719

1820
const handleOutsideClick = () => {
1921
setSelectedDay(null);
@@ -28,7 +30,7 @@ const History = () => {
2830
<div className={styles.layoutContainer}>
2931
<h1 className={styles.titleContainer}>{data.title}</h1>
3032
<p className={styles.descriptionContainer}>
31-
김도트님, 목표를 향해 <br />
33+
{user.name}, 목표를 향해 <br />
3234
<strong className={styles.progressText}>{data.progressDays}</strong>일째 달려가고 있어요
3335
</p>
3436
<section className={styles.streakTrackerWrapper}>

src/page/history/StreakTrackerSection/StreakTrackerSection.css.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ export const streakTrackerContainer = style({
44
display: 'flex',
55
gap: '2rem',
66
});
7+
8+
export const streakGridContainer = style({
9+
flexGrow: '1',
10+
});

src/page/history/StreakTrackerSection/StreakTrackerSection.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { useState } from 'react';
22

3-
import StreakDetail from '@/page/history/component/StreakDetail/StreakDetail';
4-
import StreakGrid from '@/page/history/component/StreakGrid/StreakGrid';
3+
import { StreakDetail, StreakGrid } from '@/page/history/component';
54
import * as styles from '@/page/history/StreakTrackerSection/StreakTrackerSection.css';
65
import { useGetStreak } from '@/api/domain/history/hook/useGetStreak';
76
import { useMandalartId } from '@/common/hook/useMandalartId';
@@ -32,7 +31,7 @@ const StreakTracker = ({ selectedDay, setSelectedDay }: StreakTrackerProps) => {
3231

3332
return (
3433
<div className={styles.streakTrackerContainer}>
35-
<div onClick={(e) => e.stopPropagation()}>
34+
<div onClick={(e) => e.stopPropagation()} className={styles.streakGridContainer}>
3635
<StreakGrid streaks={data.streaks} onHover={setHoveredDay} onSelect={setSelectedDay} />
3736
</div>
3837
<StreakDetail detailData={detailData} />

src/page/history/component/StreakDetail/StreakDetail.css.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { recipe } from '@vanilla-extract/recipes';
22
import { style } from '@vanilla-extract/css';
33

4-
import { colors, fonts } from '@/style/token';
4+
import { colors, fonts, layout } from '@/style/token';
55

66
export const detailContainer = recipe({
77
base: {
@@ -11,11 +11,7 @@ export const detailContainer = recipe({
1111
},
1212
variants: {
1313
state: {
14-
empty: {
15-
display: 'flex',
16-
justifyContent: 'center',
17-
alignItems: 'center',
18-
},
14+
empty: layout.flexCenter,
1915
filled: {
2016
padding: '3rem',
2117
},
@@ -43,11 +39,12 @@ export const todoCount = style({
4339
...fonts.subtitle01,
4440
});
4541

46-
export const todoList = style({
47-
display: 'flex',
48-
flexDirection: 'column',
49-
gap: '1.2rem',
50-
marginTop: '2.4rem',
51-
color: colors.grey11,
52-
...fonts.body03,
53-
});
42+
export const todoList = style([
43+
layout.flexColumn,
44+
{
45+
gap: '1.2rem',
46+
marginTop: '2.4rem',
47+
color: colors.grey11,
48+
...fonts.body03,
49+
},
50+
]);

src/page/history/component/StreakDetail/StreakDetail.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import * as styles from '@/page/history/component/StreakDetail/StreakDetail.css';
22
import type { Streak } from '@/page/history/type/StreakDataType';
33

4-
const DEFAULT_MESSAGE = '원하는 날의 점을 클릭하고 <br/> 그날 내가 한 일을 확인해보세요!';
5-
64
type StreakDetailProps = {
75
detailData?: Streak;
86
};
@@ -14,7 +12,9 @@ const StreakDetail = ({ detailData }: StreakDetailProps) => {
1412
if (isEmpty) {
1513
return (
1614
<div className={styles.detailContainer({ state })}>
17-
<p className={styles.defaultText} dangerouslySetInnerHTML={{ __html: DEFAULT_MESSAGE }} />
15+
<p className={styles.defaultText}>
16+
원하는 날의 점을 클릭하고 <br /> 그날 내가 한 일을 확인해보세요!
17+
</p>
1818
</div>
1919
);
2020
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default as StreakDetail } from '@/page/history/component/StreakDetail/StreakDetail';
2+
export { default as StreakGrid } from '@/page/history/component/StreakGrid/StreakGrid';

0 commit comments

Comments
 (0)