refactor(ui): extract reusable component package
This commit is contained in:
parent
e68eb2efee
commit
78a4e28dd4
85 changed files with 4144 additions and 0 deletions
33
src/components/IconButton.tsx
Normal file
33
src/components/IconButton.tsx
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import type { ButtonHTMLAttributes } from "react";
|
||||
import { IconGlyph } from "./IconGlyph";
|
||||
|
||||
export interface IconButtonProps
|
||||
extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "type"> {
|
||||
icon: string;
|
||||
label: string;
|
||||
active?: boolean;
|
||||
type?: "button" | "submit" | "reset";
|
||||
}
|
||||
|
||||
export function IconButton({
|
||||
icon,
|
||||
label,
|
||||
active = false,
|
||||
disabled = false,
|
||||
type = "button",
|
||||
className = "",
|
||||
...buttonProps
|
||||
}: IconButtonProps) {
|
||||
return (
|
||||
<button
|
||||
{...buttonProps}
|
||||
className={className ? `icon-button ${className} ` : "icon-button "}
|
||||
aria-label={label}
|
||||
data-active={active}
|
||||
disabled={disabled}
|
||||
type={type}
|
||||
>
|
||||
<IconGlyph name={icon} size="sm" />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue