mirror of
https://github.com/docmost/docmost.git
synced 2025-11-18 12:01:12 +10:00
19 lines
495 B
TypeScript
19 lines
495 B
TypeScript
import { ReactNode } from 'react';
|
|
import { Button } from '@/components/ui/button';
|
|
|
|
interface ButtonIconProps {
|
|
icon: ReactNode;
|
|
children?: ReactNode;
|
|
}
|
|
|
|
type Props = ButtonIconProps & React.ComponentPropsWithoutRef<typeof Button>;
|
|
|
|
export default function ButtonWithIcon({ icon, children, ...rest }: Props) {
|
|
return (
|
|
<Button {...rest} {...(children ? {} : { size: 'icon' })}>
|
|
<div className={`${children ? 'mr-[8px]' : ''}`}>{icon}</div>
|
|
{children}
|
|
</Button>
|
|
);
|
|
}
|