-
Notifications
You must be signed in to change notification settings - Fork 2
[#8] 좋아요 버튼 컴포넌트 제작 #52
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
19 commits
Select commit
Hold shift + click to select a range
03198c0
Merge branch 'develop' of https://github.com/Team-3-2/Wine into develop
huuitae bb21d05
Merge branch 'develop' of https://github.com/Team-3-2/Wine into develop
huuitae 2cf01a4
Merge branch 'develop' into design/like-button
huuitae e028383
chore: 서치바 컴포넌트 index에 추가
huuitae db0b37b
design: 좋아요 버튼 제작중
huuitae bca2a5c
Merge branch 'develop' of https://github.com/Team-3-2/Wine into develop
huuitae 801fd92
Merge branch 'develop' into design/like-button
huuitae 104a9f8
design: 좋아요 버튼 컴포넌트 제작 완료
huuitae d1c3001
design: 반응형 수정
huuitae 01b4bd0
Merge branch 'develop' of https://github.com/Team-3-2/Wine into develop
huuitae 9bbfa98
Merge branch 'develop' into design/like-button
huuitae 5730282
refactor: 코드 리뷰 내용 반영
huuitae 7481884
Merge branch 'develop' of https://github.com/Team-3-2/Wine into develop
huuitae 4c88eb3
Merge branch 'develop' into design/like-button
huuitae 976f280
design: 좋아요 개수 표기 수정
huuitae 514fd7a
Merge branch 'develop' of https://github.com/Team-3-2/Wine into develop
huuitae b873693
Merge branch 'develop' into design/like-button
huuitae b805ff4
Merge branch 'develop' into design/like-button
huuitae 8f9e3c6
Merge branch 'design/like-button' of https://github.com/Team-3-2/Wine…
huuitae 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import { cn, formatCount } from "@/lib/utils"; | ||
| import Button from "./basic-button"; | ||
| import { ComponentProps } from "react"; | ||
|
|
||
| interface LikeButtonProps extends ComponentProps<"button"> { | ||
| isLike?: boolean; | ||
| count?: number; | ||
| } | ||
|
|
||
| /** | ||
| * 좋아요 버튼 컴포넌트 | ||
| * @author hwitae | ||
| * @param isLike 좋아요 상태 true/false | ||
| * @param count 좋아요 개수 | ||
| * @returns button | ||
| */ | ||
| const LikeButton = ({ isLike, count = 0, ...props }: LikeButtonProps) => { | ||
| return ( | ||
| <Button | ||
| icon={isLike ? "LikeOnIcon" : "LikeOffIcon"} | ||
| appearance="outline" | ||
| aria-label={isLike ? "좋아요" : "좋아요 취소"} | ||
| aria-pressed={isLike} | ||
| className={cn( | ||
| "h-8 w-fit cursor-pointer gap-[2px] rounded-lg py-1 pl-2 pr-3", | ||
| "tablet:h-9 tablet:w-fit tablet:gap-[4px] tablet:py-[6px] tablet:pl-3 tablet:pr-[14px]", | ||
| "pc:h-9 pc:w-fit pc:gap-[4px] pc:py-[6px] pc:pl-3 pc:pr-[14px]", | ||
| isLike && "border border-red-200" | ||
| )} | ||
| iconClassName={cn("mobile:ic-sm", "tablet:ic-sm", "pc:ic-md")} | ||
| iconColor={isLike ? "danger200" : "default"} | ||
| {...props} | ||
| > | ||
| <span | ||
| className={cn( | ||
| "text-lg font-normal tracking-[-0.02em]", | ||
| isLike ? "text-red-200" : "text-primary" | ||
| )} | ||
| > | ||
| {formatCount(count)} | ||
| </span> | ||
| </Button> | ||
| ); | ||
| }; | ||
|
|
||
| export default LikeButton; |
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
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.
스토리북 파일에 추가 되었다면, chromatic 라벨을 추가하는게 좋을 것 같아요!