-
Notifications
You must be signed in to change notification settings - Fork 2
#15 snack bar 컴포넌트 제작 #32
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
The head ref may contain hidden characters: "feature/#15_SnackBar-\uCEF4\uD3EC\uB10C\uD2B8-\uC81C\uC791"
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
406e02b
✨ snackbar icon svg 추가
junghwaYang aa36296
✨ SnackBar 컴포넌트 완료
junghwaYang b3cb6f6
✨ snackbar 컴포넌트 test
junghwaYang 5d1a2de
Merge branch 'develop' into feature/#15_SnackBar-컴포넌트-제작
junghwaYang a0943ae
🚚 public icon 폴더로 이동
junghwaYang 6fef879
🐛 linkbar 누락 추가
junghwaYang 65dbf61
💄 test 구분선 추가
junghwaYang 6d293bb
🔨 Button 컴포넌트 이용하여, test 수정
junghwaYang b30a546
💄 커스텀 shadow 추가
junghwaYang 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 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 |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| interface SnackBarProps { | ||
| state: 'fail' | 'success' | 'info' | 'null'; | ||
| } | ||
|
|
||
| // state props styles object | ||
| const stateConfig = { | ||
| fail: { | ||
| style: | ||
| 'bg-red-50 border-red-100 fixed left-1/2 transform -translate-x-1/2 top-[120px] mx-auto mo:bottom-[80px] mo:top-auto w-[384px] mo:w-[328px] whitespace-nowrap', | ||
| text: '다른 친구가 편집하고 있어요. 나중에 다시 시도해 주세요.', | ||
| icon: '/icon/icon-fail.svg', | ||
| textStyle: 'text-red-100 text-14sb mo:text-12sb', | ||
| }, | ||
| success: { | ||
| style: | ||
| 'bg-green-100 border-green-200 fixed left-1/2 transform -translate-x-1/2 top-[120px] mx-auto mo:bottom-[80px] mo:top-auto w-[247px] mo:w-[210px] whitespace-nowrap', | ||
| text: '내 위키 링크가 복사되었습니다.', | ||
| icon: '/icon/icon-success.svg', | ||
| textStyle: 'text-green-300 text-14sb mo:text-12sb', | ||
| }, | ||
| info: { | ||
| style: 'bg-background border-white', | ||
| text: '앞 사람의 편집이 끝나면 위키 참여가 가능합니다.', | ||
| icon: '/icon/icon-info.svg', | ||
| textStyle: 'text-gray-500 text-14 mo:text-12', | ||
| }, | ||
| null: { | ||
| style: 'hidden', | ||
| text: '', | ||
| icon: '', | ||
| textStyle: '', | ||
| }, | ||
| }; | ||
|
|
||
| /** | ||
| * SnackBar 컴포넌트 | ||
| * @param {SnackBarProps} { state } - state: 'fail' | 'success' | 'info' | 'null' | ||
| */ | ||
| export default function SnackBar({ state }: SnackBarProps) { | ||
| const { style, text, icon, textStyle } = stateConfig[state]; | ||
|
|
||
| return ( | ||
| <div | ||
| className={`rounded-custom ${style} animate-fadeIn flex items-center gap-[15px] border px-5 py-[11px] shadow-custom mo:px-[15px] mo:py-[11px]`} | ||
| > | ||
| {icon && <img src={icon} alt="snackbar icon" className="h-5 w-5" />} | ||
| <p className={`${textStyle} break-words mo:break-words`}>{text}</p> | ||
| </div> | ||
| ); | ||
| } |
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
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Uh oh!
There was an error while loading. Please reload this page.