1
1
import { extname } from "path"
2
2
3
- import type { StaticImageData } from "next/image"
3
+ import { BaseHTMLAttributes } from "react"
4
+ import type { ImageProps , StaticImageData } from "next/image"
4
5
import { useTranslation } from "next-i18next"
5
- import { Box , Flex , type FlexProps } from "@chakra-ui/react"
6
6
7
7
import AssetDownloadArtist from "@/components/AssetDownload/AssetDownloadArtist"
8
8
import AssetDownloadImage from "@/components/AssetDownload/AssetDownloadImage"
9
- import { ButtonLink } from "@/components/Buttons"
10
- import type { ImageProps } from "@/components/Image"
11
- import OldHeading from "@/components/OldHeading"
12
9
10
+ import { cn } from "@/lib/utils/cn"
13
11
import { trackCustomEvent } from "@/lib/utils/matomo"
14
12
13
+ import { ButtonLink } from "../ui/buttons/Button"
14
+ import { Flex , Stack } from "../ui/flex"
15
+
15
16
type AssetDownloadProps = {
16
17
title : string
17
18
alt : string
18
19
artistName ?: string
19
20
artistUrl ?: string
20
21
image : ImageProps [ "src" ]
21
22
svgUrl ?: string
22
- } & FlexProps
23
+ } & BaseHTMLAttributes < HTMLDivElement > & { asChild ?: boolean }
23
24
24
25
const AssetDownload = ( {
25
26
alt,
@@ -28,6 +29,7 @@ const AssetDownload = ({
28
29
image,
29
30
svgUrl,
30
31
title,
32
+ className,
31
33
...props
32
34
} : AssetDownloadProps ) => {
33
35
const { t } = useTranslation ( [ "page-assets" ] )
@@ -41,23 +43,18 @@ const AssetDownload = ({
41
43
const imgSrc = ( image as StaticImageData ) . src
42
44
43
45
return (
44
- < Flex
45
- flexDirection = "column"
46
- justifyContent = "space-between"
47
- m = { 4 }
48
- p = { 0 }
46
+ < Stack
47
+ className = { cn ( "m-4 justify-between gap-0 p-0" , className ) }
49
48
{ ...props }
50
49
>
51
- < OldHeading as = "h4" fontSize = { { base : "md" , md : "xl" } } fontWeight = "500" >
52
- { title }
53
- </ OldHeading >
54
- < Box >
50
+ < h4 className = "my-8 text-md font-medium md:text-xl" > { title } </ h4 >
51
+ < div >
55
52
< AssetDownloadImage image = { image } alt = { alt } />
56
53
{ artistName && (
57
54
< AssetDownloadArtist artistName = { artistName } artistUrl = { artistUrl } />
58
55
) }
59
- </ Box >
60
- < Flex gap = { 5 } mt = { 4 } >
56
+ </ div >
57
+ < Flex className = "mt-4 gap-5" >
61
58
< ButtonLink
62
59
href = { imgSrc }
63
60
onClick = { matomoHandler }
@@ -73,7 +70,7 @@ const AssetDownload = ({
73
70
</ ButtonLink >
74
71
) }
75
72
</ Flex >
76
- </ Flex >
73
+ </ Stack >
77
74
)
78
75
}
79
76
0 commit comments