mirror of
https://github.com/abhijithvijayan/web-extension-starter.git
synced 2026-01-30 09:48:12 +01:00
39 lines
875 B
TypeScript
39 lines
875 B
TypeScript
import * as React from "react";
|
|
import type { FC, ReactNode, ButtonHTMLAttributes } from "react";
|
|
import styles from "./Button.module.scss";
|
|
|
|
type ButtonVariant = "primary" | "secondary" | "settings" | "github" | "support";
|
|
type ButtonSize = "small" | "medium" | "large";
|
|
|
|
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
variant?: ButtonVariant;
|
|
size?: ButtonSize;
|
|
fullWidth?: boolean;
|
|
children: ReactNode;
|
|
}
|
|
|
|
export const Button: FC<ButtonProps> = ({
|
|
variant = "primary",
|
|
size = "medium",
|
|
fullWidth = false,
|
|
children,
|
|
className,
|
|
...props
|
|
}) => {
|
|
const classNames = [
|
|
styles.button,
|
|
styles[variant],
|
|
styles[size],
|
|
fullWidth && styles.fullWidth,
|
|
className,
|
|
]
|
|
.filter(Boolean)
|
|
.join(" ");
|
|
|
|
return (
|
|
<button type="button" className={classNames} {...props}>
|
|
{children}
|
|
</button>
|
|
);
|
|
};
|