Skip to content

Commit 76ffd99

Browse files
add download buttons
1 parent 958578c commit 76ffd99

File tree

1 file changed

+43
-14
lines changed

1 file changed

+43
-14
lines changed

src/features/common/components/context-menu/context-menu.tsx

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
"use client";
22

3-
import React, { FC, useState } from "react";
3+
import React, { FC } from "react";
44
import { BrandDictionaryModel } from "@/features/localization/models/brand-dictionary.model";
55
import styles from "./context-menu.module.scss";
66
import jwtLogoString from "@/public/img/jwt-logo.svg?raw";
77
import jwtSymbolString from "@/public/img/jwt-symbol.svg?raw";
8-
import jwtWordmark from "@/public/img/jwt-wordmark.svg?raw";
8+
import jwtWordmarkString from "@/public/img/jwt-wordmark.svg?raw";
9+
import { Button } from "react-aria-components";
910

1011
interface ContextMenuProps {
1112
dictionary: BrandDictionaryModel;
1213
position: { x: number; y: number } | null;
1314
setIsCopied: (value: React.SetStateAction<boolean>) => void;
1415
}
1516

16-
const ContextMenu: FC<ContextMenuProps> = ({ dictionary, position, setIsCopied }) => {
17+
const ContextMenu: FC<ContextMenuProps> = ({
18+
dictionary,
19+
position,
20+
setIsCopied,
21+
}) => {
1722
if (!position) return null;
1823

1924
const handleIconCopy = async (svgString: string) => {
@@ -35,29 +40,53 @@ const ContextMenu: FC<ContextMenuProps> = ({ dictionary, position, setIsCopied }
3540
style={{ top: position.y, left: position.x }}
3641
>
3742
<div className={styles.groupLabel}>{dictionary.menu.brand.label}</div>
38-
<ul className={styles.list}>
39-
<li
43+
<div className={styles.list}>
44+
<Button
4045
className={styles.menuItem}
41-
onClick={() => handleIconCopy(jwtLogoString)}
46+
onPress={() => handleIconCopy(jwtLogoString)}
4247
>
4348
<div>icon</div>
4449
<span>{dictionary.menu.brand.svg.copyLabel}</span>
45-
</li>
46-
<li
50+
</Button>
51+
<a
4752
className={styles.menuItem}
48-
onClick={() => handleIconCopy(jwtSymbolString)}
53+
href="/img/jwt-logo.svg"
54+
download="jwt-logo.svg"
55+
>
56+
<div>icon</div>
57+
{dictionary.menu.brand.svg.downloadLabel}
58+
</a>
59+
<Button
60+
className={styles.menuItem}
61+
onPress={() => handleIconCopy(jwtSymbolString)}
4962
>
5063
<div>icon</div>
5164
<span>{dictionary.menu.brand.symbol.copyLabel}</span>
52-
</li>
53-
<li
65+
</Button>
66+
<a
5467
className={styles.menuItem}
55-
onClick={() => handleIconCopy(jwtWordmark)}
68+
href="/img/jwt-symbol.svg"
69+
download="jwt-symbol.svg"
70+
>
71+
<div>icon</div>
72+
{dictionary.menu.brand.symbol.downloadLabel}
73+
</a>
74+
<Button
75+
className={styles.menuItem}
76+
onPress={() => handleIconCopy(jwtWordmarkString)}
5677
>
5778
<div>icon</div>
5879
<span>{dictionary.menu.brand.wordmark.copyLabel}</span>
59-
</li>
60-
</ul>
80+
</Button>
81+
<a
82+
className={styles.menuItem}
83+
href="/img/jwt-wordmark.svg"
84+
download="jwt-wordmark.svg"
85+
>
86+
<div>icon</div>
87+
{dictionary.menu.brand.wordmark.downloadLabel}
88+
</a>
89+
</div>
6190
</div>
6291
);
6392
};

0 commit comments

Comments
 (0)