Skip to content

Commit 6a07e59

Browse files
committed
Add omikuji.
1 parent 0a9938e commit 6a07e59

File tree

18 files changed

+54
-63
lines changed

18 files changed

+54
-63
lines changed

app/omikuji/page.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import Omikuji from '../../components/Omikuji';
2+
3+
export default function OmikujiPage() {
4+
return (
5+
<>
6+
<Omikuji />
7+
</>
8+
);
9+
}

components/Nav.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
import Link from "next/link";
2+
13
export default function Nav() {
24
return (
35
<nav className="bg-main shadow-md fixed w-full top-0 z-50">
46
<div className="container mx-auto px-6 py-4 flex justify-between items-center">
57
<a href="/" className="text-2xl font-bold text-white hover:text-slate-200 transition duration-300">かまずにまるのみどっとこむ</a>
68
<div className="space-x-4 text-white ">
7-
<a href="#profile" className="hover:hover-text-main-light transition duration-300">Profile</a>
8-
<a href="#portfolio" className="hover:hover-text-main-light transition duration-300">Portfolio</a>
9+
<a href="/#profile" className="hover:hover-text-main-light transition duration-300">Profile</a>
10+
<a href="/#portfolio" className="hover:hover-text-main-light transition duration-300">Portfolio</a>
11+
<a href="/omikuji">Omijiku</a>
912
</div>
1013
</div>
1114
</nav>

components/Omikuji.tsx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
'use client';
1+
'use client';
22

3-
import { messages } from '../data/omikuji';
43
import { useState } from 'react';
4+
import { messages, OmikujiResult } from '../data/omikuji';
55

6-
export default function Nav() {
7-
const [result, setResult] = useState<string | null>(null);
6+
export default function Omikuji() {
7+
const [result, setResult] = useState<OmikujiResult | null>(null);
88

99
const drawOmikuji = () => {
10-
const random = messages[Math.floor(Math.random() * messages.length)];
11-
setResult(random);
10+
const rand = messages[Math.floor(Math.random() * messages.length)];
11+
setResult(rand);
1212
};
1313
return (
14-
<main className="flex flex-col items-center justify-center bg-white">
15-
<h1 className="text-3xl font-bold text-main mb-8">おみくじ</h1>
16-
<button
17-
onClick={drawOmikuji}
18-
className="px-6 py-3 bg-main text-white rounded-lg shadow hover:cursor-pointer transition"
19-
>
20-
おみくじを引く
21-
</button>
22-
23-
{result && (
24-
<div className="mt-10">
25-
<p className="text-main">🎉 {result} 🎉 </p>
26-
</div>
27-
)}
14+
<main className="flex flex-col items-center justify-center mt-40 bg-white">
15+
<h1 className="text-3xl font-bold text-main mb-8">おみくじ</h1>
16+
{result ? (
17+
<div className="flex flex-col items-center">
18+
<p className="text-main text-xl">{result.message}</p>
19+
<img src={result.image} alt={result.message} className="w-1/3 mt-8" />
20+
</div>
21+
) : (
22+
<button
23+
onClick={drawOmikuji}
24+
className="px-6 py-3 bg-main text-white rounded-lg shadow hover:cursor-pointer transition">
25+
おみくじを引く
26+
</button>
27+
)}
2828
</main>
2929
)
3030
}

data/omikuji.ts

Lines changed: 20 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,21 @@
1-
import { contents } from "./contents"
1+
export type OmikujiResult = {
2+
message: string;
3+
image: string;
4+
};
25

3-
export const messages = [
4-
// 日本語
5-
"大吉!今日はいい日になりそう!",
6-
// 英語
7-
"Excellent luck! Today is going to be a good day!",
8-
// フランス語
9-
"Très chanceux ! Aujourd'hui sera une bonne journée !",
10-
// ドイツ語
11-
"Großes Glück! Heute wird ein guter Tag!",
12-
// スペイン語
13-
"¡Gran suerte! ¡Hoy será un buen día!",
14-
// イタリア語
15-
"Grande fortuna! Oggi sarà una bella giornata!",
16-
// 中国語(簡体)
17-
"大吉!今天是个好日子!",
18-
// 中国語(繁体)
19-
"大吉!今天會是美好的一天!",
20-
// 韓国語
21-
"대길! 오늘은 좋은 하루가 될 거예요!",
22-
// アラビア語
23-
"حظ عظيم! سيكون اليوم يوماً رائعاً!",
24-
// ヒンディー語
25-
"बहुत शुभ! आज का दिन अच्छा होगा!",
26-
// タイ語
27-
"โชคดีมาก! วันนี้เป็นวันที่ดีแน่นอน!",
28-
// インドネシア語
29-
"Keberuntungan besar! Hari ini akan menjadi hari yang baik!",
30-
// ベトナム語
31-
"May mắn lớn! Hôm nay sẽ là một ngày tốt lành!",
32-
// ポルトガル語
33-
"Grande sorte! Hoje será um bom dia!",
34-
// スウェーデン語
35-
"Stor tur! Idag blir en bra dag!",
36-
// トルコ語
37-
"Büyük şans! Bugün güzel bir gün olacak!",
38-
// フィリピン語(タガログ語)
39-
"Napakaswerte! Magiging maganda ang araw na ito!",
40-
// ウクライナ語
41-
"Велика удача! Сьогодні буде гарний день!"
42-
];
6+
export const messages: OmikujiResult[] = [
7+
{ message: '散歩中ににゃんこに会えるかも', image: '/images/omikuji/nekoniaeru.png' },
8+
{ message: '散歩中のわんこと触れ合えるチャンス', image: '/images/omikuji/sanpowanko.png' },
9+
{ message: 'かわいい小鳥を見かける', image: '/images/omikuji/kawaiikotori.png' },
10+
{ message: 'きれいな玉虫を発見できる可能性が3%上がる', image: '/images/omikuji/tamamushi.png' },
11+
{ message: 'ニホントカゲのこどものしっぽは青くてきらきら', image: '/images/omikuji/nihontokage.png' },
12+
{ message: 'みのむしと目があう', image: '/images/omikuji/minomushi.png' },
13+
{ message: 'お花がきれいだね', image: '/images/omikuji/ohanakirei.png' },
14+
{ message: '大きいわんこ', image: '/images/omikuji/ookiiwanko.png' },
15+
{ message: '食べたおやつがおいしい', image: '/images/omikuji/oishiioyatsu.png' },
16+
{ message: 'おいしいごはん!', image: '/images/omikuji/oishiigohan.png' },
17+
{ message: 'ちょっとかしこさが上がるかも?', image: '/images/omikuji/kashikoi.png' },
18+
{ message: '周りの人たちにやさしくしたいね〜', image: '/images/omikuji/yasashisa.png' },
19+
{ message: 'けんかしてもなかなおり', image: '/images/omikuji/nakanaori.png' },
20+
{ message: 'ふだん見かけない鳥さんと遭遇しそう', image: '/images/omikuji/mezurashiitori.png' },
21+
]

public/images/omikuji/kashikoi.png

130 KB
Loading
221 KB
Loading
119 KB
Loading
127 KB
Loading
183 KB
Loading
158 KB
Loading

0 commit comments

Comments
 (0)