RESTfulMC/Frontend/src/app/components/minecraft-button.tsx

50 lines
1.4 KiB
TypeScript
Raw Normal View History

2024-04-15 19:31:55 -07:00
import { Button } from "@/components/ui/button";
2024-04-19 22:33:33 -07:00
import { cn } from "@/app/common/utils";
2024-04-17 16:14:10 -07:00
import { ButtonHTMLAttributes, ReactElement, ReactNode } from "react";
2024-04-15 19:31:55 -07:00
2024-04-16 13:40:25 -07:00
/**
* Props for this button.
*/
type MinecraftButtonProps = {
2024-04-17 16:14:10 -07:00
/**
* The class name to apply to this button.
*/
className?: string;
2024-04-16 13:40:25 -07:00
2024-04-17 16:14:10 -07:00
/**
* The children of this button.
*/
children: ReactNode;
2024-04-16 13:40:25 -07:00
};
2024-04-15 19:31:55 -07:00
/**
* A Minecraft styled button.
*
* @returns the button jsx
*/
const MinecraftButton = ({
2024-04-17 16:14:10 -07:00
className,
children,
...props
}: ButtonHTMLAttributes<HTMLButtonElement> &
MinecraftButtonProps): ReactElement => (
<Button
className={cn(
"before:absolute before:-inset-x-5 before:rotate-90 before:w-9 before:h-1 before:bg-minecraft-green-1", // Left Green Bar
"after:absolute after:right-[-1.24rem] after:rotate-90 after:w-9 after:h-1 after:bg-minecraft-green-1", // Right Green Bar
"relative h-full px-5 bg-minecraft-green-2 hover:opacity-85 hover:bg-minecraft-green-2 rounded-none tracking-wide font-semibold uppercase transition-all transform-gpu", // Styling
className
)}
variant="ghost"
style={{
// Above and below the button shadow
boxShadow:
"inset 0 -4px 0 hsl(var(--minecraft-green-1)), inset 0 4px 0 hsl(var(--minecraft-green-3))",
}}
{...props}
>
{children}
</Button>
2024-04-15 19:31:55 -07:00
);
export default MinecraftButton;