Skip to content

Commit

Permalink
fix(Card): Refactor types for Card primitive (#820)
Browse files Browse the repository at this point in the history
* fix(Card): Refactor types for Card primitive

* chore: Add changeset
  • Loading branch information
EnMod committed Nov 14, 2022
1 parent 45fe15e commit 5009393
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/nine-items-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hashicorp/react-card': patch
---

Refactors Card primitive to use its own type. Fixes type errors stemming from children being set as a key on BaseCardProps.
4 changes: 2 additions & 2 deletions packages/card/primitives.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Link from 'next/link'
import ProductBadge from '@hashicorp/react-product-badge'
import { IconArrowRight24 } from '@hashicorp/flight-icons/svg-react/arrow-right-24'
import type {
BaseCardProps,
CardPrimitiveProps,
ThumbnailProps,
MetaProps,
ContentProps,
Expand All @@ -15,7 +15,7 @@ import type {
} from './types'
import s from './style.module.css'

const Card = React.forwardRef<HTMLAnchorElement, BaseCardProps>(
const Card = React.forwardRef<HTMLAnchorElement, CardPrimitiveProps>(
(props, ref) => {
const {
appearance = 'light',
Expand Down
3 changes: 3 additions & 0 deletions packages/card/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ export interface BaseCardProps {
withArrow?: boolean
heading: string
link: string
}

export interface CardPrimitiveProps extends BaseCardProps {
children: React.ReactNode
}

Expand Down

1 comment on commit 5009393

@vercel
Copy link

@vercel vercel bot commented on 5009393 Nov 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.