FIXED: Interfaces

This commit is contained in:
2024-02-01 22:24:37 +04:00
parent ab4ae37015
commit 218b8f61d6
20 changed files with 163 additions and 137 deletions

View File

@@ -5,6 +5,7 @@ import { ButtonLayout } from '../button-layout/button-layout';
import { IconButtonProps, StateToggleIconType } from './icon-button.types';
import {
forwardRef,
MouseEventHandler,
useCallback,
useImperativeHandle,
useRef,
@@ -44,7 +45,7 @@ export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
const buttonRef = useRef<HTMLButtonElement>(null);
const callback = useCallback(
(e: MouseEvent) => {
(event: MouseEventHandler<HTMLButtonElement>) => {
if (toggled) {
if (toggleIcon.state === 'selected') {
toggle('', toggled.unselected ?? 'add_circle');
@@ -53,7 +54,7 @@ export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
}
}
if (props.onClick) {
props.onClick.apply(null, e);
props.onClick.apply(null, event);
}
},
[toggleIcon],
@@ -72,7 +73,7 @@ export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
variant={variant ? variant : 'default'}
>
<Icon
fill={toggleIcon.state === 'selected' ? 1 : 0}
fillIcon={toggleIcon.state === 'selected' ? 1 : 0}
iconSize={28}
svgSize={40}
>