Fix bug pull request #28
@@ -1,41 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import type { ButtonProps } from "./Button.types";
|
|
||||||
|
|
||||||
export default function IconButton({
|
|
||||||
variant = "primary",
|
|
||||||
size = "md",
|
|
||||||
icon,
|
|
||||||
disabled = false,
|
|
||||||
className = "",
|
|
||||||
children,
|
|
||||||
...props
|
|
||||||
}: ButtonProps) {
|
|
||||||
const baseStyles =
|
|
||||||
"font-semibold rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center justify-center";
|
|
||||||
|
|
||||||
const variants = {
|
|
||||||
primary:
|
|
||||||
"bg-(--color-primary) text-white hover:bg-(--color-primary-dark) active:scale-95",
|
|
||||||
secondary:
|
|
||||||
"border border-(--color-border) hover:bg-(--color-border-light) active:scale-95",
|
|
||||||
danger: "bg-red-500 text-white hover:bg-red-600 active:scale-95",
|
|
||||||
ghost: "bg-transparent hover:bg-(--color-border-light) active:scale-95",
|
|
||||||
};
|
|
||||||
|
|
||||||
const sizes = {
|
|
||||||
sm: "h-8 w-8 text-sm",
|
|
||||||
md: "h-10 w-10 text-base",
|
|
||||||
lg: "h-12 w-12 text-lg",
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<button
|
|
||||||
className={`${baseStyles} ${variants[variant]} ${sizes[size]} ${className}`}
|
|
||||||
disabled={disabled}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
{icon ? <i className={`fa-solid ${icon}`}></i> : children}
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,2 @@
|
|||||||
export { default as Button } from "./Button";
|
export { default as Button } from "./Button";
|
||||||
export { default as IconButton } from "./IconButton";
|
|
||||||
export type { ButtonProps } from "./Button.types";
|
export type { ButtonProps } from "./Button.types";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// Buttons
|
// Buttons
|
||||||
export { Button, IconButton } from "./buttons";
|
export { Button } from "./buttons";
|
||||||
export type { ButtonProps } from "./buttons";
|
export type { ButtonProps } from "./buttons";
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
|
|||||||
Reference in New Issue
Block a user