File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed
stories/design-system/components/buttons Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ "use client" ;
2+ import React , { useState } from "react" ;
3+ import { FaBookmark , FaRegBookmark } from "react-icons/fa" ;
4+
5+ interface BookmarkBtnProps {
6+ className ?: string ;
7+ }
8+
9+ const BookmarkBtn : React . FC < BookmarkBtnProps > = ( { className = "" } ) => {
10+ const [ isBookmarked , setIsBookmarked ] = useState ( false ) ;
11+
12+ const toggleBookmark = ( ) => {
13+ setIsBookmarked ( ( prev ) => ! prev ) ;
14+ } ;
15+
16+ const baseStyles =
17+ "inline-flex items-center justify-center transition-colors rounded-full w-54 h-54 p-4 bg-orange-50" ;
18+
19+ const iconStyles = "text-xl text-primary-orange-300" ;
20+
21+ return (
22+ < button className = { `${ baseStyles } ${ className } ` } onClick = { toggleBookmark } >
23+ { isBookmarked ? < FaBookmark className = { iconStyles } /> : < FaRegBookmark className = { iconStyles } /> }
24+ </ button >
25+ ) ;
26+ } ;
27+
28+ export default BookmarkBtn ;
Original file line number Diff line number Diff line change 1+ import BookmarkBtn from "@/app/components/button/BookmarkBtn" ;
2+ import type { Meta , StoryObj } from "@storybook/react" ;
3+
4+ const meta : Meta < typeof BookmarkBtn > = {
5+ title : "Design System/Components/BookmarkBtn" ,
6+ component : BookmarkBtn ,
7+ parameters : {
8+ layout : "centered" ,
9+ } ,
10+ } ;
11+
12+ export default meta ;
13+ type Story = StoryObj < typeof BookmarkBtn > ;
14+
15+ export const Bookmarked : Story = {
16+ args : { } ,
17+ render : ( args ) => {
18+ return (
19+ < div >
20+ < p className = "mb-2 text-sm" > click !</ p >
21+ < BookmarkBtn { ...args } />
22+ </ div >
23+ ) ;
24+ } ,
25+ } ;
You can’t perform that action at this time.
0 commit comments