Skip to content

Commit 5e9d1b7

Browse files
authored
Merge branch 'develop' into feat/#64/editTextField
2 parents bfda06d + fa7af09 commit 5e9d1b7

File tree

32 files changed

+761
-358
lines changed

32 files changed

+761
-358
lines changed

public/svg/ic_pencil.svg

Lines changed: 3 additions & 0 deletions
Loading

src/assets/svg/IcPencil.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { SVGProps } from 'react';
2+
const SvgIcPencil = (props: SVGProps<SVGSVGElement>) => (
3+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 40 40" {...props}>
4+
<path
5+
stroke="#E3E4E5"
6+
strokeLinecap="round"
7+
strokeLinejoin="round"
8+
strokeWidth={2}
9+
d="m25.387 8.72 5.892 5.893M27.888 6.22a4.167 4.167 0 1 1 5.892 5.893L10.833 35.059H5v-5.952z"
10+
/>
11+
</svg>
12+
);
13+
export default SvgIcPencil;

src/assets/svg/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export { default as IcDropdown } from './IcDropdown';
55
export { default as IcLock } from './IcLock';
66
export { default as IcMediumTextdelete } from './IcMediumTextdelete';
77
export { default as IcModalDelete } from './IcModalDelete';
8+
export { default as IcPencil } from './IcPencil';
89
export { default as IcRadioChecked } from './IcRadioChecked';
910
export { default as IcRadioDefault } from './IcRadioDefault';
1011
export { default as IcSmallTextdelete } from './IcSmallTextdelete';
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { GradientCircle } from '@/common/component/GradientCircle/GradientCircle';
2+
3+
const GradientBackground = () => {
4+
return (
5+
<>
6+
<GradientCircle variant="topRight" />
7+
<GradientCircle variant="bottomLeft1" />
8+
<GradientCircle variant="bottomLeft2" />
9+
</>
10+
);
11+
};
12+
13+
export default GradientBackground;

src/common/component/GoButton/GoButton.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import { goButtonContainer, goIcon } from '@/common/component/GoButton/GoButton.
33

44
type GoButtonProps = {
55
isActive: boolean;
6+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
67
};
78

8-
const GoButton = ({ isActive = true }: GoButtonProps) => {
9+
const GoButton = ({ isActive = true, onClick }: GoButtonProps) => {
910
const state = isActive ? 'active' : 'disabled';
1011

1112
return (
12-
<button className={goButtonContainer({ state })}>
13+
<button className={goButtonContainer({ state })} onClick={onClick}>
1314
<IcBigNext className={goIcon({ state })} />
1415
</button>
1516
);
Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
import { style } from '@vanilla-extract/css';
22

3-
export const gridDefault = style({
3+
const baseGrid = {
44
display: 'grid',
55
gridTemplateColumns: 'repeat(3, 1fr)',
6-
gap: '1.6rem',
7-
width: 'fit-content',
6+
gap: '1.2rem',
87
margin: '0 auto',
9-
});
10-
11-
export const gridSmall = style({
12-
display: 'grid',
13-
gridTemplateColumns: 'repeat(3, 1fr)',
14-
gap: '2rem',
158
width: 'fit-content',
16-
margin: '0 auto',
17-
});
9+
};
10+
11+
export const grid = {
12+
TODO_SUB: style({
13+
...baseGrid,
14+
gap: '1rem',
15+
}),
16+
TODO_MAIN: style({
17+
...baseGrid,
18+
gap: '1.6rem',
19+
}),
20+
TODO_EDIT: style({
21+
...baseGrid,
22+
gap: '2rem',
23+
}),
24+
MY_MANDAL: style({
25+
...baseGrid,
26+
gap: '3rem',
27+
}),
28+
};
Lines changed: 46 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Meta, StoryObj } from '@storybook/react-vite';
22

3-
import Mandalart, { type Cycle } from './Mandalart';
3+
import Mandalart from './Mandalart';
44
import { MOCK_MANDALART_DATA } from './mock';
55

66
const meta = {
@@ -13,95 +13,65 @@ const meta = {
1313
},
1414
},
1515
tags: ['autodocs'],
16+
argTypes: {
17+
type: {
18+
control: 'select',
19+
options: ['TODO_SUB', 'TODO_MAIN', 'TODO_EDIT', 'MY_MANDAL'],
20+
},
21+
},
1622
} satisfies Meta<typeof Mandalart>;
1723

