Basic recipe card structure.

This commit is contained in:
JesseBrault0709 2024-06-24 17:02:55 +02:00
parent af387de69b
commit c7f9a83cca
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,23 @@
export interface RecipeCardProps {
title: string
owner?: string
imgUrl?: string
rating?: number
}
const RecipeCard = ({ title, owner, imgUrl, rating }: RecipeCardProps) => {
return (
<article>
{imgUrl ? <img src={imgUrl} /> : null}
<div className="title-rating-container">
<h1>{title}</h1>
{rating ? <span>{Math.round(rating)}/5</span> : null}
</div>
<div className="owner-container">
{owner ? <p>@{owner}</p> : null}
</div>
</article>
)
}
export default RecipeCard

View File

@ -0,0 +1,20 @@
import type { Meta, StoryObj } from '@storybook/react'
import RecipeCard from '../../components/recipe-card/RecipeCard'
const meta = {
title: 'RecipeCard',
component: RecipeCard
} satisfies Meta<typeof RecipeCard>
export default meta
type Story = StoryObj<typeof meta>
export const Primary: Story = {
args: {
title: 'My Recipe',
owner: 'JesseBrault',
rating: 5,
imgUrl: 'https://www.simplyrecipes.com/thmb/L4nBpdZCubnbGtVbOW90JQSBVWc=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc():format(webp)/Simply-Recipes-Easy-Banana-Bread-LEAD-2-2-63dd39af009945d58f5bf4c2ae8d6070.jpg'
}
}