-
Notifications
You must be signed in to change notification settings - Fork 1
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
[#530] FloatingButton 컴포넌트 적용 #536
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0a0652b
chore: 그룹 검색 Input 아이콘 className 스타일링으로 변경
hanyugeon 3eaa2bd
chore: plus 아이콘 fill 속성 수정
hanyugeon 8f27b7c
fix: floatingButton 개선
hanyugeon 20bb312
feat: FloatingButton 기능 구현
hanyugeon 6b6f8f7
fix: 잘못된 스타일링 수정
hanyugeon dfe2466
style: SVG plus 아이콘 스타일 수정
hanyugeon b47d42a
refactor: 플로팅 버튼 portal id값 수정
hanyugeon b3a877d
style: 플로팅버튼 shadow 추가
hanyugeon 1e22566
refactor: 유저 로그인 유무에 따른 동작을 삼항연산자에서 if-else문으로 수정
hanyugeon ed1c8ab
fix: box-shadow 클래스 이름 컨밴션 수정
hanyugeon 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,48 @@ | ||
import { IconPlus } from '@public/icons'; | ||
import { ComponentPropsWithoutRef } from 'react'; | ||
import { createPortal } from 'react-dom'; | ||
|
||
import { IconPlus } from '@public/icons'; | ||
|
||
import Portal from './Portal'; | ||
|
||
interface FloatingButtonProps extends ComponentPropsWithoutRef<'button'> { | ||
position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; | ||
onClick?: () => void; | ||
} | ||
|
||
const getPositionClasses = (position: string) => { | ||
switch (position) { | ||
case 'top-left': { | ||
return 'top-[6.4rem] left-[1.2rem]'; | ||
return 'top-[1.3rem] left-[1.7rem]'; | ||
} | ||
case 'top-right': { | ||
return 'top-[6.4rem] right-[1.2rem]'; | ||
return 'top-[1.3rem] right-[1.7rem]'; | ||
} | ||
case 'bottom-left': { | ||
return 'bottom-[7.2rem] left-[1.2rem]'; | ||
return 'bottom-[8.3rem] left-[1.7rem]'; | ||
} | ||
case 'bottom-right': { | ||
return 'bottom-[7.2rem] right-[1.2rem]'; | ||
return 'bottom-[8.3rem] right-[1.7rem]'; | ||
} | ||
} | ||
}; | ||
|
||
const FloatingButton = ({ position, ...props }: FloatingButtonProps) => { | ||
const FloatingButton = ({ | ||
position, | ||
onClick, | ||
...props | ||
}: FloatingButtonProps) => { | ||
const positionClasses = getPositionClasses(position); | ||
|
||
return createPortal( | ||
<button | ||
className={`${positionClasses} fixed left-[50%] top-[50%] flex h-[5.1rem] w-[5.1rem] -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full bg-main-900`} | ||
{...props} | ||
> | ||
<IconPlus /> | ||
</button>, | ||
document.body | ||
return ( | ||
<Portal id="floating-button-portal"> | ||
<button | ||
className={`${positionClasses} absolute flex h-[5.1rem] w-[5.1rem] items-center justify-center rounded-full bg-main-900 shadow-floating-button`} | ||
onClick={onClick} | ||
{...props} | ||
> | ||
<IconPlus className="fill-white" /> | ||
</button> | ||
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. 혹시.. 제가 figma에서 floating button 디자인을 조금 수정해봤는데.. 반영해주실 수 있을까요?! 🥹🙇🏻♀️ 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. comment; 그럼요 |
||
</Portal> | ||
); | ||
}; | ||
|
||
|
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
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.
comment;
바뀐 BottomNavigation에 맞게 포지션 옵션을 수정했습니다