Skip to content

Commit 3e3a61c

Browse files
authored
feat: Webサイトのページに原文へのリンクを追加 (#227)
1 parent c614591 commit 3e3a61c

File tree

4 files changed

+62
-3
lines changed

4 files changed

+62
-3
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
export const WorldIcon = () => {
2+
return (
3+
<svg
4+
xmlns="http://www.w3.org/2000/svg"
5+
viewBox="0 0 24 24"
6+
fill="none"
7+
stroke="currentColor"
8+
stroke-width="2"
9+
stroke-linecap="round"
10+
stroke-linejoin="round"
11+
class="icon icon-tabler icons-tabler-outline icon-tabler-world"
12+
role="graphics-symbol"
13+
>
14+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
15+
<path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0" />
16+
<path d="M3.6 9h16.8" />
17+
<path d="M3.6 15h16.8" />
18+
<path d="M11.5 3a17 17 0 0 0 0 18" />
19+
<path d="M12.5 3a17 17 0 0 1 0 18" />
20+
</svg>
21+
);
22+
};

website/src/components/icons/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export { MenuIcon } from "./MenuIcon";
1111
export { CloseIcon } from "./CloseIcon";
1212
export { SearchIcon } from "./SearchIcon";
1313
export { LanguageIcon } from "./LanguageIcon";
14+
export { WorldIcon } from "./WorldIcon";
1415

1516
// Simple Icons
1617
// https://simpleicons.org/

website/src/components/templates/BaseTemplate.tsx

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
ChevronRightIcon,
88
CloseIcon,
99
InfoCircleIcon,
10+
WorldIcon,
1011
} from "../icons";
1112
import {
1213
Breadcrumbs,
@@ -176,14 +177,49 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
176177
<main class="flex-1 flex flex-col px-3.5 py-4 mb-8">
177178
<Breadcrumbs path={path} />
178179

179-
<div class="mt-4">
180+
<div class="flex flex-col gap-2 my-4">
180181
<TranslationStatusAlert status={translationStatus} />
181182
</div>
182183

183-
<div class="prose max-w-none w-full mt-6 flex-grow">
184+
{translationStatus !== "community" && (
185+
<div class="flex">
186+
<a
187+
href={`https://typst.app${route}`}
188+
target="_blank"
189+
rel="noopener noreferrer"
190+
class="inline-flex items-center text-sm underline text-gray-400 hover:text-gray-600 transition-colors"
191+
>
192+
<div class="w-4 h-4 mr-1 ">
193+
<WorldIcon />
194+
</div>
195+
原文(英語)を開く
196+
</a>
197+
</div>
198+
)}
199+
200+
<div class="prose max-w-none w-full my-6 flex-grow">
184201
{children}
185202
</div>
186203

204+
{translationStatus !== "community" && (
205+
<a
206+
href={`https://typst.app${route}`}
207+
target="_blank"
208+
rel="noopener noreferrer"
209+
class="group inline-flex items-center px-3 py-2 rounded-md border border-gray-200 bg-white hover:border-gray-500 hover:bg-gray-50 transition-all duration-200 w-fit"
210+
>
211+
<div class="w-4 h-4 mr-2 text-gray-600 transition-colors">
212+
<WorldIcon />
213+
</div>
214+
<span class="text-sm font-medium text-gray-800 group-hover:text-gray-900 transition-colors">
215+
原文(英語)を開く
216+
</span>
217+
<div class="w-4 h-4 ml-2 text-gray-400 transition-colors">
218+
<ChevronRightIcon />
219+
</div>
220+
</a>
221+
)}
222+
187223
{route === "/docs/" ? (
188224
<div class="doc-categories grid grid-cols-1 md:grid-cols-2 gap-6 mt-8">
189225
<a

website/src/components/ui/common/TranslationStatusAlert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const TranslationStatusAlert: FC<TranslationStatusAlertProps> = ({
6767
return (
6868
<div
6969
class={twMerge(
70-
"border rounded-md p-4 mb-6",
70+
"border rounded-md p-4",
7171
config.bgColor,
7272
config.borderColor,
7373
config.textColor,

0 commit comments

Comments
 (0)