Skip to content

Commit

Permalink
feat: strict props to use card as Hero component
Browse files Browse the repository at this point in the history
  • Loading branch information
shoota committed May 11, 2024
1 parent 58f5313 commit 05ee190
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
3 changes: 0 additions & 3 deletions src/lib/components/Hero/Hero.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { action } from "@storybook/addon-actions"
import type { Meta, StoryObj } from "@storybook/react"
import { Hero } from "./Hero"

Expand All @@ -7,14 +6,12 @@ const meta = {
component: Hero,
args: {
title: "Hello Everyone, I'm a cat.",
description: "I'm a cat, and I'm here to say hello to you.",
image: { src: "/image/example.jpg" },
imageCaption: (
<>
Photo by <a>@shoota</a> in 2024
</>
),
onClick: action("onClick"),
},
} satisfies Meta<typeof Hero>

Expand Down
9 changes: 4 additions & 5 deletions src/lib/components/Hero/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import { ComponentProps, PropsWithChildren } from "react"
import { Card } from "../../core"

type Props = ComponentProps<typeof Card>
type CardProps = ComponentProps<typeof Card>

type Props = Pick<CardProps, "image" | "imageCaption" | "title">
export const Hero = ({
title,
description,
image,
imageCaption,
onClick,
}: PropsWithChildren<Props>) => {
return (
<Card
title={title}
description={description}
image={image}
imageCaption={imageCaption}
onClick={onClick}
transition={false}
/>
)
}

0 comments on commit 05ee190

Please sign in to comment.