Skip to content

Commit 24bdb60

Browse files
committed
add svg download
1 parent 8e61036 commit 24bdb60

File tree

2 files changed

+119
-2
lines changed

2 files changed

+119
-2
lines changed

src/components/AssetDownload/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const AssetDownload = ({
2626
artistName,
2727
artistUrl,
2828
image,
29+
svgUrl,
2930
title,
3031
...props
3132
}: AssetDownloadProps) => {
@@ -67,11 +68,11 @@ const AssetDownload = ({
6768
{extname(imgSrc).slice(1).toUpperCase()})
6869
</ButtonLink>
6970
{/* Disables SVG due to bug: https://github.com/ethereum/ethereum-org-website/issues/12267 */}
70-
{/* {svgUrl && (
71+
{svgUrl && (
7172
<ButtonLink href={svgUrl} onClick={matomoHandler} target="_blank">
7273
{t("page-assets-download-download")} (SVG)
7374
</ButtonLink>
74-
)} */}
75+
)}
7576
</Flex>
7677
</Flex>
7778
)

src/components/ui/drawer.tsx

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
import * as React from "react"
2+
import { Drawer as DrawerPrimitive } from "vaul"
3+
4+
import { cn } from "@/lib/utils/cn"
5+
6+
const Drawer = ({
7+
shouldScaleBackground = true,
8+
...props
9+
}: React.ComponentProps<typeof DrawerPrimitive.Root>) => (
10+
<DrawerPrimitive.Root
11+
shouldScaleBackground={shouldScaleBackground}
12+
{...props}
13+
/>
14+
)
15+
Drawer.displayName = "Drawer"
16+
17+
const DrawerTrigger = DrawerPrimitive.Trigger
18+
19+
const DrawerPortal = DrawerPrimitive.Portal
20+
21+
const DrawerClose = DrawerPrimitive.Close
22+
23+
const DrawerOverlay = React.forwardRef<
24+
React.ElementRef<typeof DrawerPrimitive.Overlay>,
25+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
26+
>(({ className, ...props }, ref) => (
27+
<DrawerPrimitive.Overlay
28+
ref={ref}
29+
className={cn("fixed inset-0 z-50 bg-black/80", className)}
30+
{...props}
31+
/>
32+
))
33+
DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName
34+
35+
const DrawerContent = React.forwardRef<
36+
React.ElementRef<typeof DrawerPrimitive.Content>,
37+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
38+
>(({ className, children, ...props }, ref) => (
39+
<DrawerPortal>
40+
<DrawerOverlay />
41+
<DrawerPrimitive.Content
42+
ref={ref}
43+
className={cn(
44+
"fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
45+
className
46+
)}
47+
{...props}
48+
>
49+
<div className="bg-muted mx-auto mt-4 h-2 w-[100px] rounded-full" />
50+
{children}
51+
</DrawerPrimitive.Content>
52+
</DrawerPortal>
53+
))
54+
DrawerContent.displayName = "DrawerContent"
55+
56+
const DrawerHeader = ({
57+
className,
58+
...props
59+
}: React.HTMLAttributes<HTMLDivElement>) => (
60+
<div
61+
className={cn("grid gap-1.5 p-4 text-center sm:text-left", className)}
62+
{...props}
63+
/>
64+
)
65+
DrawerHeader.displayName = "DrawerHeader"
66+
67+
const DrawerFooter = ({
68+
className,
69+
...props
70+
}: React.HTMLAttributes<HTMLDivElement>) => (
71+
<div
72+
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
73+
{...props}
74+
/>
75+
)
76+
DrawerFooter.displayName = "DrawerFooter"
77+
78+
const DrawerTitle = React.forwardRef<
79+
React.ElementRef<typeof DrawerPrimitive.Title>,
80+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
81+
>(({ className, ...props }, ref) => (
82+
<DrawerPrimitive.Title
83+
ref={ref}
84+
className={cn(
85+
"text-lg font-semibold leading-none tracking-tight",
86+
className
87+
)}
88+
{...props}
89+
/>
90+
))
91+
DrawerTitle.displayName = DrawerPrimitive.Title.displayName
92+
93+
const DrawerDescription = React.forwardRef<
94+
React.ElementRef<typeof DrawerPrimitive.Description>,
95+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
96+
>(({ className, ...props }, ref) => (
97+
<DrawerPrimitive.Description
98+
ref={ref}
99+
className={cn("text-muted-foreground text-sm", className)}
100+
{...props}
101+
/>
102+
))
103+
DrawerDescription.displayName = DrawerPrimitive.Description.displayName
104+
105+
export {
106+
Drawer,
107+
DrawerClose,
108+
DrawerContent,
109+
DrawerDescription,
110+
DrawerFooter,
111+
DrawerHeader,
112+
DrawerOverlay,
113+
DrawerPortal,
114+
DrawerTitle,
115+
DrawerTrigger,
116+
}

0 commit comments

Comments
 (0)