mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 22:06:38 +08:00
36 lines
657 B
TypeScript
36 lines
657 B
TypeScript
'use client';
|
|
|
|
import * as React from 'react';
|
|
import { type HTMLMotionProps, motion } from 'motion/react';
|
|
|
|
import {
|
|
Slot,
|
|
type WithAsChild,
|
|
} from '@/components/animate-ui/primitives/animate/slot';
|
|
|
|
type ButtonProps = WithAsChild<
|
|
HTMLMotionProps<'button'> & {
|
|
hoverScale?: number;
|
|
tapScale?: number;
|
|
}
|
|
>;
|
|
|
|
function Button({
|
|
hoverScale = 1.05,
|
|
tapScale = 0.95,
|
|
asChild = false,
|
|
...props
|
|
}: ButtonProps) {
|
|
const Component = asChild ? Slot : motion.button;
|
|
|
|
return (
|
|
<Component
|
|
whileTap={{ scale: tapScale }}
|
|
whileHover={{ scale: hoverScale }}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export { Button, type ButtonProps };
|