完善产品购买页面,抽取公共组件,优化导航链接
This commit is contained in:
@@ -3,7 +3,7 @@ import {Slot} from '@radix-ui/react-slot'
|
||||
import {merge} from '@/lib/utils'
|
||||
|
||||
type ButtonProps = React.ComponentProps<'button'> & {
|
||||
variant?: 'default' | 'outline' | 'gradient' | 'danger'
|
||||
variant?: 'default' | 'outline' | 'gradient' | 'danger' | 'accent'
|
||||
}
|
||||
|
||||
function Button(rawProps: ButtonProps) {
|
||||
@@ -22,9 +22,10 @@ function Button(rawProps: ButtonProps) {
|
||||
'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
|
||||
{
|
||||
gradient: 'bg-gradient-to-r from-blue-400 to-cyan-300 text-white ring-offset-2',
|
||||
default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
|
||||
danger: 'bg-destructive text-white shadow-xs hover:bg-destructive/90',
|
||||
outline: 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
||||
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
|
||||
accent: 'bg-accent text-accent-foreground hover:bg-accent/90',
|
||||
danger: 'bg-destructive text-white hover:bg-destructive/90',
|
||||
outline: 'border bg-background hover:bg-secondary hover:text-secondary-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
||||
}[variant ?? 'default'],
|
||||
className,
|
||||
)}
|
||||
|
||||
@@ -28,7 +28,11 @@ function Form<T extends FieldValues>(rawProps: FormProps<T>) {
|
||||
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
<form {...props} onSubmit={form.handleSubmit(onSubmit)}>
|
||||
<form {...props} onSubmit={event => {
|
||||
event.preventDefault()
|
||||
form.handleSubmit(onSubmit)(event)
|
||||
event.stopPropagation()
|
||||
}}>
|
||||
{children}
|
||||
</form>
|
||||
</FormProvider>
|
||||
|
||||
Reference in New Issue
Block a user