Refactor application structure and simplify implementation

This commit is contained in:
2026-07-22 00:08:09 +03:00
parent dbba3806cc
commit 90b2eb507c
74 changed files with 11362 additions and 6814 deletions
+16 -12
View File
@@ -1,9 +1,12 @@
import type { ButtonHTMLAttributes, ReactNode } from 'react';
import { BusyRing } from './BusyRing';
import type { ButtonHTMLAttributes, ReactNode } from "react";
import { BusyRing } from "./BusyRing";
export type IconButtonVariant = 'neutral' | 'add' | 'danger';
export type IconButtonVariant = "neutral" | "add" | "danger";
export interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'title'> {
export interface IconButtonProps extends Omit<
ButtonHTMLAttributes<HTMLButtonElement>,
"title"
> {
label: string;
icon: ReactNode;
variant?: IconButtonVariant;
@@ -14,25 +17,27 @@ export interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonEle
export function IconButton({
label,
icon,
variant = 'neutral',
variant = "neutral",
loading = false,
tooltip,
className,
disabled,
...props
}: IconButtonProps) {
const tooltipText = tooltip === '' ? undefined : tooltip ?? label;
const tooltipText = tooltip === "" ? undefined : (tooltip ?? label);
const classes = [
'ui-icon-button',
"ui-icon-button",
`ui-icon-button--${variant}`,
loading ? 'is-loading' : '',
className ?? '',
].filter(Boolean).join(' ');
loading ? "is-loading" : "",
className ?? "",
]
.filter(Boolean)
.join(" ");
return (
<button
{...props}
type={props.type ?? 'button'}
type={props.type ?? "button"}
className={classes}
aria-label={label}
data-tooltip={tooltipText}
@@ -44,4 +49,3 @@ export function IconButton({
</button>
);
}