-
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
Changes from 8 commits
03198c0
bb21d05
2cf01a4
e028383
db0b37b
bca2a5c
801fd92
104a9f8
d1c3001
01b4bd0
9bbfa98
5730282
7481884
4c88eb3
976f280
514fd7a
b873693
b805ff4
8f9e3c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import { cn } 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, ...props }: LikeButtonProps) => { | ||
| return ( | ||
| <div> | ||
|
||
| <Button | ||
| icon={isLike ? "LikeOnIcon" : "LikeOffIcon"} | ||
| appearance="outline" | ||
| aria-label="좋아요버튼" | ||
| className={cn( | ||
| "cursor-pointer rounded-lg py-1 pl-2 pr-3", | ||
| "mobile:h-8 mobile:gap-[2px]", | ||
| "tablet:h-8 tablet:gap-[2px]", | ||
|
||
| "pc:h-9 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-body-lg font-normal tracking-[-0.02em]", | ||
| isLike && "text-lg text-red-200" | ||
| )} | ||
| > | ||
| {count} | ||
| </span> | ||
| </Button> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default LikeButton; | ||

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 라벨을 추가하는게 좋을 것 같아요!