mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-11-05 10:52:49 +00:00
* feat: enhance github stars button to be better looking and more compact to make mobile compatibility easier in the future * feat: introduce a new Button component
37 lines
751 B
TypeScript
37 lines
751 B
TypeScript
"use client";
|
|
|
|
import type { HTMLMotionProps } from "motion/react";
|
|
|
|
import { motion } from "motion/react";
|
|
import * as React from "react";
|
|
|
|
import type { WithAsChild } from "@/components/animate-ui/primitives/animate/slot";
|
|
|
|
import { Slot } 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 };
|