mirror of
https://github.com/ershisan99/ui-kit-int.git
synced 2025-12-16 12:34:05 +00:00
33 lines
681 B
TypeScript
33 lines
681 B
TypeScript
import type { ComponentPropsWithoutRef, ElementType } from "react";
|
|
|
|
import s from "./button.module.scss";
|
|
import clsx from "clsx";
|
|
|
|
export type ButtonProps<T extends ElementType = "button"> = {
|
|
variant?: "primary" | "secondary" | "outlined";
|
|
fullWidth?: boolean;
|
|
as?: T;
|
|
} & ComponentPropsWithoutRef<T>;
|
|
|
|
export function Button<T extends ElementType = "button">({
|
|
className,
|
|
variant = "primary",
|
|
fullWidth = false,
|
|
as,
|
|
...rest
|
|
}: ButtonProps<T>) {
|
|
const Component = as ?? "button";
|
|
|
|
return (
|
|
<Component
|
|
{...rest}
|
|
className={clsx(
|
|
s.button,
|
|
s[variant],
|
|
fullWidth && s.fullWidth,
|
|
className,
|
|
)}
|
|
/>
|
|
);
|
|
}
|