Added handleExport as parameter of header and added button to export

This commit is contained in:
Lucas Oliveira 2024-06-06 14:37:30 -03:00
commit 5b1de707fa

View file

@ -8,6 +8,7 @@ type HeaderComponentProps = {
handleSelectAll: (select) => void; handleSelectAll: (select) => void;
handleDelete: () => void; handleDelete: () => void;
handleDuplicate: () => void; handleDuplicate: () => void;
handleExport: () => void;
disableFunctions: boolean; disableFunctions: boolean;
}; };
@ -15,6 +16,7 @@ const HeaderComponent = ({
handleSelectAll, handleSelectAll,
handleDelete, handleDelete,
handleDuplicate, handleDuplicate,
handleExport,
disableFunctions, disableFunctions,
}: HeaderComponentProps) => { }: HeaderComponentProps) => {
const [shouldSelectAll, setShouldSelectAll] = useState(true); const [shouldSelectAll, setShouldSelectAll] = useState(true);
@ -49,6 +51,24 @@ const HeaderComponent = ({
</a> </a>
</div> </div>
<div className="col-span-2 flex grid-cols-1 gap-2 justify-self-end"> <div className="col-span-2 flex grid-cols-1 gap-2 justify-self-end">
<div>
<ShadTooltip
content={
disableFunctions ? (
<span>Select items to export</span>
) : (
<span>Export selected items</span>
)
}
>
<button onClick={handleExport} disabled={disableFunctions}>
<IconComponent
name="FileDown"
className={cn("h-5 w-5 text-primary transition-all")}
/>
</button>
</ShadTooltip>
</div>
<div> <div>
<ShadTooltip <ShadTooltip
content={ content={
@ -82,7 +102,7 @@ const HeaderComponent = ({
name="Trash2" name="Trash2"
className={cn( className={cn(
"h-5 w-5 text-primary transition-all", "h-5 w-5 text-primary transition-all",
disableFunctions ? "" : "hover:text-destructive" disableFunctions ? "" : "hover:text-destructive",
)} )}
/> />
</button> </button>