@@ -5,13 +5,12 @@ import type { ImageProps, StaticImageData } from "next/image"
55
66import AssetDownloadArtist from "@/components/AssetDownload/AssetDownloadArtist"
77import AssetDownloadImage from "@/components/AssetDownload/AssetDownloadImage"
8+ import { ButtonLink } from "@/components/ui/buttons/Button"
9+ import { Flex , Stack } from "@/components/ui/flex"
810
911import { cn } from "@/lib/utils/cn"
1012import { trackCustomEvent } from "@/lib/utils/matomo"
1113
12- import { ButtonLink } from "../ui/buttons/Button"
13- import { Flex , Stack } from "../ui/flex"
14-
1514import { useTranslation } from "@/hooks/useTranslation"
1615
1716type AssetDownloadProps = {
@@ -41,7 +40,9 @@ const AssetDownload = ({
4140 eventName : title ,
4241 } )
4342 }
43+
4444 const imgSrc = ( image as StaticImageData ) . src
45+ const fileExtension = extname ( imgSrc ) . slice ( 1 )
4546
4647 return (
4748 < Stack
@@ -56,12 +57,19 @@ const AssetDownload = ({
5657 ) }
5758 </ div >
5859 < Flex className = "mt-4 gap-5" >
59- < ButtonLink href = { imgSrc } onClick = { matomoHandler } target = "_blank" >
60- { t ( "page-assets-download-download" ) } (
61- { extname ( imgSrc ) . slice ( 1 ) . toUpperCase ( ) } )
60+ < ButtonLink
61+ href = { imgSrc }
62+ onClick = { matomoHandler }
63+ download = { `${ title . replace ( / \s + / g, "-" ) . toLowerCase ( ) } .${ fileExtension } ` }
64+ >
65+ { t ( "page-assets-download-download" ) } ({ fileExtension . toUpperCase ( ) } )
6266 </ ButtonLink >
6367 { svgUrl && (
64- < ButtonLink href = { svgUrl } onClick = { matomoHandler } target = "_blank" >
68+ < ButtonLink
69+ href = { svgUrl }
70+ onClick = { matomoHandler }
71+ download = { `${ title . replace ( / \s + / g, "-" ) . toLowerCase ( ) } .svg` }
72+ >
6573 { t ( "page-assets-download-download" ) } (SVG)
6674 </ ButtonLink >
6775 ) }
0 commit comments