Skip to content

Commit 7539def

Browse files
committed
feat: migrate AssetDownload to tailwind
1 parent e4d547f commit 7539def

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

src/components/AssetDownload/index.tsx

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
import { extname } from "path"
22

3-
import type { StaticImageData } from "next/image"
3+
import { BaseHTMLAttributes } from "react"
4+
import type { ImageProps, StaticImageData } from "next/image"
45
import { useTranslation } from "next-i18next"
5-
import { Box, Flex, type FlexProps } from "@chakra-ui/react"
66

77
import AssetDownloadArtist from "@/components/AssetDownload/AssetDownloadArtist"
88
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"
129

10+
import { cn } from "@/lib/utils/cn"
1311
import { trackCustomEvent } from "@/lib/utils/matomo"
1412

13+
import { ButtonLink } from "../ui/buttons/Button"
14+
import { Flex, Stack } from "../ui/flex"
15+
1516
type AssetDownloadProps = {
1617
title: string
1718
alt: string
1819
artistName?: string
1920
artistUrl?: string
2021
image: ImageProps["src"]
2122
svgUrl?: string
22-
} & FlexProps
23+
} & BaseHTMLAttributes<HTMLDivElement> & { asChild?: boolean }
2324

2425
const AssetDownload = ({
2526
alt,
@@ -28,6 +29,7 @@ const AssetDownload = ({
2829
image,
2930
svgUrl,
3031
title,
32+
className,
3133
...props
3234
}: AssetDownloadProps) => {
3335
const { t } = useTranslation(["page-assets"])
@@ -41,23 +43,18 @@ const AssetDownload = ({
4143
const imgSrc = (image as StaticImageData).src
4244

4345
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)}
4948
{...props}
5049
>
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>
5552
<AssetDownloadImage image={image} alt={alt} />
5653
{artistName && (
5754
<AssetDownloadArtist artistName={artistName} artistUrl={artistUrl} />
5855
)}
59-
</Box>
60-
<Flex gap={5} mt={4}>
56+
</div>
57+
<Flex className="mt-4 gap-5">
6158
<ButtonLink
6259
href={imgSrc}
6360
onClick={matomoHandler}
@@ -73,7 +70,7 @@ const AssetDownload = ({
7370
</ButtonLink>
7471
)}
7572
</Flex>
76-
</Flex>
73+
</Stack>
7774
)
7875
}
7976

0 commit comments

Comments
 (0)