重构项目结构,将数据层集中在 lib 包中;resource 类型更新,支持多个子套餐类型分别表示;新增长效套餐的购买流程,以及已购查询功能
This commit is contained in:
34
src/components/composites/purchase/option.tsx
Normal file
34
src/components/composites/purchase/option.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
'use client'
|
||||
import {FormLabel} from '@/components/ui/form'
|
||||
import {merge} from '@/lib/utils'
|
||||
import {RadioGroupItem} from '@/components/ui/radio-group'
|
||||
import {ReactNode} from 'react'
|
||||
|
||||
export type FormOptionProps = {
|
||||
id: string
|
||||
value: string
|
||||
label?: string
|
||||
description?: string
|
||||
compare: string
|
||||
className?: string
|
||||
children?: ReactNode
|
||||
}
|
||||
|
||||
export default function FormOption(props: FormOptionProps) {
|
||||
return <>
|
||||
<FormLabel
|
||||
htmlFor={props.id}
|
||||
className={merge(
|
||||
`transition-colors duration-150 ease-in-out`,
|
||||
`px-6 py-4 border rounded-md flex flex-col gap-2 cursor-pointer`,
|
||||
props.compare === props.value ? `bg-primary/10 border-primary` : `border-gray-200`,
|
||||
props.className,
|
||||
)}>
|
||||
{props.children ? props.children : <>
|
||||
<span>{props.label}</span>
|
||||
{props.description && <p className={`text-sm text-gray-500`}>{props.description}</p>}
|
||||
</>}
|
||||
</FormLabel>
|
||||
<RadioGroupItem id={props.id} value={props.value} className={`hidden`}/>
|
||||
</>
|
||||
}
|
||||
Reference in New Issue
Block a user