46 lines
1.0 KiB
TypeScript
Raw Normal View History

'use client'
import type { FC } from 'react'
import React from 'react'
import s from './style.module.css'
import cn from '@/utils/classnames'
type Props = {
className?: string
title: string | React.JSX.Element | null
description: string
isChosen: boolean
onChosen: () => void
chosenConfig?: React.ReactNode
icon?: React.JSX.Element
2024-08-01 13:45:18 +08:00
extra?: React.ReactNode
}
const RadioCard: FC<Props> = ({
title,
description,
isChosen,
onChosen,
icon,
2024-08-01 13:45:18 +08:00
extra,
}) => {
return (
<div
2024-08-01 13:45:18 +08:00
className={cn(s.item, isChosen && s.active)}
onClick={onChosen}
>
2024-08-01 13:45:18 +08:00
<div className='flex px-3 py-2'>
{icon}
<div>
<div className='flex items-center justify-between'>
<div className='text-sm font-medium leading-5 text-gray-900'>{title}</div>
2024-08-01 13:45:18 +08:00
<div className={s.radio}></div>
</div>
<div className='text-xs font-normal leading-[18px] text-gray-500'>{description}</div>
</div>
</div>
2024-08-01 13:45:18 +08:00
{extra}
</div>
)
}
export default React.memo(RadioCard)