Skip to content

Commit

Permalink
feat(client): Hide download button instead of disabling
Browse files Browse the repository at this point in the history
  • Loading branch information
clementprdhomme committed Nov 13, 2024
1 parent f222ae8 commit f69a833
Showing 1 changed file with 15 additions and 23 deletions.
38 changes: 15 additions & 23 deletions client/src/components/dataset-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,29 +186,21 @@ const DatasetCard = ({ id, name, defaultLayerId, layers }: DatasetCardProps) =>
{name}
</Label>
<div className="flex items-center gap-0.5 pt-1">
<Button
variant="ghost"
size="icon-sm"
className={cn({
"group/download": true,
"pointer-events-none opacity-20": !selectedLayer?.attributes!.download_link,
})}
aria-disabled={!selectedLayer?.attributes!.download_link}
tabIndex={!selectedLayer?.attributes!.download_link ? -1 : undefined}
asChild
>
<Link
href={selectedLayer?.attributes!.download_link ?? ""}
rel="noopener noreferrer"
download={selectedLayer?.attributes!.name}
>
<span className="sr-only">Download</span>
<DownloadIcon
className="!size-4 transition-colors group-hover/download:text-casper-blue-300"
aria-hidden
/>
</Link>
</Button>
{!!selectedLayer?.attributes!.download_link && (
<Button variant="ghost" size="icon-sm" className="group/download" asChild>
<Link
href={selectedLayer?.attributes!.download_link ?? ""}
rel="noopener noreferrer"
download={selectedLayer?.attributes!.name}
>
<span className="sr-only">Download</span>
<DownloadIcon
className="!size-4 transition-colors group-hover/download:text-casper-blue-300"
aria-hidden
/>
</Link>
</Button>
)}
<Switch
id={`dataset-${id}-toggle`}
checked={isDatasetActive}
Expand Down

0 comments on commit f69a833

Please sign in to comment.