Skip to content

Commit

Permalink
translation notification
Browse files Browse the repository at this point in the history
  • Loading branch information
algasami committed Jun 2, 2024
1 parent e6961b9 commit 9ac5d40
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
18 changes: 15 additions & 3 deletions app/components/postLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Locale } from "i18n-config";
import { getDictionary } from "get-dictionary";
import { Icon } from "@mui/material";
import { CalendarToday, Source } from "@mui/icons-material";
import { Region } from "./region";

export interface PostForPostLayout {
date: string;
Expand Down Expand Up @@ -48,14 +49,12 @@ export default function PostLayout({
<div id="post-publish-date" className="flex flex-col mx-2">
<Icon className="flex flex-row justify-center w-full mb-2">
<CalendarToday color="inherit" />
{dict.date}
</Icon>
<time dateTime={date}>{formatDate(date, locale)}</time>
</div>
<div id="post-source-code" className="flex flex-col mx-2">
<Icon className="flex flex-row justify-center w-full mb-2">
<Source color="inherit" />
{dict.source}(GitHub)
</Icon>
<a
className="dynamic-link"
Expand All @@ -71,7 +70,20 @@ export default function PostLayout({
</div>
</header>

<div className="divide-y divide-gray-200 pt-10 pb-8 transition-colors dark:divide-gray-700">
<div className="flex flex-col">
<div className="flex flex-row justify-center">
<Region color="amber" title="雙語翻譯 Bilingual Translation">
這篇文章支援雙語翻譯,請點擊下方的連結或右上方按鈕切換語言。 This
post supports bilingual translation. Please click the link below
or the button on the top right to switch languages.
<Link
href={`/${locale == "en" ? "zh-tw" : "en"}/posts/${post.slug}`}
className="py-2 px-2 my-2 bg-amber-400 transition-all hover:shadow-lg hover:bg-violet-400 text-zinc-900 rounded-lg w-max font-semibold"
>
前往Go To
</Link>
</Region>
</div>
<PostBody>{children}</PostBody>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/components/region.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function Region({
}) {
return (
<article
className={`rounded-xl mt-5 m-2 xl:mx-3 p-3 flex flex-col border border-gray-700 dark:border-gray-500 dark:shadow-md shadow-lg dark:shadow-zinc-900 dark:hover:shadow-purple-900 hover:shadow-zinc-200 hover:shadow-lg transition-all bg-orange-100 dark:bg-zinc-900 text-zinc-900 dark:text-zinc-50`}
className={`rounded-xl mt-5 m-2 xl:mx-3 p-3 flex flex-col border border-gray-700 dark:border-gray-500 dark:shadow-md shadow-lg dark:shadow-zinc-900 dark:hover:shadow-purple-900 hover:shadow-zinc-200 hover:shadow-lg transition-all bg-orange-100 dark:bg-zinc-900 text-zinc-900 dark:text-zinc-50 font-sans`}
style={{ maxWidth: "700px" }}
>
<span className="flex flex-row justify-between">
Expand Down
4 changes: 0 additions & 4 deletions dictionaries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ export const en = {
meta_description: "Repository for the site's posts.",
next: "Next Post",
last: "Last Post",
date: "Date",
source: "Source",
},
graph: {
title: "Graph",
Expand Down Expand Up @@ -261,8 +259,6 @@ export const zh_tw: typeof en = {
meta_description: "本網站的貼文儲存點。",
next: "下一篇",
last: "上一篇",
date: "日期",
source: "來源",
},
graph: {
title: "圖論",
Expand Down

0 comments on commit 9ac5d40

Please sign in to comment.