mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-11-05 19:02:50 +00:00
feat: enhance github stars button to be better looking and more compact (#7464)
* 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
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
"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 };
|
||||
Reference in New Issue
Block a user