-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feat(client): 타임테이블 플로팅 컴포넌트 제작 #90
Merged
+386
−0
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b5186a3
chore: client내 @vanilla-extract/recipes 패키지 추가
m2na7 fc037f5
feat: TimeTable 관련 아이콘 추가
m2na7 47a5963
feat: navigation zIndex 추가
m2na7 a848512
feat: 타임테이블 편집 플로팅 버튼 컴포넌트 추가
m2na7 b6df7f3
style: 백그라운드 css관련 주석 제거
m2na7 9da7e70
refactor: 디자인 토큰 사용 및 css속성 선언 순서 변경
m2na7 6642315
feat: 편집 버튼 및 박스 텍스트 상수화
m2na7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
127 changes: 127 additions & 0 deletions
127
apps/client/src/pages/time-table/components/edit-floating-button.css.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import { recipe } from '@vanilla-extract/recipes'; | ||
import { keyframes, style } from '@vanilla-extract/css'; | ||
import { themeVars } from '@confeti/design-system/styles'; | ||
|
||
const fadeInBox = keyframes({ | ||
from: { opacity: 0, transform: 'translateY(80%)' }, | ||
to: { opacity: 1, transform: 'translateY(0)' }, | ||
}); | ||
|
||
const fadeInText = keyframes({ | ||
from: { opacity: 0, transform: 'translateY(20%)' }, | ||
to: { opacity: 1, transform: 'translateY(0)' }, | ||
}); | ||
|
||
const fadeOutText = keyframes({ | ||
from: { opacity: 1, transform: 'translateY(0)' }, | ||
to: { opacity: 0, transform: 'translateY(20%)' }, | ||
}); | ||
|
||
export const box = style({ | ||
padding: '1rem 5.3rem 0.9rem 1.6rem', | ||
bottom: '17rem', | ||
right: '2rem', | ||
|
||
...themeVars.display.flexCenter, | ||
|
||
position: 'absolute', | ||
zIndex: themeVars.zIndex.floatingButton.content, | ||
transition: 'width 0.3s ease-in-out', | ||
...themeVars.fontStyles.subtitle4_b_14, | ||
flexDirection: 'column', | ||
alignItems: 'flex-start', | ||
|
||
borderRadius: '0.5rem', | ||
backgroundColor: themeVars.color.white, | ||
|
||
animation: `${fadeInBox} 0.3s ease-out`, | ||
}); | ||
|
||
export const boxButton = style({ | ||
...themeVars.display.flexCenter, | ||
padding: '0.8rem 0', | ||
cursor: 'pointer', | ||
}); | ||
|
||
export const buttonVariants = recipe({ | ||
base: { | ||
height: '5rem', | ||
position: 'absolute', | ||
right: '2rem', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
borderRadius: '3rem', | ||
backgroundColor: themeVars.color.gray800, | ||
zIndex: themeVars.zIndex.floatingButton.content, | ||
transition: 'width 0.3s ease-in-out', | ||
cursor: 'pointer', | ||
}, | ||
variants: { | ||
variant: { | ||
close: { | ||
bottom: '11rem', | ||
padding: '1.3rem', | ||
width: '5rem', | ||
}, | ||
edit: { | ||
bottom: '11rem', | ||
padding: '0.5rem', | ||
width: '11rem', | ||
}, | ||
complete: { | ||
bottom: '2rem', | ||
padding: '0.5rem', | ||
width: '11rem', | ||
gap: '0.2rem', | ||
}, | ||
}, | ||
}, | ||
defaultVariants: { | ||
variant: 'edit', | ||
}, | ||
}); | ||
|
||
export const text = style({ | ||
...themeVars.fontStyles.subtitle4_b_14, | ||
color: themeVars.color.confeti_lime2, | ||
whiteSpace: 'nowrap', | ||
transition: 'opacity 0.3s ease-in-out, transform 0.3s ease-in-out', | ||
}); | ||
|
||
export const textVisible = style({ | ||
animation: `${fadeInText} 0.3s ease-out`, | ||
}); | ||
|
||
export const textHidden = style({ | ||
animation: `${fadeOutText} 0.3s ease-in`, | ||
opacity: 0, | ||
}); | ||
|
||
export const background = style({ | ||
position: 'fixed', | ||
top: 0, | ||
left: '50%', | ||
transform: 'translateX(-50%)', | ||
width: '100%', | ||
height: 'var(--height)', | ||
maxWidth: 'var(--max-width)', | ||
minWidth: 'var(--min-width)', | ||
transition: 'background-color 0.3s ease-in-out', | ||
}); | ||
|
||
// 전체 뷰포트 | ||
// export const background = style({ | ||
// position: 'fixed', | ||
// top: 0, | ||
// left: 0, | ||
// width: '100vw', | ||
// height: '100vh', | ||
// zIndex: themeVars.zIndex.floatingButton.content, | ||
// transition: 'background-color 0.3s ease-in-out', | ||
// }); | ||
|
||
export const backgroundVisible = style({ | ||
backgroundColor: themeVars.color.black_op, | ||
zIndex: themeVars.zIndex.floatingButton.content, | ||
}); |
128 changes: 128 additions & 0 deletions
128
apps/client/src/pages/time-table/components/edit-floating-button.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
import { useState } from 'react'; | ||
|
||
import { | ||
IcTimetableFloatClose, | ||
IcFloatEditLime24, | ||
IcFloatEdit24, | ||
IcFloatDelete24, | ||
IcTimetableFloatFinish, | ||
} from '@confeti/design-system/icons'; | ||
import * as styles from './edit-floating-button.css'; | ||
|
||
type ModeSetter = React.Dispatch<React.SetStateAction<boolean>>; | ||
|
||
interface RenderActionButtonProps { | ||
variant: 'close' | 'edit' | 'complete'; | ||
icon: JSX.Element; | ||
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. 👍굿입니다 React.Node 보다 JSX가 더 적절한 것 같긴해요 |
||
text: string | null; | ||
onClick: () => void; | ||
} | ||
|
||
const EditFloatingButton = () => { | ||
const [isEditMode, setIsEditMode] = useState(false); | ||
const [isEditTimeTableMode, setIsEditTimeTableMode] = useState(false); | ||
const [isFestivalDeleteMode, setIsFestivalDeleteMode] = useState(false); | ||
const [isTextVisible, setIsTextVisible] = useState(true); | ||
|
||
const resetModes = () => { | ||
setIsEditTimeTableMode(false); | ||
setIsFestivalDeleteMode(false); | ||
}; | ||
|
||
const handleToggleButton = () => { | ||
setIsEditMode((prev) => !prev); | ||
setIsTextVisible(true); | ||
if (isEditTimeTableMode || isFestivalDeleteMode) resetModes(); | ||
}; | ||
|
||
const handleModeToggle = (modeSetter: ModeSetter): void => { | ||
modeSetter((prev: boolean) => !prev); | ||
}; | ||
|
||
const getBackgroundClassName = () => { | ||
return `${styles.background} ${ | ||
isEditMode && !isEditTimeTableMode && !isFestivalDeleteMode | ||
? styles.backgroundVisible | ||
: '' | ||
}`; | ||
}; | ||
|
||
const renderButton = () => { | ||
if (isEditMode && (isEditTimeTableMode || isFestivalDeleteMode)) { | ||
return renderActionButton({ | ||
variant: 'complete', | ||
icon: <IcTimetableFloatFinish width="2.4rem" height="2.4rem" />, | ||
text: '완료하기', | ||
onClick: handleToggleButton, | ||
}); | ||
} | ||
|
||
if (isEditMode) { | ||
return renderActionButton({ | ||
variant: 'close', | ||
icon: <IcTimetableFloatClose width="2.4rem" height="2.4rem" />, | ||
text: null, | ||
onClick: handleToggleButton, | ||
}); | ||
} | ||
|
||
return renderActionButton({ | ||
variant: 'edit', | ||
icon: <IcFloatEditLime24 width="2.4rem" height="2.4rem" />, | ||
text: '편집하기', | ||
onClick: handleToggleButton, | ||
}); | ||
}; | ||
|
||
const renderActionButton = ({ | ||
variant, | ||
icon, | ||
text, | ||
onClick, | ||
}: RenderActionButtonProps) => ( | ||
<button className={styles.buttonVariants({ variant })} onClick={onClick}> | ||
{icon} | ||
{text && ( | ||
<span | ||
className={`${styles.text} ${isTextVisible ? styles.textVisible : styles.textHidden}`} | ||
> | ||
{text} | ||
</span> | ||
)} | ||
</button> | ||
); | ||
|
||
const renderActionButtons = () => { | ||
if (isEditMode && !isEditTimeTableMode && !isFestivalDeleteMode) { | ||
return ( | ||
<div className={styles.box}> | ||
<button | ||
onClick={() => handleModeToggle(setIsEditTimeTableMode)} | ||
className={styles.boxButton} | ||
> | ||
<IcFloatEdit24 width="2.4rem" height="2.4rem" /> | ||
<span>타임테이블 편집</span> | ||
</button> | ||
<button | ||
onClick={() => handleModeToggle(setIsFestivalDeleteMode)} | ||
className={styles.boxButton} | ||
> | ||
<IcFloatDelete24 width="2.4rem" height="2.4rem" /> | ||
<span>페스티벌 삭제</span> | ||
</button> | ||
</div> | ||
); | ||
} | ||
return null; | ||
}; | ||
|
||
return ( | ||
<> | ||
<div className={getBackgroundClassName()} /> | ||
{renderActionButtons()} | ||
{renderButton()} | ||
</> | ||
); | ||
}; | ||
|
||
export default EditFloatingButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/design-system/src/icons/assets/ic_float_delete_24.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
3
packages/design-system/src/icons/assets/ic_float_edit_lime_24.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
3
packages/design-system/src/icons/assets/ic_timetable_float_close.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
10
packages/design-system/src/icons/assets/ic_timetable_float_finish.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { SVGProps } from 'react'; | ||
const SvgIcFloatDelete24 = (props: SVGProps<SVGSVGElement>) => ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="1em" | ||
height="1em" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
{...props} | ||
> | ||
<path | ||
fill="#121212" | ||
d="M8.333 11.667c0 .366.3.666.667.666h5.333c.367 0 .667-.3.667-.666S14.7 11 14.333 11H9c-.367 0-.667.3-.667.667M11.667 5A6.67 6.67 0 0 0 5 11.667a6.67 6.67 0 0 0 6.667 6.666 6.67 6.67 0 0 0 6.666-6.666A6.67 6.67 0 0 0 11.667 5m0 12a5.34 5.34 0 0 1-5.334-5.333 5.34 5.34 0 0 1 5.334-5.334A5.34 5.34 0 0 1 17 11.667 5.34 5.34 0 0 1 11.667 17" | ||
/> | ||
</svg> | ||
); | ||
export default SvgIcFloatDelete24; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { SVGProps } from 'react'; | ||
const SvgIcFloatEdit24 = (props: SVGProps<SVGSVGElement>) => ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="1em" | ||
height="1em" | ||
fill="none" | ||
viewBox="0 0 25 24" | ||
{...props} | ||
> | ||
<path | ||
fill="#121212" | ||
d="M6.5 15.64v2.027a.33.33 0 0 0 .333.333H8.86a.31.31 0 0 0 .233-.1l7.279-7.272-2.5-2.5L6.6 15.4a.33.33 0 0 0-.1.24m11.805-6.945c.26-.26.26-.68 0-.94l-1.56-1.56a.664.664 0 0 0-.94 0l-1.22 1.22 2.5 2.5z" | ||
/> | ||
</svg> | ||
); | ||
export default SvgIcFloatEdit24; |
17 changes: 17 additions & 0 deletions
17
packages/design-system/src/icons/src/IcFloatEditLime24.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { SVGProps } from 'react'; | ||
const SvgIcFloatEditLime24 = (props: SVGProps<SVGSVGElement>) => ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="1em" | ||
height="1em" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
{...props} | ||
> | ||
<path | ||
fill="#E9FFAC" | ||
d="M6 15.64v2.027a.33.33 0 0 0 .333.333H8.36a.31.31 0 0 0 .233-.1l7.279-7.272-2.5-2.5L6.1 15.4a.33.33 0 0 0-.1.24m11.805-6.945c.26-.26.26-.68 0-.94l-1.56-1.56a.664.664 0 0 0-.94 0l-1.22 1.22 2.5 2.5z" | ||
/> | ||
</svg> | ||
); | ||
export default SvgIcFloatEditLime24; |
17 changes: 17 additions & 0 deletions
17
packages/design-system/src/icons/src/IcTimetableFloatClose.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { SVGProps } from 'react'; | ||
const SvgIcTimetableFloatClose = (props: SVGProps<SVGSVGElement>) => ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="1em" | ||
height="1em" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
{...props} | ||
> | ||
<path | ||
fill="#E9FFAC" | ||
d="m12 13.803-3.803 3.804q-.36.36-.918.36t-.918-.36Q6 17.247 6 16.689q0-.558.36-.918l3.804-3.804-3.803-3.77Q6 7.837 6 7.279q0-.558.36-.918Q6.722 6 7.28 6q.556 0 .918.36L12 10.165l3.77-3.803Q16.13 6 16.69 6q.556 0 .918.36.393.394.393.935 0 .54-.393.902l-3.804 3.77 3.804 3.803q.36.36.36.919 0 .556-.36.918a1.28 1.28 0 0 1-.935.393q-.54 0-.902-.393z" | ||
/> | ||
</svg> | ||
); | ||
export default SvgIcTimetableFloatClose; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
이 부분은
display
에 토큰화 동일하게 되어있습니다flexCenter
쓰시면 좋을 것 같아요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.
수정했어요 ~!