Skip to content

Commit

Permalink
feat: Resultlist 스토리북 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Leeseunghwan7305 committed May 14, 2024
1 parent 46ccdac commit a815aba
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions src/components/main/ResultList.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Meta, StoryObj } from "@storybook/react";
import ResultList from "./ResultList";
import { ResultListType } from "@/src/types/searchResult";
import { fn } from "@storybook/test";
import BookmarkBorder from "../../common/Image/BookmarkBorder";
import Bookmark from "../../common/Image/Bookmark";

const meta = {
title: "Components/ResultList",
Expand Down Expand Up @@ -52,10 +54,29 @@ const sampleResults: ResultListType = {
export const Basic: Story = {
args: {
searchResult: sampleResults,
renderBookmark: ({ onClick, isFavorites }) => (
<button onClick={onClick} data-is-favorites={isFavorites}>
Bookmark
</button>
),
renderBookmark: ({ onClick, isFavorites }) => {
return isFavorites ? (
<Bookmark
onClick={(e: React.MouseEvent<HTMLOrSVGElement>) => {
e.stopPropagation();
onClick(e);
}}
width="16"
height="16"
cursor="pointer"
/>
) : (
<BookmarkBorder
onClick={(e: React.MouseEvent<HTMLOrSVGElement>) => {
e.stopPropagation();
onClick(e);
}}
width="16"
height="16"
fill="#007BE9"
cursor="pointer"
/>
);
},
},
};

0 comments on commit a815aba

Please sign in to comment.