-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(project): download translations
- Loading branch information
Giacomo Materozzi
committed
Mar 11, 2024
1 parent
b8c21dc
commit 5319ac4
Showing
7 changed files
with
397 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import Link from "next/link" | ||
|
||
import i18n from "@/lib/i18n" | ||
import { cn } from "@/lib/utils" | ||
import { buttonVariants } from "@/components/ui/button" | ||
import { | ||
DropdownMenu, | ||
DropdownMenuContent, | ||
DropdownMenuItem, | ||
DropdownMenuSeparator, | ||
DropdownMenuTrigger, | ||
} from "@/components/ui/dropdown-menu" | ||
|
||
import { DownloadFormat } from "../useTranslation" | ||
|
||
type DownloadKeywordsDropdownMenuProps = { | ||
id: string | ||
download: (format: DownloadFormat) => void | ||
} | ||
|
||
export function DownloadKeywordsDropdownMenu( | ||
props: DownloadKeywordsDropdownMenuProps | ||
) { | ||
const { id, download } = props | ||
return ( | ||
<DropdownMenu> | ||
<DropdownMenuTrigger className="mr-4"> | ||
<button | ||
className={cn( | ||
buttonVariants({ variant: "secondary" }), | ||
"outline-none" | ||
)} | ||
> | ||
<span>{i18n.t("Download")}</span> | ||
</button> | ||
</DropdownMenuTrigger> | ||
<DropdownMenuContent align="end"> | ||
<div className="flex items-center justify-start gap-2 p-2"> | ||
<div className="flex flex-col space-y-1 leading-none"> | ||
<p className="truncate text-sm text-muted-foreground"> | ||
{i18n.t("Base url:")} | ||
</p> | ||
<p className="truncate text-sm text-muted-foreground"> | ||
{i18n.t("project.baseurl", { id })} | ||
</p> | ||
</div> | ||
</div> | ||
<DropdownMenuSeparator /> | ||
<DropdownMenuItem | ||
asChild | ||
className="hover:cursor-pointer flex" | ||
onClick={() => { | ||
download(DownloadFormat.json_files) | ||
}} | ||
> | ||
<p>{i18n.t("Download .json files")}</p> | ||
</DropdownMenuItem> | ||
<DropdownMenuItem asChild className="hover:cursor-pointer"> | ||
<Link | ||
target="_blank" | ||
href="https://github.com/Matergi/Translo/pull/27/files" | ||
> | ||
{i18n.t("TS code")} | ||
</Link> | ||
</DropdownMenuItem> | ||
</DropdownMenuContent> | ||
</DropdownMenu> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.