feat: rename form/card to form/choicecard

This commit is contained in:
Simon Emanuelsson
2024-10-08 11:06:09 +02:00
parent 9b9c1b0e14
commit 155b6683c4
8 changed files with 21 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
import Card from "."
import Card from "./_Card"
import type { CheckboxProps } from "./card"
import type { CheckboxProps } from "./_Card/card"
export default function CheckboxCard(props: CheckboxProps) {
return <Card {...props} type="checkbox" />

View File

@@ -1,6 +1,6 @@
import Card from "."
import Card from "./_Card"
import type { RadioProps } from "./card"
import type { RadioProps } from "./_Card/card"
export default function RadioCard(props: RadioProps) {
return <Card {...props} type="radio" />

View File

@@ -1,14 +1,15 @@
import type { IconProps } from "@/types/components/icon"
interface BaseCardProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
interface BaseCardProps
extends Omit<React.LabelHTMLAttributes<HTMLLabelElement>, "title"> {
Icon?: (props: IconProps) => JSX.Element
declined?: boolean
highlightSubtitle?: boolean
iconHeight?: number
iconWidth?: number
name?: string
saving?: boolean
subtitle?: string
title: string
name: string
subtitle?: React.ReactNode
title: React.ReactNode
type: "checkbox" | "radio"
value?: string
}
@@ -22,7 +23,7 @@ interface ListCardProps extends BaseCardProps {
interface TextCardProps extends BaseCardProps {
list?: never
text: string
text: React.ReactNode
}
export type CardProps = ListCardProps | TextCardProps

View File

@@ -13,10 +13,10 @@ export default function Card({
iconHeight = 32,
iconWidth = 32,
declined = false,
highlightSubtitle = false,
id,
list,
name = "join",
saving = false,
name,
subtitle,
text,
title,
@@ -31,7 +31,7 @@ export default function Card({
{subtitle ? (
<Caption
className={styles.subtitle}
color={saving ? "baseTextAccent" : "uiTextHighContrast"}
color={highlightSubtitle ? "baseTextAccent" : "uiTextHighContrast"}
textTransform="bold"
>
{subtitle}