Skip to content

Commit a0b850a

Browse files
authored
Merge pull request #80 from SOPT-36-NINEDOT/feat/#78/editBtn
[Feat/#78] 수정하기 버튼
2 parents 9625292 + c5cc365 commit a0b850a

File tree

9 files changed

+160
-3
lines changed

9 files changed

+160
-3
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: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ export { default as IcCheckboxDefault } from './IcCheckboxDefault';
44
export { default as IcDropdown } from './IcDropdown';
55
export { default as IcLock } from './IcLock';
66
export { default as IcModalDelete } from './IcModalDelete';
7-
export { default as IcSmallTextdelete } from './IcSmallTextdelete';
8-
export { default as IcTextdelete } from './IcTextdelete';
7+
export { default as IcPencil } from './IcPencil';
98
export { default as IcRadioChecked } from './IcRadioChecked';
109
export { default as IcRadioDefault } from './IcRadioDefault';
10+
export { default as IcSmallTextdelete } from './IcSmallTextdelete';
11+
export { default as IcTextdelete } from './IcTextdelete';
1112
export { default as IcTooltipDelete } from './IcTooltipDelete';
1213
export { default as IcTriangle } from './IcTriangle';
1314
export { default as Vite } from './Vite';

src/page/edit/Edit.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const Edit = () => {
2+
return <div>수정하기 뷰</div>;
3+
};
4+
5+
export default Edit;

src/page/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export { default as Home } from './home/Home';
22
export { default as Todo } from './todo/entireTodo/Todo';
33
export { default as Mandal } from './mandal/Mandal';
44
export { default as History } from './history/History';
5+
export { default as Edit } from './edit/Edit';
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { style } from '@vanilla-extract/css';
2+
3+
import { colors } from '@/style/token';
4+
import { fonts } from '@/style/token/typography.css';
5+
6+
export const editBtnWrapper = style({
7+
position: 'relative',
8+
display: 'flex',
9+
width: '17.5rem',
10+
height: '6.4rem',
11+
padding: '0',
12+
justifyContent: 'flex-end',
13+
alignItems: 'center',
14+
gap: '1rem',
15+
flexShrink: 0,
16+
borderRadius: '50px',
17+
backgroundColor: colors.grey3,
18+
cursor: 'pointer',
19+
clipPath: 'circle(3.2rem at 14.3rem 3.2rem)',
20+
transition: 'clip-path 0.3s ease',
21+
':hover': {
22+
backgroundImage: colors.gradient05,
23+
clipPath: 'circle(100% at center)',
24+
},
25+
});
26+
27+
export const iconSvg = style({
28+
width: '4rem',
29+
height: '4rem',
30+
});
31+
32+
export const editIcon = style({
33+
position: 'absolute',
34+
right: 0,
35+
display: 'flex',
36+
justifyContent: 'center',
37+
alignItems: 'center',
38+
width: '6.4rem',
39+
height: '6.4rem',
40+
borderRadius: '50%',
41+
backgroundColor: colors.grey3,
42+
color: colors.white01,
43+
zIndex: 1,
44+
});
45+
46+
export const editText = style([
47+
fonts.subtitle05,
48+
{
49+
position: 'absolute',
50+
left: '2.4rem',
51+
visibility: 'hidden',
52+
color: colors.white01,
53+
whiteSpace: 'nowrap',
54+
selectors: {
55+
[`${editBtnWrapper}:hover &`]: {
56+
visibility: 'visible',
57+
},
58+
},
59+
},
60+
]);
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { BrowserRouter } from 'react-router-dom';
2+
import type { Meta, StoryObj } from '@storybook/react-vite';
3+
4+
import EditBtn from './EditBtn';
5+
6+
const meta = {
7+
title: 'Mandal/EditBtn',
8+
component: EditBtn,
9+
parameters: {
10+
layout: 'centered',
11+
backgrounds: {
12+
default: 'dark',
13+
},
14+
},
15+
decorators: [
16+
(Story) => (
17+
<BrowserRouter>
18+
<Story />
19+
</BrowserRouter>
20+
),
21+
],
22+
tags: ['autodocs'],
23+
argTypes: {
24+
onClick: { action: 'clicked' },
25+
},
26+
} satisfies Meta<typeof EditBtn>;
27+
28+
export default meta;
29+
type Story = StoryObj<typeof meta>;
30+
31+
export const Default: Story = {
32+
name: '기본',
33+
};
34+
35+
export const Hover: Story = {
36+
name: '호버 시',
37+
parameters: {
38+
pseudo: { hover: true },
39+
},
40+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { useNavigate } from 'react-router-dom';
2+
3+
import * as styles from './EditBtn.css';
4+
5+
import { IcPencil } from '@/assets/svg';
6+
import { PATH } from '@/route/path';
7+
8+
interface EditBtnProps {
9+
onClick?: () => void;
10+
}
11+
12+
const EditBtn = ({ onClick }: EditBtnProps) => {
13+
const navigate = useNavigate();
14+
15+
const handleClick = () => {
16+
onClick?.();
17+
navigate(PATH.EDIT);
18+
};
19+
20+
return (
21+
<button type="button" className={styles.editBtnWrapper} onClick={handleClick}>
22+
<span className={styles.editText}>수정하기</span>
23+
<div className={styles.editIcon}>
24+
<IcPencil className={styles.iconSvg} />
25+
</div>
26+
</button>
27+
);
28+
};
29+
30+
export default EditBtn;

src/route/MainRoutes.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { RouteObject } from 'react-router-dom';
22

33
import { PATH } from './path';
44

5-
import { Home, Todo, Mandal, History } from '@/page';
5+
import { Home, Todo, Mandal, History, Edit } from '@/page';
66
import { UpperGoal, LowerGoal } from '@/page/todo';
77
import { Layout } from '@/shared/component/Layout';
88

@@ -34,6 +34,10 @@ export const mainRoutes: RouteObject[] = [
3434
path: PATH.HISTORY,
3535
element: <History />,
3636
},
37+
{
38+
path: PATH.EDIT,
39+
element: <Edit />,
40+
},
3741
],
3842
},
3943
];

0 commit comments

Comments
 (0)