mirror of
https://github.com/ershisan99/ui-kit-int.git
synced 2025-12-18 12:34:08 +00:00
Initial commit
This commit is contained in:
32
src/components/button/button.tsx
Normal file
32
src/components/button/button.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
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,
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user