1824
export default meta;
1925
type Story = StoryObj<typeof meta>;
2026

21-
const CUSTOM_GOALS = {
22-
mainGoal: '나인도트 1등하기',
23-
subGoals: [
24-
{
25-
title: '이현준 갈구기',
26-
position: 0,
27-
cycle: 'DAILY' as Cycle,
28-
},
29-
{
30-
title: '매일 운동하기',
31-
position: 1,
32-
cycle: 'DAILY' as Cycle,
33-
},
34-
{
35-
title: '일찍 일어나기',
36-
position: 2,
37-
cycle: 'DAILY' as Cycle,
38-
},
39-
{
40-
title: '계획 세우기',
41-
position: 3,
42-
cycle: 'WEEKLY' as Cycle,
43-
},
44-
{
45-
title: '시간 관리하기',
46-
position: 4,
47-
cycle: 'WEEKLY' as Cycle,
48-
},
49-
{
50-
title: '건강 관리하기',
51-
position: 5,
52-
cycle: 'DAILY' as Cycle,
53-
},
54-
{
55-
title: '긍정적으로 생각하기',
56-
position: 6,
57-
cycle: 'DAILY' as Cycle,
58-
},
59-
{
60-
title: '꾸준히 노력하기',
61-
position: 7,
62-
cycle: 'DAILY' as Cycle,
63-
},
64-
],
65-
completedGoals: [1, 3, 5],
27+
export const Default: Story = {
28+
args: {
29+
mainGoal: MOCK_MANDALART_DATA.mainGoal,
30+
subGoals: MOCK_MANDALART_DATA.subGoals,
31+
type: 'TODO_MAIN',
32+
},
6633
};
6734

68-
export const Default: Story = {
35+
export const AllTypes: Story = {
6936
args: {
70-
mainGoal: '메인 목표를 입력하세요',
37+
mainGoal: MOCK_MANDALART_DATA.mainGoal,
7138
subGoals: MOCK_MANDALART_DATA.subGoals,
39+
type: 'TODO_MAIN',
7240
},
73-
render: (args) => (
74-
<div style={{ display: 'flex', gap: '2rem' }}>
41+
render: () => (
42+
<div style={{ display: 'flex', flexDirection: 'column', gap: '4rem' }}>
7543
<div>
76-
<h3 style={{ color: 'white', marginBottom: '1rem' }}>Default 사이즈</h3>
77-
<Mandalart {...args} />
44+
<h3 style={{ marginBottom: '1rem' }}>TODO_SUB (96px)</h3>
45+
<Mandalart
46+
mainGoal={MOCK_MANDALART_DATA.mainGoal}
47+
subGoals={MOCK_MANDALART_DATA.subGoals}
48+
type="TODO_SUB"
49+
/>
7850
</div>
7951
<div>
80-
<h3 style={{ color: 'white', marginBottom: '1rem' }}>Small 사이즈</h3>
81-
<Mandalart {...args} size="small" />
52+
<h3 style={{ marginBottom: '1rem' }}>TODO_MAIN (196px)</h3>
53+
<Mandalart
54+
mainGoal={MOCK_MANDALART_DATA.mainGoal}
55+
subGoals={MOCK_MANDALART_DATA.subGoals}
56+
type="TODO_MAIN"
57+
/>
58+
</div>
59+
<div>
60+
<h3 style={{ marginBottom: '1rem' }}>TODO_EDIT (160px)</h3>
61+
<Mandalart
62+
mainGoal={MOCK_MANDALART_DATA.mainGoal}
63+
subGoals={MOCK_MANDALART_DATA.subGoals}
64+
type="TODO_EDIT"
65+
/>
66+
</div>
67+
<div>
68+
<h3 style={{ marginBottom: '1rem' }}>MY_MANDAL (298px)</h3>
69+
<Mandalart
70+
mainGoal={MOCK_MANDALART_DATA.mainGoal}
71+
subGoals={MOCK_MANDALART_DATA.subGoals}
72+
type="MY_MANDAL"
73+
/>
8274
</div>
8375
</div>
8476
),
8577
};
86-
87-
export const Small: Story = {
88-
args: {
89-
mainGoal: '메인 목표를 입력하세요',
90-
subGoals: CUSTOM_GOALS.subGoals,
91-
size: 'small',
92-
},
93-
render: (args) => <Mandalart {...args} />,
94-
};
95-
96-
export const WithCustomGoals: Story = {
97-
args: CUSTOM_GOALS,
98-
render: (args) => <Mandalart {...args} />,
99-
};
100-
101-
export const WithCustomGoalsSmall: Story = {
102-
args: {
103-
...CUSTOM_GOALS,
104-
size: 'small',
105-
},
106-
render: (args) => <Mandalart {...args} />,
107-
};
Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { useState } from 'react';
22

3-
import { Square } from './Square';
3+
import { Main, Sub } from './Square';
44
import * as styles from './Mandalart.css';
55
import { MOCK_MANDALART_DATA } from './mock';
66

77
export type Cycle = 'DAILY' | 'WEEKLY' | 'ONCE';
8-
export type MandalartSize = 'small' | 'default';
8+
export type MandalartType = 'TODO_SUB' | 'TODO_MAIN' | 'TODO_EDIT' | 'MY_MANDAL';
99

1010
export interface SubGoal {
1111
title: string;
@@ -16,37 +16,40 @@ export interface SubGoal {
1616
interface MandalartProps {
1717
mainGoal?: string;
1818
subGoals?: SubGoal[];
19-
size?: MandalartSize;
19+
type: MandalartType;
20+
onGoalClick?: (position: number) => void;
2021
}
2122

2223
const CENTER_INDEX = 4;
2324

2425
const Mandalart = ({
2526
mainGoal = MOCK_MANDALART_DATA.mainGoal,
2627
subGoals = MOCK_MANDALART_DATA.subGoals,
27-
size = 'default',
28+
type,
29+
onGoalClick,
2830
}: MandalartProps) => {
2931
const [selectedGoal, setSelectedGoal] = useState<number | null>(null);
3032

3133
const handleGoalClick = (position: number) => {
3234
setSelectedGoal(selectedGoal === position ? null : position);
35+
onGoalClick?.(position);
3336
};
3437

3538
const renderSquare = (index: number) => {
3639
if (index === CENTER_INDEX) {
37-
return <Square.Main key={index} content={mainGoal} size={size} />;
40+
return <Main key={index} content={mainGoal} type={type} />;
3841
}
3942

4043
const subGoalIndex = index > CENTER_INDEX ? index - 1 : index;
4144
const subGoal = subGoals[subGoalIndex];
4245

4346
return (
44-
<Square.Sub
47+
<Sub
4548
key={index}
4649
content={subGoal.title}
4750
isCompleted={selectedGoal === subGoalIndex}
4851
onClick={() => handleGoalClick(subGoalIndex)}
49-
size={size}
52+
type={type}
5053
/>
5154
);
5255
};
@@ -55,7 +58,7 @@ const Mandalart = ({
5558
.fill(null)
5659
.map((_, index) => renderSquare(index));
5760

58-
return <div className={size === 'small' ? styles.gridSmall : styles.gridDefault}>{squares}</div>;
61+
return <div className={styles.grid[type]}>{squares}</div>;
5962
};
6063

6164
export default Mandalart;

0 commit comments

Comments
 (0)