mirror of
https://github.com/yude-jp/yude.jp
synced 2024-12-22 20:20:09 +09:00
Add comments, code organization
This commit is contained in:
parent
95c6b29db0
commit
d9279ee88f
@ -1,12 +1,25 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
// Base layout
|
||||||
import Layout from "./components/Layout"
|
import Layout from "./components/Layout"
|
||||||
import useTranslation from 'next-translate/useTranslation'
|
|
||||||
|
// React Router etc.
|
||||||
|
import React, { useState, useEffect } from 'react';
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import Minecraft from './components/Minecraft'
|
|
||||||
|
// i18n
|
||||||
|
import useTranslation from 'next-translate/useTranslation'
|
||||||
|
|
||||||
|
// Next.js
|
||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
|
import Link from 'next/link'
|
||||||
|
|
||||||
|
// Custom pages
|
||||||
|
import Minecraft from './components/Minecraft'
|
||||||
|
|
||||||
|
// Font Awesome
|
||||||
import { faMap, faCopy } from '@fortawesome/free-solid-svg-icons'
|
import { faMap, faCopy } from '@fortawesome/free-solid-svg-icons'
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||||
import Link from 'next/link'
|
|
||||||
|
// React Markdown
|
||||||
import ReactMarkdown from "react-markdown"
|
import ReactMarkdown from "react-markdown"
|
||||||
import gfm from 'remark-gfm';
|
import gfm from 'remark-gfm';
|
||||||
import ja from '../docs/minecraft/ja.md'
|
import ja from '../docs/minecraft/ja.md'
|
||||||
@ -14,14 +27,19 @@ import en from '../docs/minecraft/en.md'
|
|||||||
|
|
||||||
export default function About(props) {
|
export default function About(props) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
|
// i18n
|
||||||
const { locale, locales, defaultLocale, pathname } = router
|
const { locale, locales, defaultLocale, pathname } = router
|
||||||
const { t, lang } = useTranslation("minecraft")
|
const { t, lang } = useTranslation("minecraft")
|
||||||
|
|
||||||
|
// Copy server address to clipboard
|
||||||
const copyText = () => {
|
const copyText = () => {
|
||||||
navigator.clipboard.writeText("yude.jp");
|
navigator.clipboard.writeText("yude.jp");
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout title={t('title')}>
|
<Layout title={t('title')}>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<p className="my-2 text-3xl text-center">{t('title')}</p>
|
<p className="my-2 text-3xl text-center">{t('title')}</p>
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
@ -33,6 +51,7 @@ export default function About(props) {
|
|||||||
height = {619}
|
height = {619}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<Minecraft />
|
<Minecraft />
|
||||||
<p>
|
<p>
|
||||||
@ -45,19 +64,21 @@ export default function About(props) {
|
|||||||
<FontAwesomeIcon icon={faCopy} className="w-5 h-5 inline"/>
|
<FontAwesomeIcon icon={faCopy} className="w-5 h-5 inline"/>
|
||||||
</button>
|
</button>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>{t('version')}: 1.17</p>
|
<p>{t('version')}: 1.17</p>
|
||||||
|
|
||||||
<Link href="https://bluemap.yude.jp">
|
<Link href="https://bluemap.yude.jp">
|
||||||
<a>
|
<a>
|
||||||
<button
|
<button
|
||||||
className="bg-pink-600 text-white active:bg-pink-600 mt-3 font-bold text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150"
|
className="bg-pink-600 text-white active:bg-pink-600 mt-3 font-bold text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150"
|
||||||
type="button"
|
type="button">
|
||||||
>
|
<FontAwesomeIcon icon={faMap} className="w-5 h-5 inline"/> BlueMap
|
||||||
<FontAwesomeIcon icon={faMap} className="w-5 h-5 inline"/> BlueMap
|
</button>
|
||||||
</button>
|
</a>
|
||||||
</a>
|
</Link>
|
||||||
</Link>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Load markdown contents */}
|
||||||
{lang === 'ja' ? (
|
{lang === 'ja' ? (
|
||||||
<ReactMarkdown plugins={[gfm]} children={ja} />
|
<ReactMarkdown plugins={[gfm]} children={ja} />
|
||||||
) : (
|
) : (
|
||||||
|
Loading…
Reference in New Issue
Block a user