2023-11-14 10:36:15 +00:00
|
|
|
import { Plus } from 'lucide-react';
|
|
|
|
import { ComponentProps, PropsWithChildren } from 'react';
|
2021-11-16 12:33:01 +00:00
|
|
|
|
2023-11-14 10:36:15 +00:00
|
|
|
import { AutomationTestingProps } from '@/types';
|
2022-07-27 13:04:31 +00:00
|
|
|
|
2023-11-14 10:36:15 +00:00
|
|
|
import { Link } from '@@/Link';
|
2021-11-16 12:33:01 +00:00
|
|
|
|
2023-11-14 10:36:15 +00:00
|
|
|
import { Button } from './Button';
|
2021-11-16 12:33:01 +00:00
|
|
|
|
2023-11-14 10:36:15 +00:00
|
|
|
export function AddButton({
|
|
|
|
to = '.new',
|
|
|
|
params,
|
|
|
|
children,
|
|
|
|
color = 'primary',
|
|
|
|
disabled,
|
|
|
|
'data-cy': dataCy,
|
|
|
|
}: PropsWithChildren<
|
|
|
|
{
|
|
|
|
to?: string;
|
|
|
|
params?: object;
|
|
|
|
color?: ComponentProps<typeof Button>['color'];
|
|
|
|
disabled?: boolean;
|
|
|
|
} & AutomationTestingProps
|
|
|
|
>) {
|
2021-11-16 12:33:01 +00:00
|
|
|
return (
|
2023-11-14 10:36:15 +00:00
|
|
|
<Button
|
|
|
|
as={Link}
|
|
|
|
props={{ to, params }}
|
|
|
|
icon={Plus}
|
|
|
|
className="!m-0"
|
|
|
|
data-cy={dataCy}
|
|
|
|
color={color}
|
2022-07-26 19:44:08 +00:00
|
|
|
disabled={disabled}
|
2021-11-16 12:33:01 +00:00
|
|
|
>
|
2023-11-14 10:36:15 +00:00
|
|
|
{children || 'Add'}
|
|
|
|
</Button>
|
2021-11-16 12:33:01 +00:00
|
|
|
);
|
|
|
|
}
|