mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-14 04:20:07 +02:00
add initial files
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import React, { ReactNode } from 'react';
|
||||
import { ActionIcon, ActionIconProps, TooltipProps } from '@mantine/core';
|
||||
import { Tooltip } from '../tooltip/Tooltip';
|
||||
|
||||
type MantineIconButtonProps = ActionIconProps &
|
||||
React.ComponentPropsWithoutRef<'button'>;
|
||||
|
||||
interface IconButtonProps extends MantineIconButtonProps {
|
||||
active?: boolean;
|
||||
icon: ReactNode;
|
||||
tooltip?: Omit<TooltipProps, 'children'>;
|
||||
}
|
||||
|
||||
export const IconButton = ({
|
||||
active,
|
||||
tooltip,
|
||||
icon,
|
||||
...rest
|
||||
}: IconButtonProps) => {
|
||||
if (tooltip) {
|
||||
return (
|
||||
<Tooltip {...tooltip}>
|
||||
<ActionIcon {...rest}>{icon}</ActionIcon>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
return <ActionIcon {...rest}>{icon}</ActionIcon>;
|
||||
};
|
||||
|
||||
IconButton.defaultProps = {
|
||||
active: false,
|
||||
tooltip: undefined,
|
||||
};
|
||||
Reference in New Issue
Block a user