-
Notifications
You must be signed in to change notification settings - Fork 2
[Feat/#78] 수정하기 버튼 #80
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
Changes from 12 commits
7be1a5a
2b995e8
58031fb
5c13c0e
c078967
54f5310
a9d98ad
bd0e781
7bf4b9a
55a5a44
b8298cf
444538b
c5cc365
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import type { SVGProps } from 'react'; | ||
| const SvgIcPencil = (props: SVGProps<SVGSVGElement>) => ( | ||
| <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 40 40" {...props}> | ||
| <path | ||
| stroke="#E3E4E5" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| strokeWidth={2} | ||
| 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" | ||
| /> | ||
| </svg> | ||
| ); | ||
| export default SvgIcPencil; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| const Edit = () => { | ||
| return <div>수정하기 뷰</div>; | ||
| }; | ||
|
|
||
| export default Edit; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import { style } from '@vanilla-extract/css'; | ||
|
|
||
| import { colors } from '@/style/token'; | ||
| import { fonts } from '@/style/token/typography.css'; | ||
|
|
||
| export const editBtnWrapper = style({ | ||
| position: 'relative', | ||
| display: 'flex', | ||
| width: '17.5rem', | ||
| height: '6.4rem', | ||
| padding: '0', | ||
| justifyContent: 'flex-end', | ||
| alignItems: 'center', | ||
| gap: '1rem', | ||
| flexShrink: 0, | ||
| borderRadius: '50px', | ||
| backgroundColor: colors.grey3, | ||
| cursor: 'pointer', | ||
| clipPath: 'circle(3.2rem at 14.3rem 3.2rem)', | ||
| transition: 'clip-path 0.3s ease', | ||
| ':hover': { | ||
| backgroundImage: colors.gradient05, | ||
| clipPath: 'circle(100% at center)', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. p5) 신기하당 |
||
| }, | ||
| }); | ||
|
|
||
| export const iconSvg = style({ | ||
| width: '4rem', | ||
| height: '4rem', | ||
| }); | ||
|
|
||
| export const editIcon = style({ | ||
| position: 'absolute', | ||
| right: 0, | ||
| display: 'flex', | ||
| justifyContent: 'center', | ||
| alignItems: 'center', | ||
| width: '6.4rem', | ||
| height: '6.4rem', | ||
| borderRadius: '50%', | ||
| backgroundColor: colors.grey3, | ||
| color: colors.white01, | ||
| zIndex: 1, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. p2)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 부분을 고민해봤는데… 새봄님이 작성해주신 zIndex 토큰화는 주로 헤더, 모달, 툴팁 등 전역적으로 우선순위가 중요한 컴포넌트에 사용되는 패턴이라, 지금처럼 저만 사용하는 (...?) 수정하기 버튼의 다른 분들의 의견은 어떠신지 궁금해욥 |
||
| }); | ||
|
|
||
| export const editText = style([ | ||
| fonts.subtitle05, | ||
| { | ||
| position: 'absolute', | ||
| left: '2.4rem', | ||
| visibility: 'hidden', | ||
| color: colors.white01, | ||
| whiteSpace: 'nowrap', | ||
| selectors: { | ||
| [`${editBtnWrapper}:hover &`]: { | ||
| visibility: 'visible', | ||
| }, | ||
| }, | ||
| }, | ||
| ]); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import { BrowserRouter } from 'react-router-dom'; | ||
| import type { Meta, StoryObj } from '@storybook/react-vite'; | ||
|
|
||
| import EditBtn from './EditBtn'; | ||
|
|
||
| const meta = { | ||
| title: 'Mandal/EditBtn', | ||
| component: EditBtn, | ||
| parameters: { | ||
| layout: 'centered', | ||
| backgrounds: { | ||
| default: 'dark', | ||
| }, | ||
| }, | ||
| decorators: [ | ||
| (Story) => ( | ||
| <BrowserRouter> | ||
| <Story /> | ||
| </BrowserRouter> | ||
| ), | ||
| ], | ||
| tags: ['autodocs'], | ||
| argTypes: { | ||
| onClick: { action: 'clicked' }, | ||
| }, | ||
| } satisfies Meta<typeof EditBtn>; | ||
|
|
||
| export default meta; | ||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| export const Default: Story = { | ||
| name: '기본', | ||
| }; | ||
|
|
||
| export const Hover: Story = { | ||
| name: '호버 시', | ||
| parameters: { | ||
| pseudo: { hover: true }, | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { useNavigate } from 'react-router-dom'; | ||
|
|
||
| import * as styles from './EditBtn.css'; | ||
|
|
||
| import { IcPencil } from '@/assets/svg'; | ||
| import { PATH } from '@/route/path'; | ||
|
|
||
| interface EditBtnProps { | ||
| onClick?: () => void; | ||
| } | ||
|
|
||
| const EditBtn = ({ onClick }: EditBtnProps) => { | ||
| const navigate = useNavigate(); | ||
|
|
||
| const handleClick = () => { | ||
| onClick?.(); | ||
| navigate(PATH.EDIT); | ||
| }; | ||
|
|
||
| return ( | ||
| <button type="button" className={styles.editBtnWrapper} onClick={handleClick}> | ||
| <span className={styles.editText}>수정하기</span> | ||
| <div className={styles.editIcon}> | ||
| <IcPencil className={styles.iconSvg} /> | ||
| </div> | ||
| </button> | ||
| ); | ||
|
Comment on lines
+20
to
+27
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. p4) 접근성을 위해 aria-label이나 title 속성을 추가하는 건 어떤가요 ?? |
||
| }; | ||
|
|
||
| export default EditBtn; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p4) gap 속성 실제로는 justifyContent: 'flex-end'로 인해 사용되지 않는 거 아닌가요 ? 아닐 수도 있는데 그냥 궁금해서 물어봅니다 💭