-
Notifications
You must be signed in to change notification settings - Fork 1
✨ feat: 포커스 진입 화면 UI 퍼블리싱 #336 #342
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
212e3ef
chore: 후속 구현을 위한 에셋 추가 #336
p1001q d5e6fd6
refactor: FAB 및 Checkbox 공용 컴포넌트 확장 #336
p1001q 93df647
fix: BottomSheet 반응형 너비와 safe area 보완 #336
p1001q 6a13f96
fix: 공용 UI 크기 클래스 충돌 및 Tailwind 문법 정리 #336
p1001q 53ed3b4
feat: 포커스 세션 진행 및 종료 플로우 퍼블리싱 #336
p1001q aa2be44
fix: 주석 정리 #336
p1001q 56cba57
chore: 미사용 에셋 제거 #336
p1001q 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
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.
This file contains hidden or 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 |
|---|---|---|
| @@ -1,25 +1,45 @@ | ||
| import { type ReactNode } from "react"; | ||
| import type { ButtonHTMLAttributes, ReactNode } from "react"; | ||
|
|
||
| type FabSize = "m" | "l"; | ||
| type FabVariant = "light" | "dark"; | ||
|
|
||
| type Props = { | ||
| icon: ReactNode; | ||
| onClick?: () => void; | ||
| className?: string; | ||
| size?: FabSize; | ||
| variant?: FabVariant; | ||
| } & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children">; | ||
|
|
||
| const sizeClassMap: Record<FabSize, string> = { | ||
| m: "h-10 w-10", | ||
| l: "h-11 w-11", | ||
| }; | ||
|
|
||
| export default function FAB({ icon, onClick, className }: Props) { | ||
| const clickable = Boolean(onClick); | ||
| const variantClassMap: Record<FabVariant, string> = { | ||
| light: "bg-gray-90", | ||
| dark: "bg-gray-25 shadow-elevation-20", | ||
| }; | ||
|
|
||
| export default function FAB({ | ||
| icon, | ||
| size = "m", | ||
| variant = "light", | ||
| className = "", | ||
| type = "button", | ||
| ...props | ||
| }: Props) { | ||
| return ( | ||
| <div | ||
| onClick={onClick} | ||
| role={clickable ? "button" : undefined} | ||
| tabIndex={clickable ? 0 : undefined} | ||
| <button | ||
| type={type} | ||
| className={[ | ||
| "inline-flex items-center rounded-[32px] select-none p-2 bg-gray-90 ", //select-none : svg 가 파란색으로 선택되지 않도록 방지하는 용도 | ||
| "inline-flex shrink-0 select-none items-center justify-center rounded-full", | ||
| "disabled:cursor-not-allowed disabled:opacity-50", | ||
| sizeClassMap[size], | ||
| variantClassMap[variant], | ||
| className, | ||
| ].join(" ")} | ||
| {...props} | ||
| > | ||
| <span className="flex h-6 w-6 justify-center items-center">{icon}</span> | ||
| </div> | ||
| </button> | ||
| ); | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
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.
기존 props를 제거하셨는데, 이 부분에서 생기는 오류는 없었나요 ??
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.
답변이 늦었습니다 죄송합니다...!!
기존 props를 삭제한 게 아니라 직접 하나씩 선언하던 방식을
React의 표준 button props 타입을 재사용하는 방식으로 확장한 것입니다!
(React에서 정의해둔 보편적인 HTML button 속성 타입을 FAB Props에 합쳐서 사용하는 방식)
오히려 더 확장했다고 봐주시면 됩니다! 그래서 오류 사항은 발견되지 않았어요~
Uh oh!
There was an error while loading. Please reload this page.
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.
불친절 했던 것 같아 설명을 추가해봤습니다! 보시고 건의사항 있으시면 말씀해주세요!
기존에는 FAB에서 사용하는 속성을 아래처럼 하나씩 직접 선언하고 있었습니다
이번에 FAB의 루트 요소를
div에서 실제button으로 변경하면서React에서 기본으로(TypeScript 타입 정의에서) 제공하는
<button>속성 타입인ButtonHTMLAttributes<HTMLButtonElement>를 Props에 합성하도록 수정한 겁니당따라서 기존의
onClick,className도 계속 사용할 수 있어요!추가로
aria-label,disabled,type,onKeyDown등실제 HTML button이 지원하는 속성도 별도 선언 없이 전달할 수 있습니다. 확장 된거에요!
런타임 동작이나 번들 크기에는 영향을 주지 않고 타입 검사에만 사용됩니다
기존 기록 화면의
onClick,className사용처도 그대로 유지되고전체 TypeScript 빌드와 관련 ESLint 검사로 오류 없는 것 확인했어요!
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.
허걱 이런 방법이 있는지 몰랐네요! 새로운 거 알려주셔서 감사합니다🥹🥹 레전드 친절하셔요...