Files
echecsfrance/src/components/Button.tsx
T
owenrees da78e82a44 upgrade Nodemailer to v10
fix dead code with knip

upgrade TS to v6 and fix linting errors

auto apply oxfmt rules

fix linting errors - unused deps etc

ignore file

remove all ignored files in knip

add knip - dead code analysis tool

swap prettier and eslint of oxfmt and oxlint

fix: fix map rendering in react strict mode

fix: headlessUI float replace

fix: disable Matomo if not URL and SITE ID exist

upgrade: 1st pass upgrade to Next.js v16

deps: upgrade react to v19
2026-09-29 22:16:07 +02:00

57 lines
1.7 KiB
TypeScript

import { type ComponentProps } from 'react'
import { type VariantProps, cva } from "class-variance-authority";
import { twMerge } from "tailwind-merge";
export const buttonVariants = cva("flex items-center justify-center transition-all duration-200", {
variants: {
intent: {
primary: [
"text-center",
"text-white",
"focus:outline-none focus:ring-2 focus:ring-primary-500",
"bg-primary-600",
"hover:bg-primary-800",
"disabled:opacity-25",
"dark:text-white dark:hover:bg-primary-700",
],
secondary: [
"text-primary dark:text-white",
"hover:text-white dark:hover:text-white",
"hover:bg-primary hover:text-white",
"border border-primary",
"focus:outline-none focus:ring-2 focus:ring-primary-500",
"disabled:opacity-25",
],
tertiary: [
"text-gray-900 dark:text-neutral-400",
"hover:text-primary dark:hover:text-white",
"focus:outline-none focus:ring-2 focus:ring-primary-500",
"disabled:opacity-25",
],
},
size: {
small: ["text-sm font-medium", "px-3 py-2", "sm:w-fit", "rounded-lg"],
medium: ["text-sm font-medium", "px-5 py-3", "sm:w-fit", "rounded-lg"],
compacted: ["rounded-none", "px-0 py-0"],
},
},
defaultVariants: {
intent: "primary",
size: "medium",
},
});
type ButtonVariants = VariantProps<typeof buttonVariants>;
export type ButtonProps = ComponentProps<"button"> & ButtonVariants;
export const Button = ({
className,
intent,
size,
...props
}: ButtonProps & { className?: string }) => (
<button className={twMerge(buttonVariants({ intent, size, className }))} {...props} />
);