52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
import type { IconProps } from "@/types/components/icon"
|
|
|
|
interface BaseCardProps
|
|
extends Omit<React.LabelHTMLAttributes<HTMLLabelElement>, "title"> {
|
|
Icon?: (props: IconProps) => JSX.Element
|
|
declined?: boolean
|
|
highlightSubtitle?: boolean
|
|
iconHeight?: number
|
|
iconWidth?: number
|
|
name: string
|
|
subtitle?: React.ReactNode
|
|
title: React.ReactNode
|
|
type: "checkbox" | "radio"
|
|
value?: string
|
|
}
|
|
|
|
interface ListCardProps extends BaseCardProps {
|
|
list: {
|
|
title: string
|
|
}[]
|
|
text?: never
|
|
}
|
|
|
|
interface TextCardProps extends BaseCardProps {
|
|
list?: never
|
|
text: React.ReactNode
|
|
}
|
|
|
|
interface CleanCardProps extends BaseCardProps {
|
|
list?: never
|
|
text?: never
|
|
}
|
|
|
|
export type CardProps = ListCardProps | TextCardProps | CleanCardProps
|
|
|
|
export type CheckboxProps =
|
|
| Omit<ListCardProps, "type">
|
|
| Omit<TextCardProps, "type">
|
|
export type RadioProps =
|
|
| Omit<ListCardProps, "type">
|
|
| Omit<TextCardProps, "type">
|
|
| Omit<CleanCardProps, "type">
|
|
|
|
export interface ListProps extends Pick<ListCardProps, "declined"> {
|
|
list?: ListCardProps["list"]
|
|
}
|
|
|
|
export interface SubtitleProps
|
|
extends Pick<BaseCardProps, "highlightSubtitle" | "subtitle"> {}
|
|
|
|
export interface TextProps extends Pick<TextCardProps, "text"> {}
|