Skip to content

Commit

Permalink
feat: Add spinner to download button
Browse files Browse the repository at this point in the history
  • Loading branch information
maximeperrault authored and maximeperraultdev committed Dec 2, 2024
1 parent aef60b5 commit be5dcc8
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,22 @@ export function GeneratePdfButton({ dashboard }: GeneratePdfButtonProps) {
}

return (
<StyledLinkButton disabled={pdf.loading} Icon={Icon.Document} onClick={handleDownload}>
<StyledLinkButton disabled={pdf.loading} Icon={pdf.loading ? Icon.Reset : Icon.Document} onClick={handleDownload}>
{pdf.loading ? 'Chargement du brief' : 'Générer un brief'}
</StyledLinkButton>
)
}

const StyledLinkButton = styled(Button)``
const StyledLinkButton = styled(Button)`
${p =>
p.disabled &&
`@keyframes spin {
to {
transform: rotate(360deg);
}
}
> .Element-IconBox > svg {
animation: spin 2s linear infinite;
transform-origin: center;
}`}
`

0 comments on commit be5dcc8

Please sign in to comment.