firstCommit
36
README.md
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
First, run the development server:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
# or
|
||||||
|
yarn dev
|
||||||
|
# or
|
||||||
|
pnpm dev
|
||||||
|
# or
|
||||||
|
bun dev
|
||||||
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||||
|
|
||||||
|
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||||
|
|
||||||
|
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
||||||
|
|
||||||
|
## Learn More
|
||||||
|
|
||||||
|
To learn more about Next.js, take a look at the following resources:
|
||||||
|
|
||||||
|
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||||
|
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||||
|
|
||||||
|
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
||||||
|
|
||||||
|
## Deploy on Vercel
|
||||||
|
|
||||||
|
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||||
|
|
||||||
|
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
||||||
4
autoUp.sh
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
cd /var/www/basecafe-cms;
|
||||||
|
npx directus start &&
|
||||||
|
cd /var/www/basecafe
|
||||||
|
npm run dev
|
||||||
25
eslint.config.mjs
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
import { dirname } from "path";
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
|
import { FlatCompat } from "@eslint/eslintrc";
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = dirname(__filename);
|
||||||
|
|
||||||
|
const compat = new FlatCompat({
|
||||||
|
baseDirectory: __dirname,
|
||||||
|
});
|
||||||
|
|
||||||
|
const eslintConfig = [
|
||||||
|
...compat.extends("next/core-web-vitals", "next/typescript"),
|
||||||
|
{
|
||||||
|
ignores: [
|
||||||
|
"node_modules/**",
|
||||||
|
".next/**",
|
||||||
|
"out/**",
|
||||||
|
"build/**",
|
||||||
|
"next-env.d.ts",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default eslintConfig;
|
||||||
6
next-env.d.ts
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
/// <reference types="next" />
|
||||||
|
/// <reference types="next/image-types/global" />
|
||||||
|
/// <reference path="./.next/types/routes.d.ts" />
|
||||||
|
|
||||||
|
// NOTE: This file should not be edited
|
||||||
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||||
22
next.config.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
import type { NextConfig } from "next";
|
||||||
|
|
||||||
|
const nextConfig: NextConfig = {
|
||||||
|
transpilePackages: ["@directus/sdk"],
|
||||||
|
images: {
|
||||||
|
remotePatterns: [
|
||||||
|
{
|
||||||
|
protocol: "http",
|
||||||
|
hostname: "cms.basecafe.jp", // Directus の IP
|
||||||
|
port: "8050",
|
||||||
|
pathname: "/assets/**",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
protocol: "https",
|
||||||
|
hostname: "cms.basecafe.jp", // 将来 SSL 化した場合用
|
||||||
|
pathname: "/assets/**",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default nextConfig;
|
||||||
8563
package-lock.json
generated
Normal file
7
postcss.config.js
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
const config = {
|
||||||
|
plugins: {
|
||||||
|
"@tailwindcss/postcss": {},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
BIN
public/dummy_thumb.png
Normal file
|
After Width: | Height: | Size: 93 KiB |
1
public/file.svg
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>
|
||||||
|
After Width: | Height: | Size: 391 B |
1
public/globe.svg
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>
|
||||||
|
After Width: | Height: | Size: 1.0 KiB |
BIN
public/mainimg.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
1
public/next.svg
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
22
public/robot.txt
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
# robots.txt for https://basecafe.jp
|
||||||
|
# 最終更新日: 2025-10-27
|
||||||
|
# 管理: BaseCafe Webサービス運営チーム
|
||||||
|
|
||||||
|
User-agent: *
|
||||||
|
Disallow: /api/
|
||||||
|
Disallow: /_next/
|
||||||
|
Disallow: /private/
|
||||||
|
Allow: /
|
||||||
|
|
||||||
|
# サイトマップの登録
|
||||||
|
Sitemap: https://basecafe.jp/sitemap.xml
|
||||||
|
|
||||||
|
# Crawlers-friendly policy
|
||||||
|
User-agent: Googlebot
|
||||||
|
Allow: /
|
||||||
|
|
||||||
|
User-agent: Bingbot
|
||||||
|
Allow: /
|
||||||
|
|
||||||
|
User-agent: *
|
||||||
|
Crawl-delay: 3
|
||||||
1
public/vercel.svg
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>
|
||||||
|
After Width: | Height: | Size: 128 B |
1
public/window.svg
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>
|
||||||
|
After Width: | Height: | Size: 385 B |
48
src/app/api/company/brand/route.ts
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
import { NextResponse } from "next/server";
|
||||||
|
import type { CompanyBrand } from "@/types/brand";
|
||||||
|
|
||||||
|
interface DirectusBrand {
|
||||||
|
id: number;
|
||||||
|
brand_name: string;
|
||||||
|
business_hour_start: string;
|
||||||
|
business_hour_end: string;
|
||||||
|
business_hours_comment: string | null;
|
||||||
|
contents: string;
|
||||||
|
contacts: { id: number; label: string; value: string }[] | null;
|
||||||
|
notes: { id: number; content: string }[] | null;
|
||||||
|
image: { directus_files_id: { id: string } }[] | null;
|
||||||
|
}
|
||||||
|
interface DirectusResponse<T> {
|
||||||
|
data?: T[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function GET() {
|
||||||
|
const BASE = process.env.NEXT_PUBLIC_DIRECTUS_URL!;
|
||||||
|
try {
|
||||||
|
const res = await fetch(
|
||||||
|
`${BASE}/items/company_brand?fields=id,brand_name,business_hour_start,business_hour_end,business_hours_comment,contents,contacts.*,notes.*,image.directus_files_id.*`,
|
||||||
|
{ headers: { Accept: "application/json" }, next: { revalidate: 3600 } }
|
||||||
|
);
|
||||||
|
if (!res.ok) throw new Error(`Directus error: ${res.status}`);
|
||||||
|
const json: DirectusResponse<DirectusBrand> = await res.json();
|
||||||
|
|
||||||
|
const brands: CompanyBrand[] = (json.data ?? []).map((b) => ({
|
||||||
|
id: b.id,
|
||||||
|
name: b.brand_name,
|
||||||
|
business_hours: {
|
||||||
|
start: b.business_hour_start,
|
||||||
|
end: b.business_hour_end,
|
||||||
|
comment: b.business_hours_comment,
|
||||||
|
},
|
||||||
|
contents: b.contents,
|
||||||
|
contacts: b.contacts ?? [],
|
||||||
|
notes: b.notes ?? [],
|
||||||
|
images: (b.image ?? []).map((x) => x.directus_files_id.id),
|
||||||
|
}));
|
||||||
|
|
||||||
|
return NextResponse.json(brands satisfies CompanyBrand[]);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
return NextResponse.json({ error: "Failed to fetch company brand" }, { status: 500 });
|
||||||
|
}
|
||||||
|
}
|
||||||
101
src/app/api/company/info/route.ts
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
import { NextResponse } from "next/server";
|
||||||
|
import type { CompanyInfo } from "@/types/company";
|
||||||
|
|
||||||
|
type DirectusImageItem = string | number | { directus_files_id?: { id: string } };
|
||||||
|
|
||||||
|
interface DirectusBrandRelation {
|
||||||
|
company_brand_id: {
|
||||||
|
id: number;
|
||||||
|
brand_name: string;
|
||||||
|
business_hour_start: string;
|
||||||
|
business_hour_end: string;
|
||||||
|
business_hours_comment: string | null;
|
||||||
|
contents: string;
|
||||||
|
contacts: number[] | { id: number; label: string; value: string }[];
|
||||||
|
image?: DirectusImageItem[] | null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DirectusCompanyInfo {
|
||||||
|
id: number;
|
||||||
|
company_name: string;
|
||||||
|
postal_code?: string;
|
||||||
|
address?: string;
|
||||||
|
map_embed?: string;
|
||||||
|
top_banner?: string;
|
||||||
|
contacts: { id: number; label: string; value: string }[];
|
||||||
|
notes: { id: number; content: string }[];
|
||||||
|
brand?: DirectusBrandRelation[];
|
||||||
|
// ✅ 新規追加フィールド
|
||||||
|
build_date?: string;
|
||||||
|
Representative_director?: string;
|
||||||
|
corp_number?: string;
|
||||||
|
invoice_number?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DirectusResponse<T> {
|
||||||
|
data?: T[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function GET() {
|
||||||
|
const BASE = process.env.NEXT_PUBLIC_DIRECTUS_URL!;
|
||||||
|
try {
|
||||||
|
const res = await fetch(
|
||||||
|
`${BASE}/items/company_info?fields=id,company_name,postal_code,address,map_embed,top_banner,contacts.*,notes.*,brand.*.*,Representative_director,build_date,corp_number,invoice_number`,
|
||||||
|
{ headers: { Accept: "application/json" }, cache: "no-store" }
|
||||||
|
);
|
||||||
|
if (!res.ok) throw new Error(`Directus error: ${res.status}`);
|
||||||
|
|
||||||
|
const json: DirectusResponse<DirectusCompanyInfo> = await res.json();
|
||||||
|
const info = json.data?.[0];
|
||||||
|
if (!info) return NextResponse.json({ error: "No company info" }, { status: 404 });
|
||||||
|
|
||||||
|
const formatted: CompanyInfo = {
|
||||||
|
id: info.id,
|
||||||
|
name: info.company_name,
|
||||||
|
postal_code: info.postal_code,
|
||||||
|
address: info.address,
|
||||||
|
map_embed: info.map_embed,
|
||||||
|
top_banner: info.top_banner,
|
||||||
|
contacts: info.contacts ?? [],
|
||||||
|
notes: info.notes ?? [],
|
||||||
|
brands: (info.brand ?? []).map((b) => {
|
||||||
|
const s = b.company_brand_id;
|
||||||
|
const raw = (s.image ?? []) as DirectusImageItem[];
|
||||||
|
// 画像フィールドが多対多か単純配列かの差異吸収
|
||||||
|
const images: string[] = raw
|
||||||
|
.map((it) => {
|
||||||
|
if (typeof it === "string") return it;
|
||||||
|
if (typeof it === "number") return String(it);
|
||||||
|
if (it && typeof it === "object" && it.directus_files_id?.id) {
|
||||||
|
return it.directus_files_id.id;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
})
|
||||||
|
.filter((id): id is string => id.length > 0);
|
||||||
|
return {
|
||||||
|
id: s.id,
|
||||||
|
name: s.brand_name,
|
||||||
|
business_hours: {
|
||||||
|
start: s.business_hour_start,
|
||||||
|
end: s.business_hour_end,
|
||||||
|
comment: s.business_hours_comment ?? null,
|
||||||
|
},
|
||||||
|
contents: s.contents,
|
||||||
|
contacts: s.contacts ?? [],
|
||||||
|
images,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
// ✅ 新しい項目をマージ
|
||||||
|
build_date: info.build_date ?? undefined,
|
||||||
|
representative_director: info.Representative_director ?? undefined,
|
||||||
|
corp_number: info.corp_number ?? undefined,
|
||||||
|
invoice_number: info.invoice_number ?? undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
return NextResponse.json(formatted satisfies CompanyInfo);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
return NextResponse.json({ error: "Failed to fetch company info" }, { status: 500 });
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/app/api/mail/route.ts
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
import { NextResponse } from "next/server";
|
||||||
|
import { z } from "zod";
|
||||||
|
import nodemailer from "nodemailer";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全なメール送信API
|
||||||
|
* - DKIM対応sendmail経由
|
||||||
|
* - 踏み台対策: API_KEY 認証必須
|
||||||
|
* - バリデーション: zod
|
||||||
|
*/
|
||||||
|
|
||||||
|
// .env に設定
|
||||||
|
// MAIL_API_KEY=xxxxx
|
||||||
|
// MAIL_FROM=noreply@basecafe.jp
|
||||||
|
|
||||||
|
const mailSchema = z.object({
|
||||||
|
subject: z.string().min(1).max(200),
|
||||||
|
message: z.string().min(1),
|
||||||
|
from: z.string().email(), // 送信者(フォーム入力者など)
|
||||||
|
to: z.union([z.string().email(), z.array(z.string().email())]), // 管理者など複数可
|
||||||
|
apiKey: z.string(), // セキュリティキー
|
||||||
|
});
|
||||||
|
|
||||||
|
export async function POST(req: Request) {
|
||||||
|
try {
|
||||||
|
const body = await req.json();
|
||||||
|
|
||||||
|
// ✅ バリデーション
|
||||||
|
const data = mailSchema.parse(body);
|
||||||
|
|
||||||
|
// ✅ 踏み台防止(APIキー認証)
|
||||||
|
if (data.apiKey !== process.env.MAIL_API_KEY) {
|
||||||
|
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||||
|
}
|
||||||
|
|
||||||
|
// ✅ nodemailer設定
|
||||||
|
const transporter = nodemailer.createTransport({
|
||||||
|
sendmail: true,
|
||||||
|
newline: "unix",
|
||||||
|
path: "/usr/sbin/sendmail",
|
||||||
|
});
|
||||||
|
|
||||||
|
// ✅ 宛先を配列に統一
|
||||||
|
const recipients = Array.isArray(data.to) ? data.to : [data.to];
|
||||||
|
|
||||||
|
// ✅ メール送信
|
||||||
|
await transporter.sendMail({
|
||||||
|
from: process.env.MAIL_FROM || "noreply@basecafe.jp",
|
||||||
|
to: recipients.join(", "),
|
||||||
|
replyTo: data.from,
|
||||||
|
subject: data.subject,
|
||||||
|
text: data.message,
|
||||||
|
});
|
||||||
|
|
||||||
|
return NextResponse.json({ success: true });
|
||||||
|
} catch (error: unknown) {
|
||||||
|
// ✅ 安全に型ガード
|
||||||
|
if (error instanceof Error) {
|
||||||
|
console.error("❌ Mail send failed:", error.message);
|
||||||
|
return NextResponse.json({ error: error.message }, { status: 500 });
|
||||||
|
}
|
||||||
|
|
||||||
|
console.error("❌ Mail send failed (unknown error):", error);
|
||||||
|
return NextResponse.json({ error: "Mail send failed" }, { status: 500 });
|
||||||
|
}
|
||||||
|
}
|
||||||
176
src/app/brand/BrandCard.tsx
Normal file
|
|
@ -0,0 +1,176 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import Image from "next/image";
|
||||||
|
import { useState } from "react";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
|
const BASE_URL = process.env.NEXT_PUBLIC_DIRECTUS_URL as string;
|
||||||
|
|
||||||
|
type ContactItem = {
|
||||||
|
id: number;
|
||||||
|
label: string;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type FileExpanded = {
|
||||||
|
id: string;
|
||||||
|
title?: string | null;
|
||||||
|
filename_disk?: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ImageRel = {
|
||||||
|
id: number;
|
||||||
|
company_brand_id: number;
|
||||||
|
directus_files_id: string | FileExpanded;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Brand = {
|
||||||
|
id: number;
|
||||||
|
brand_name: string;
|
||||||
|
business_hour_start?: string;
|
||||||
|
business_hour_end?: string;
|
||||||
|
business_hours_comment?: string;
|
||||||
|
contacts?: ContactItem[];
|
||||||
|
notes?: string[];
|
||||||
|
image?: ImageRel[];
|
||||||
|
contents?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ブランド情報カード
|
||||||
|
* 画像推奨サイズ:
|
||||||
|
* - 単一画像:1200×900(全幅表示)
|
||||||
|
* - 複数画像:600×450(カルーセル表示)
|
||||||
|
* アスペクト比:4:3推奨
|
||||||
|
*/
|
||||||
|
export default function BrandCard({ brand }: { brand: Brand }) {
|
||||||
|
const {
|
||||||
|
brand_name,
|
||||||
|
image,
|
||||||
|
contents,
|
||||||
|
contacts,
|
||||||
|
business_hour_start,
|
||||||
|
business_hour_end,
|
||||||
|
business_hours_comment,
|
||||||
|
} = brand;
|
||||||
|
// === 画像カルーセル ===
|
||||||
|
const [current, setCurrent] = useState(0);
|
||||||
|
const total = image?.length ?? 0;
|
||||||
|
|
||||||
|
const nextSlide = () => setCurrent((prev) => (prev + 1) % total);
|
||||||
|
const prevSlide = () => setCurrent((prev) => (prev - 1 + total) % total);
|
||||||
|
|
||||||
|
const toAssetUrl = (rel?: ImageRel) => {
|
||||||
|
if (!rel || !rel.directus_files_id) return "";
|
||||||
|
const fid =
|
||||||
|
typeof rel.directus_files_id === "string"
|
||||||
|
? rel.directus_files_id
|
||||||
|
: rel.directus_files_id.id;
|
||||||
|
return `${BASE_URL}/assets/${fid}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatTime = (time?: string) => {
|
||||||
|
if (!time) return "";
|
||||||
|
// 時刻だけを日付付きに変換
|
||||||
|
const t = dayjs(`1970-01-01T${time}`);
|
||||||
|
return t.isValid() ? t.format("H:mm") : "";
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="bg-white shadow-md rounded-2xl overflow-hidden p-6">
|
||||||
|
{/* ブランド名 */}
|
||||||
|
<h2 className="text-2xl font-semibold mb-4">{brand_name}</h2>
|
||||||
|
|
||||||
|
{/* カルーセル */}
|
||||||
|
{image && image.length > 0 && (
|
||||||
|
<div className="relative mb-4">
|
||||||
|
<div className="relative w-full aspect-[4/3] overflow-hidden rounded-xl">
|
||||||
|
{image.map((rel, idx) => {
|
||||||
|
const src = toAssetUrl(rel);
|
||||||
|
if (!src) return null;
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
key={rel.id}
|
||||||
|
className={`absolute inset-0 transition-opacity duration-500 ${
|
||||||
|
idx === current ? "opacity-100" : "opacity-0"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<Image
|
||||||
|
src={src}
|
||||||
|
alt={`${brand_name} ${idx + 1}`}
|
||||||
|
fill
|
||||||
|
className="object-cover"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* ナビゲーションボタン */}
|
||||||
|
{total > 1 && (
|
||||||
|
<>
|
||||||
|
<button
|
||||||
|
onClick={prevSlide}
|
||||||
|
className="absolute left-2 top-1/2 -translate-y-1/2 bg-white/70 hover:bg-white text-gray-700 rounded-full p-2 shadow"
|
||||||
|
>
|
||||||
|
‹
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={nextSlide}
|
||||||
|
className="absolute right-2 top-1/2 -translate-y-1/2 bg-white/70 hover:bg-white text-gray-700 rounded-full p-2 shadow"
|
||||||
|
>
|
||||||
|
›
|
||||||
|
</button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* ドットインジケータ */}
|
||||||
|
{total > 1 && (
|
||||||
|
<div className="flex justify-center gap-2 mt-2">
|
||||||
|
{image.map((_, i) => (
|
||||||
|
<button
|
||||||
|
key={i}
|
||||||
|
onClick={() => setCurrent(i)}
|
||||||
|
className={`h-2 w-2 rounded-full ${
|
||||||
|
i === current ? "bg-gray-800" : "bg-gray-300"
|
||||||
|
}`}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* 紹介文 */}
|
||||||
|
{contents && (
|
||||||
|
<div
|
||||||
|
className="prose max-w-none mb-4 text-gray-700"
|
||||||
|
dangerouslySetInnerHTML={{ __html: contents }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* 営業情報 */}
|
||||||
|
{(business_hour_start || business_hour_end || business_hours_comment) && (
|
||||||
|
<div className="text-sm text-gray-700 mb-3">
|
||||||
|
<p>
|
||||||
|
営業時間:{formatTime(business_hour_start)}〜{formatTime(business_hour_end)}
|
||||||
|
</p>
|
||||||
|
{business_hours_comment && (
|
||||||
|
<p className="text-gray-500 text-xs">{business_hours_comment}</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* 連絡先 */}
|
||||||
|
{contacts && contacts.length > 0 && (
|
||||||
|
<div className="border-t pt-3 mt-3 text-sm text-gray-700 space-y-1">
|
||||||
|
{contacts.map((c) => (
|
||||||
|
<p key={c.id}>
|
||||||
|
{c.label}:{c.value}
|
||||||
|
</p>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
36
src/app/brand/page.tsx
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
import { getAllBrands } from "@/lib/directus/brand";
|
||||||
|
import BrandList from "@/components/brand/BrandList";
|
||||||
|
import type { CompanyBrand } from "@/types/brand";
|
||||||
|
|
||||||
|
export const revalidate = 0;
|
||||||
|
|
||||||
|
const brandsRaw = await getAllBrands();
|
||||||
|
|
||||||
|
const brands = brandsRaw.map<CompanyBrand>((b) => ({
|
||||||
|
id: b.id,
|
||||||
|
name: b.brand_name ?? "",
|
||||||
|
images:
|
||||||
|
Array.isArray(b.image) && b.image.length > 0
|
||||||
|
? b.image.map(
|
||||||
|
(img) =>
|
||||||
|
`${process.env.NEXT_PUBLIC_DIRECTUS_URL}/assets/${img.directus_files_id}`
|
||||||
|
)
|
||||||
|
: [],
|
||||||
|
contents: b.contents ?? "",
|
||||||
|
business_hours: {
|
||||||
|
start: b.business_hour_start ?? "",
|
||||||
|
end: b.business_hour_end ?? "",
|
||||||
|
comment: b.business_hours_comment ?? null,
|
||||||
|
},
|
||||||
|
contacts: b.contacts ?? [],
|
||||||
|
notes: b.notes ?? [],
|
||||||
|
}));
|
||||||
|
|
||||||
|
export default async function BrandPage() {
|
||||||
|
return (
|
||||||
|
<main className="container mx-auto px-4 py-8">
|
||||||
|
<h1 className="text-3xl font-bold mb-8 text-center">ブランド紹介</h1>
|
||||||
|
<BrandList brands={brands} />
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
128
src/app/company/page.tsx
Normal file
|
|
@ -0,0 +1,128 @@
|
||||||
|
import { getCompanyData } from "@/lib/directus/company";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import customParseFormat from "dayjs/plugin/customParseFormat";
|
||||||
|
dayjs.extend(customParseFormat);
|
||||||
|
export default async function CompanyPage() {
|
||||||
|
const company = await getCompanyData();
|
||||||
|
// helper: 時刻フォーマット関数
|
||||||
|
const formatTime = (time?: string) => {
|
||||||
|
if (!time) return "-";
|
||||||
|
return dayjs(time, "HH:mm:ss").format("H:mm");
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="p-6">
|
||||||
|
<h1 className="text-3xl font-bold mb-6">会社情報</h1>
|
||||||
|
|
||||||
|
{/* レイアウト全体 */}
|
||||||
|
<div className="grid grid-cols-1 lg:grid-cols-2 gap-8">
|
||||||
|
{/* 左:会社情報+ブランド情報 */}
|
||||||
|
<section className="flex flex-col gap-6">
|
||||||
|
{/* 会社情報 */}
|
||||||
|
<div className="bg-white rounded-2xl shadow-md p-6 border">
|
||||||
|
<h2 className="text-xl font-semibold mb-3">{company.company_name}</h2>
|
||||||
|
|
||||||
|
{/* 郵便番号 → 住所 の順に変更 */}
|
||||||
|
{company.postal_code && (
|
||||||
|
<p className="text-gray-500 text-sm mb-1">〒{company.postal_code}</p>
|
||||||
|
)}
|
||||||
|
<p className="text-gray-700 mb-3">{company.address}</p>
|
||||||
|
|
||||||
|
{/* ✅ 新カラム(設立日・代表・法人番号・インボイス番号) */}
|
||||||
|
<ul className="text-sm text-gray-700 space-y-1 mt-3">
|
||||||
|
{company.build_date && (
|
||||||
|
<li className="grid grid-cols-[auto_1fr]">
|
||||||
|
<span className="font-medium pr-2">設立:</span>
|
||||||
|
<span>
|
||||||
|
{dayjs(company.build_date).format("YYYY年MM月DD日")}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
{company.Representative_director && (
|
||||||
|
<li className="grid grid-cols-[auto_1fr]">
|
||||||
|
<span className="font-medium pr-2">代表取締役:</span>
|
||||||
|
<span>{company.Representative_director}</span>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
{company.corp_number && (
|
||||||
|
<li className="grid grid-cols-[auto_1fr]">
|
||||||
|
<span className="font-medium pr-2">法人番号:</span>
|
||||||
|
<span>{company.corp_number}</span>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
{company.invoice_number && (
|
||||||
|
<li className="grid grid-cols-[auto_1fr]">
|
||||||
|
<span className="font-medium pr-2">適格事業者登録番号:</span>
|
||||||
|
<span>{company.invoice_number}</span>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{/* 連絡先 */}
|
||||||
|
{company.contacts && company.contacts.length > 0 && (
|
||||||
|
<ul className="mt-2 space-y-1 text-sm text-gray-600">
|
||||||
|
{company.contacts.map((c) => (
|
||||||
|
<li key={c.id}>
|
||||||
|
<span className="font-semibold">{c.label}:</span> {c.value}
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* ブランド情報 */}
|
||||||
|
{company.brand_list && company.brand_list.length > 0 && (
|
||||||
|
<div className="bg-white rounded-2xl shadow-md p-6 border">
|
||||||
|
<h2 className="text-xl font-semibold mb-4">運営事業</h2>
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
|
{company.brand_list.map((brand) => (
|
||||||
|
<div
|
||||||
|
key={brand.id}
|
||||||
|
className="p-4 border rounded-xl bg-gray-50 hover:bg-gray-100 transition"
|
||||||
|
>
|
||||||
|
<h3 className="font-bold text-lg mb-1">
|
||||||
|
{brand.brand_name}
|
||||||
|
</h3>
|
||||||
|
<p className="text-sm text-gray-600">
|
||||||
|
営業時間: {formatTime(brand.business_hour_start)}〜
|
||||||
|
{formatTime(brand.business_hour_end)}
|
||||||
|
</p>
|
||||||
|
{brand.business_hours_comment && (
|
||||||
|
<p className="text-xs text-gray-500 mt-1">
|
||||||
|
{brand.business_hours_comment}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* ブランド連絡先 */}
|
||||||
|
{brand.contacts && brand.contacts.length > 0 && (
|
||||||
|
<ul className="mt-3 space-y-1 text-xs text-gray-600">
|
||||||
|
{brand.contacts.map((contact) => (
|
||||||
|
<li key={contact.id}>
|
||||||
|
<span className="font-semibold">
|
||||||
|
{contact.label}:
|
||||||
|
</span>{" "}
|
||||||
|
{contact.value}
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{/* 右:地図 */}
|
||||||
|
<section className="w-full">
|
||||||
|
{company.map_embed && (
|
||||||
|
<div
|
||||||
|
className="w-full overflow-hidden rounded-2xl shadow-lg border"
|
||||||
|
dangerouslySetInnerHTML={{ __html: company.map_embed }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
BIN
src/app/favicon.ico
Normal file
|
After Width: | Height: | Size: 25 KiB |
47
src/app/globals.css
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
@import "tailwindcss";
|
||||||
|
:root {
|
||||||
|
--font-sans: var(--font-rounded);
|
||||||
|
--font-serif: var(--font-mincho);
|
||||||
|
--font-heading: var(--font-yusei);
|
||||||
|
--font-deco: var(--font-rocknroll);
|
||||||
|
--header-height: 4rem; /* PC時の高さ */
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
:root {
|
||||||
|
--header-height: 3.5rem; /* モバイル時の高さ */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@layer utilities {
|
||||||
|
.animate-fadeInUp {
|
||||||
|
@apply opacity-0 translate-y-[-8px];
|
||||||
|
animation: fadeInUp 0.25s ease-out forwards;
|
||||||
|
}
|
||||||
|
.animate-fadeOutUp {
|
||||||
|
@apply opacity-100 translate-y-0;
|
||||||
|
animation: fadeOutUp 0.25s ease-in forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeInUp {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(-8px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeOutUp {
|
||||||
|
from {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(-8px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
55
src/app/layout.tsx
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
// src/app/layout.tsx
|
||||||
|
import "./globals.css";
|
||||||
|
|
||||||
|
import type { Metadata } from "next";
|
||||||
|
import Script from "next/script";
|
||||||
|
import { rounded, mincho, yusei, rocknroll } from "@/lib/fonts";
|
||||||
|
|
||||||
|
import Header from "@/components/Header";
|
||||||
|
import Footer from "@/components/Footer";
|
||||||
|
import ScrollToTop from "@/components/ScrollToTop";
|
||||||
|
import { getCompanyInfo } from "@/lib/getCompanyInfo";
|
||||||
|
import { CompanyProvider } from "@/components/providers/CompanyProvider";
|
||||||
|
import LoadingLayout from "@/components/ui/LoadingLayout";
|
||||||
|
|
||||||
|
export const metadata: Metadata = {
|
||||||
|
title: "株式会社BaseCafe",
|
||||||
|
description: "",
|
||||||
|
};
|
||||||
|
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
||||||
|
const companyInfo = await getCompanyInfo();
|
||||||
|
return (
|
||||||
|
<html
|
||||||
|
lang="ja"
|
||||||
|
className={`${rounded.variable} ${mincho.variable} ${yusei.variable} ${rocknroll.variable}`}
|
||||||
|
>
|
||||||
|
<head>
|
||||||
|
{/* ✅ Google Analytics */}
|
||||||
|
<Script
|
||||||
|
strategy="afterInteractive"
|
||||||
|
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.NEXT_PUBLIC_GA_ID}`}
|
||||||
|
/>
|
||||||
|
<Script id="google-analytics" strategy="afterInteractive">
|
||||||
|
{`
|
||||||
|
window.dataLayer = window.dataLayer || [];
|
||||||
|
function gtag(){dataLayer.push(arguments);}
|
||||||
|
gtag('js', new Date());
|
||||||
|
gtag('config', '${process.env.NEXT_PUBLIC_GA_ID}');
|
||||||
|
`}
|
||||||
|
</Script>
|
||||||
|
</head>
|
||||||
|
<body className="font-sans bg-stone-50 text-stone-800 antialiased leading-relaxed">
|
||||||
|
<LoadingLayout>
|
||||||
|
<CompanyProvider company={companyInfo}>
|
||||||
|
<Header company={companyInfo} />
|
||||||
|
<main className="lg:pt-[var(--header-height,4rem)] min-h-screen">
|
||||||
|
{children}
|
||||||
|
</main>
|
||||||
|
<Footer company={companyInfo} />
|
||||||
|
<ScrollToTop />
|
||||||
|
</CompanyProvider>
|
||||||
|
</LoadingLayout>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
);
|
||||||
|
}
|
||||||
33
src/app/news/[id]/page.tsx
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { notFound } from "next/navigation";
|
||||||
|
import { getNewsById } from "@/lib/directus/news";
|
||||||
|
import type { NewsItem } from "@/types/news";
|
||||||
|
import NewsDetail from "@/components/news/NewsDetail";
|
||||||
|
|
||||||
|
export const revalidate = 3600;
|
||||||
|
|
||||||
|
export default async function NewsDetailPage({ params }: { params: Promise<{ id: string }> }) {
|
||||||
|
// ✅ params全体をawaitして展開する
|
||||||
|
const { id } = await params;
|
||||||
|
|
||||||
|
const nowISO = new Date().toISOString();
|
||||||
|
|
||||||
|
const item: NewsItem | null = await getNewsById(Number(id));
|
||||||
|
if (!item) return notFound();
|
||||||
|
|
||||||
|
const isPublished = item.status === 1 && new Date(item.published_at ?? "") <= new Date(nowISO);
|
||||||
|
if (!isPublished || (!item.content && !item.mainimg)) return notFound();
|
||||||
|
|
||||||
|
return <NewsDetail item={item} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function generateStaticParams() {
|
||||||
|
const res = await fetch(
|
||||||
|
`${
|
||||||
|
process.env.NEXT_PUBLIC_DIRECTUS_URL
|
||||||
|
}/items/news?filter[status][_eq]=1&filter[published_at][_lte]=${encodeURIComponent(
|
||||||
|
new Date().toISOString()
|
||||||
|
)}&fields=id`
|
||||||
|
);
|
||||||
|
const json = await res.json();
|
||||||
|
return json?.data?.map((item: { id: number }) => ({ id: String(item.id) })) ?? [];
|
||||||
|
}
|
||||||
17
src/app/news/page.tsx
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
// src/app/news/page.tsx
|
||||||
|
import { getAllNews } from "@/lib/directus/news";
|
||||||
|
import NewsClientPage from "@/components/news/NewsClientPage";
|
||||||
|
|
||||||
|
export const revalidate = 3600;
|
||||||
|
|
||||||
|
export default async function NewsPage() {
|
||||||
|
const items = await getAllNews();
|
||||||
|
|
||||||
|
// タグ一覧抽出
|
||||||
|
const allTags = items
|
||||||
|
.flatMap((item) => (Array.isArray(item.tags) ? item.tags : []))
|
||||||
|
.filter((tag, i, arr) => tag && arr.indexOf(tag) === i)
|
||||||
|
.sort();
|
||||||
|
|
||||||
|
return <NewsClientPage items={items} allTags={allTags} />;
|
||||||
|
}
|
||||||
167
src/app/page.module.css
Normal file
|
|
@ -0,0 +1,167 @@
|
||||||
|
.page {
|
||||||
|
--gray-rgb: 0, 0, 0;
|
||||||
|
--gray-alpha-200: rgba(var(--gray-rgb), 0.08);
|
||||||
|
--gray-alpha-100: rgba(var(--gray-rgb), 0.05);
|
||||||
|
|
||||||
|
--button-primary-hover: #383838;
|
||||||
|
--button-secondary-hover: #f2f2f2;
|
||||||
|
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: 20px 1fr 20px;
|
||||||
|
align-items: center;
|
||||||
|
justify-items: center;
|
||||||
|
min-height: 100svh;
|
||||||
|
padding: 80px;
|
||||||
|
gap: 64px;
|
||||||
|
font-family: var(--font-geist-sans);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
.page {
|
||||||
|
--gray-rgb: 255, 255, 255;
|
||||||
|
--gray-alpha-200: rgba(var(--gray-rgb), 0.145);
|
||||||
|
--gray-alpha-100: rgba(var(--gray-rgb), 0.06);
|
||||||
|
|
||||||
|
--button-primary-hover: #ccc;
|
||||||
|
--button-secondary-hover: #1a1a1a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 32px;
|
||||||
|
grid-row-start: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main ol {
|
||||||
|
font-family: var(--font-geist-mono);
|
||||||
|
padding-left: 0;
|
||||||
|
margin: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 24px;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
list-style-position: inside;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main li:not(:last-of-type) {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main code {
|
||||||
|
font-family: inherit;
|
||||||
|
background: var(--gray-alpha-100);
|
||||||
|
padding: 2px 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctas {
|
||||||
|
display: flex;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctas a {
|
||||||
|
appearance: none;
|
||||||
|
border-radius: 128px;
|
||||||
|
height: 48px;
|
||||||
|
padding: 0 20px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
transition:
|
||||||
|
background 0.2s,
|
||||||
|
color 0.2s,
|
||||||
|
border-color 0.2s;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 20px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.primary {
|
||||||
|
background: var(--foreground);
|
||||||
|
color: var(--background);
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.secondary {
|
||||||
|
border-color: var(--gray-alpha-200);
|
||||||
|
min-width: 158px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
grid-row-start: 3;
|
||||||
|
display: flex;
|
||||||
|
gap: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer a {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer img {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Enable hover only on non-touch devices */
|
||||||
|
@media (hover: hover) and (pointer: fine) {
|
||||||
|
a.primary:hover {
|
||||||
|
background: var(--button-primary-hover);
|
||||||
|
border-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.secondary:hover {
|
||||||
|
background: var(--button-secondary-hover);
|
||||||
|
border-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.page {
|
||||||
|
padding: 32px;
|
||||||
|
padding-bottom: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main ol {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctas {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctas a {
|
||||||
|
font-size: 14px;
|
||||||
|
height: 40px;
|
||||||
|
padding: 0 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.secondary {
|
||||||
|
min-width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
.logo {
|
||||||
|
filter: invert();
|
||||||
|
}
|
||||||
|
}
|
||||||
69
src/app/page.tsx
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
import Image from "next/image";
|
||||||
|
import Link from "next/link";
|
||||||
|
import { getLatestNews } from "@/lib/directus/news";
|
||||||
|
import Banner from "@/components/home/Banner";
|
||||||
|
export default async function Home() {
|
||||||
|
const news = await getLatestNews();
|
||||||
|
return (
|
||||||
|
<main className="flex flex-col items-center min-h-screen">
|
||||||
|
{/* 上部バナー */}
|
||||||
|
<div className="relative w-full mt-5">
|
||||||
|
<Banner />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 新着情報 */}
|
||||||
|
<section className="max-w-3xl w-full mx-auto mt-10">
|
||||||
|
<div className="bg-white rounded-xl shadow p-6">
|
||||||
|
<h2 className="text-xl font-bold mb-6">新着情報</h2>
|
||||||
|
<div className="space-y-6">
|
||||||
|
{news.map((item) => {
|
||||||
|
const content = (
|
||||||
|
<div className="flex items-start space-x-4 border-b border-gray-200 pb-4">
|
||||||
|
{item.thumbnail?.id && (
|
||||||
|
<div className="relative w-24 h-16 flex-shrink-0">
|
||||||
|
<Image
|
||||||
|
src={`${process.env.NEXT_PUBLIC_DIRECTUS_ASSETS_URL}/assets/${item.thumbnail.id}`}
|
||||||
|
alt={item.title}
|
||||||
|
fill
|
||||||
|
className="object-cover rounded-md"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="flex-1">
|
||||||
|
<div
|
||||||
|
dangerouslySetInnerHTML={{ __html: item.title }}
|
||||||
|
className="text-base text-gray-800"
|
||||||
|
/>
|
||||||
|
<div className="text-sm text-gray-500 mt-1">
|
||||||
|
{new Date(
|
||||||
|
item.published_at
|
||||||
|
? new Date(
|
||||||
|
item.published_at
|
||||||
|
).toLocaleDateString("ja-JP")
|
||||||
|
: ""
|
||||||
|
).toLocaleDateString("ja-JP")}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
// linkurl があればクリック可能に
|
||||||
|
return item.linkurl ? (
|
||||||
|
<Link
|
||||||
|
key={item.id}
|
||||||
|
href={item.linkurl}
|
||||||
|
target={item.link_target || "_self"}
|
||||||
|
className="block hover:bg-gray-50 rounded-md p-1"
|
||||||
|
>
|
||||||
|
{content}
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
<div key={item.id}>{content}</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
66
src/app/page.tsx.bak
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
import Image from "next/image";
|
||||||
|
import Link from "next/link";
|
||||||
|
import { getLatestNews } from "@/lib/directus";
|
||||||
|
|
||||||
|
export default async function Home() {
|
||||||
|
const news = await getLatestNews();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<main className="flex flex-col items-center min-h-screen bg-green-700">
|
||||||
|
{/* 上部バナー */}
|
||||||
|
<div className="relative w-[600px] h-[315px] mt-10">
|
||||||
|
<Image
|
||||||
|
src="/mainimg.png"
|
||||||
|
alt="BaseCafe Banner"
|
||||||
|
fill
|
||||||
|
className="object-contain"
|
||||||
|
priority
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 新着情報 */}
|
||||||
|
<section className="max-w-3xl w-full mx-auto mt-10">
|
||||||
|
<div className="bg-white rounded-xl shadow p-6">
|
||||||
|
<h2 className="text-xl font-bold mb-6">新着情報</h2>
|
||||||
|
<div className="space-y-6">
|
||||||
|
{news.map((item) => (
|
||||||
|
<div
|
||||||
|
key={item.id}
|
||||||
|
className="flex items-start space-x-4 border-b border-gray-200 pb-4"
|
||||||
|
>
|
||||||
|
{/* サムネイル */}
|
||||||
|
{item.thumbnail?.id && (
|
||||||
|
<div className="relative w-24 h-16 flex-shrink-0">
|
||||||
|
<Image
|
||||||
|
src={`${process.env.NEXT_PUBLIC_DIRECTUS_URL}/assets/${item.thumbnail.id}`}
|
||||||
|
alt={item.title}
|
||||||
|
fill
|
||||||
|
className="object-cover rounded-md"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* タイトル + 日付 */}
|
||||||
|
<div className="flex-1">
|
||||||
|
<div
|
||||||
|
className="text-base text-gray-800"
|
||||||
|
dangerouslySetInnerHTML={{ __html: item.title }}
|
||||||
|
/>
|
||||||
|
<div className="text-sm text-gray-500 mt-1">
|
||||||
|
{new Date(item.published_at).toLocaleDateString("ja-JP")}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="text-right mt-4">
|
||||||
|
<a href="/news" className="text-blue-600 hover:underline">
|
||||||
|
more...
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
175
src/app/reservation/page.tsx
Normal file
|
|
@ -0,0 +1,175 @@
|
||||||
|
// src/app/reservation/page.tsx
|
||||||
|
import { getRoomReservations, Reservation } from "@/lib/reservation";
|
||||||
|
import { RoomInfo } from "@/lib/roominfo";
|
||||||
|
|
||||||
|
const ROOMS = Object.keys(RoomInfo); // ["ENJI","PINK","MINT"]
|
||||||
|
const startHour = 7; // 開店時間
|
||||||
|
const endHour = 22; // 閉店時間
|
||||||
|
const TIMES = Array.from({ length: endHour - startHour }, (_, i) => `${startHour + i}:00`); // 7:00〜21:00
|
||||||
|
|
||||||
|
function getNextWeekDates(): Date[] {
|
||||||
|
const today = new Date();
|
||||||
|
const dates: Date[] = [];
|
||||||
|
const dayOfWeek = today.getDay();
|
||||||
|
const daysUntilNextSaturday = 6 - dayOfWeek + 7; // 翌週土曜まで
|
||||||
|
|
||||||
|
for (let i = 0; i <= daysUntilNextSaturday; i++) {
|
||||||
|
const d = new Date(today);
|
||||||
|
d.setDate(today.getDate() + i);
|
||||||
|
dates.push(d);
|
||||||
|
}
|
||||||
|
return dates;
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDate(date: Date) {
|
||||||
|
const y = date.getFullYear();
|
||||||
|
const m = (date.getMonth() + 1).toString().padStart(2, "0");
|
||||||
|
const d = date.getDate().toString().padStart(2, "0");
|
||||||
|
return `${y}-${m}-${d}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildReservationMap(reservations: Reservation[], dates: Date[]) {
|
||||||
|
const map: Record<string, Record<string, "◯" | "✗">> = {};
|
||||||
|
TIMES.forEach((time) => {
|
||||||
|
map[time] = {};
|
||||||
|
dates.forEach((date) => {
|
||||||
|
map[time][formatDate(date)] = "◯";
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
reservations.forEach((r) => {
|
||||||
|
const dateStr = formatDate(new Date(r.sdate));
|
||||||
|
if (!map[TIMES[0]][dateStr]) return;
|
||||||
|
|
||||||
|
if (r.type === "oneday") {
|
||||||
|
TIMES.forEach((time) => (map[time][dateStr] = "✗"));
|
||||||
|
} else if (r.type === "range") {
|
||||||
|
const [startH, startM] = r.start.split(":").map(Number);
|
||||||
|
const startMinutes = startH * 60 + startM;
|
||||||
|
|
||||||
|
const [endH, endM] = r.end.split(":").map(Number);
|
||||||
|
const endMinutes = endH * 60 + endM;
|
||||||
|
|
||||||
|
TIMES.forEach((time) => {
|
||||||
|
const [hour, minute] = time.split(":").map(Number);
|
||||||
|
const timeMinutes = hour * 60 + minute;
|
||||||
|
if (timeMinutes >= startMinutes && timeMinutes < endMinutes) {
|
||||||
|
map[time][dateStr] = "✗";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function ReservationPage() {
|
||||||
|
const dates = getNextWeekDates();
|
||||||
|
const dateLabels = dates.map(
|
||||||
|
(d) =>
|
||||||
|
`${d.getMonth() + 1}/${d.getDate()} (${
|
||||||
|
["日", "月", "火", "水", "木", "金", "土"][d.getDay()]
|
||||||
|
})`
|
||||||
|
);
|
||||||
|
|
||||||
|
// 3部屋の予約データ取得
|
||||||
|
const roomData: Record<string, Record<string, Record<string, "◯" | "✗">>> = {};
|
||||||
|
for (const room of ROOMS) {
|
||||||
|
const reservations = await getRoomReservations(room);
|
||||||
|
roomData[room] = buildReservationMap(reservations, dates);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<main className="max-w-7xl mx-auto px-4 py-8 space-y-12 text-stone-700">
|
||||||
|
{ROOMS.map((room) => (
|
||||||
|
<section
|
||||||
|
key={room}
|
||||||
|
className="bg-white shadow-sm rounded-2xl border border-stone-200 p-6 space-y-6"
|
||||||
|
>
|
||||||
|
<h2 className="text-2xl text-stone-800 font-semibold">{room} 予約表</h2>
|
||||||
|
<p>
|
||||||
|
外部予約サービス:{" "}
|
||||||
|
<a
|
||||||
|
href={RoomInfo[room].url}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="text-blue-600 underline"
|
||||||
|
>
|
||||||
|
こちら
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className="flex border border-stone-200"
|
||||||
|
style={{ "--col-count": dates.length } as React.CSSProperties}
|
||||||
|
>
|
||||||
|
{/* 固定列(時間) */}
|
||||||
|
<div className="flex-shrink-0 bg-stone-50">
|
||||||
|
<table className="border-collapse border border-stone-200 w-full md:w-[10%] text-stone-700">
|
||||||
|
<thead className="bg-stone-100 text-stone-700">
|
||||||
|
<tr>
|
||||||
|
<th className="border border-stone-200 px-2 py-1 text-sm font-semibold whitespace-nowrap">
|
||||||
|
時間
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{TIMES.map((time) => (
|
||||||
|
<tr key={time} className="even:bg-stone-50">
|
||||||
|
<td className="border border-stone-200 px-2 py-1 text-sm font-medium whitespace-nowrap">
|
||||||
|
{time}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 横スクロール可能列 */}
|
||||||
|
<div className="overflow-x-auto flex-1 bg-white">
|
||||||
|
<table className="border-collapse border border-stone-200 w-full md:table-fixed text-stone-700">
|
||||||
|
<thead className="bg-stone-100 text-stone-800">
|
||||||
|
<tr>
|
||||||
|
{dateLabels.map((label) => (
|
||||||
|
<th
|
||||||
|
key={label}
|
||||||
|
className="border border-stone-200 px-2 py-1 text-sm font-medium whitespace-nowrap
|
||||||
|
md:w-[calc(90%/var(--col-count))]"
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</th>
|
||||||
|
))}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{TIMES.map((time) => (
|
||||||
|
<tr key={time} className="even:bg-stone-50">
|
||||||
|
{dates.map((date) => {
|
||||||
|
const dateStr = formatDate(date);
|
||||||
|
const val = roomData[room][time][dateStr];
|
||||||
|
return (
|
||||||
|
<td
|
||||||
|
key={date.toISOString()}
|
||||||
|
className={`border border-stone-200 px-2 py-1 text-center text-sm font-medium whitespace-nowrap
|
||||||
|
md:w-[calc(90%/var(--col-count))]
|
||||||
|
${
|
||||||
|
val === "✗"
|
||||||
|
? "bg-stone-100 text-stone-400"
|
||||||
|
: "bg-white text-stone-700"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{val}
|
||||||
|
</td>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
))}
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
55
src/app/schedule/page.tsx
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
import Carousel from "@/components/ui/Carousel";
|
||||||
|
import { getAllSchedules } from "@/lib/directus/schedule";
|
||||||
|
import type { ScheduleItem } from "@/lib/directus/schedule";
|
||||||
|
|
||||||
|
export const revalidate = 3600;
|
||||||
|
|
||||||
|
export default async function SchedulePage() {
|
||||||
|
const schedules: ScheduleItem[] = await getAllSchedules();
|
||||||
|
|
||||||
|
if (!schedules.length) {
|
||||||
|
return (
|
||||||
|
<p className="p-6 text-center text-stone-500">スケジュールはまだ登録されていません。</p>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<main className="max-w-4xl mx-auto px-4 py-8 space-y-12">
|
||||||
|
{schedules.map((item) => {
|
||||||
|
const { id, ch_ym, ch_img, ch_img2, comment } = item;
|
||||||
|
|
||||||
|
// 年月タイトル
|
||||||
|
const dateObj = new Date(ch_ym);
|
||||||
|
const title = `${dateObj.getFullYear()}年${dateObj.getMonth() + 1}月`;
|
||||||
|
|
||||||
|
// 画像を配列化してCarouselへ渡す
|
||||||
|
const images = [ch_img, ch_img2]
|
||||||
|
.filter(Boolean)
|
||||||
|
.map((imgId) => `${process.env.NEXT_PUBLIC_DIRECTUS_URL}/assets/${imgId}`);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section key={id} className="space-y-4">
|
||||||
|
<h2 className="text-xl font-semibold">{title}</h2>
|
||||||
|
|
||||||
|
{/* --- 画像カルーセル --- */}
|
||||||
|
{images.length > 0 && (
|
||||||
|
<Carousel
|
||||||
|
name={`Schedule-${id}`}
|
||||||
|
images={images}
|
||||||
|
interval={5000}
|
||||||
|
enableZoom
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{comment && (
|
||||||
|
<div
|
||||||
|
className="text-gray-700 leading-relaxed prose prose-stone max-w-none"
|
||||||
|
dangerouslySetInnerHTML={{ __html: comment }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
67
src/app/sitemap.ts
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
// src/app/sitemap.ts
|
||||||
|
import type { MetadataRoute } from "next";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BaseCafe.jp sitemap generator
|
||||||
|
* TypeScript strict + ESLint no-explicit-any 完全対応版
|
||||||
|
* 2025-10-27
|
||||||
|
*/
|
||||||
|
|
||||||
|
type DirectusNewsItem = {
|
||||||
|
id: number;
|
||||||
|
date_updated?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type DirectusResponse<T> = {
|
||||||
|
data?: T[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
||||||
|
const siteUrl = "https://basecafe.jp";
|
||||||
|
|
||||||
|
// 固定ページ一覧
|
||||||
|
const staticPages = ["", "/news", "/brand", "/company", "/schedule", "/reserve"];
|
||||||
|
|
||||||
|
// CMS(Directus)から news 記事を取得して動的に追加
|
||||||
|
let newsItems: DirectusNewsItem[] = [];
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await fetch(
|
||||||
|
`${process.env.NEXT_PUBLIC_DIRECTUS_URL}/items/news?fields=id,date_updated&filter[status][_eq]=published`,
|
||||||
|
{
|
||||||
|
next: { revalidate: 3600 },
|
||||||
|
headers: { Accept: "application/json" },
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (res.ok) {
|
||||||
|
const data: DirectusResponse<DirectusNewsItem> = await res.json();
|
||||||
|
newsItems =
|
||||||
|
data.data?.map((item) => ({
|
||||||
|
id: item.id,
|
||||||
|
date_updated: item.date_updated || new Date().toISOString(),
|
||||||
|
})) ?? [];
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("⚠️ Failed to fetch Directus news items:", error);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sitemap配列生成
|
||||||
|
const urls: MetadataRoute.Sitemap = [
|
||||||
|
...staticPages.map((path) => ({
|
||||||
|
url: `${siteUrl}${path}`,
|
||||||
|
lastModified: new Date(),
|
||||||
|
changeFrequency: "monthly" as const,
|
||||||
|
priority: 0.8,
|
||||||
|
})),
|
||||||
|
...newsItems.map((item) => ({
|
||||||
|
url: `${siteUrl}/news/${item.id}`,
|
||||||
|
lastModified: item.date_updated ? new Date(item.date_updated) : new Date(),
|
||||||
|
changeFrequency: "weekly" as const,
|
||||||
|
priority: 0.7,
|
||||||
|
})),
|
||||||
|
];
|
||||||
|
|
||||||
|
// ✅ 忘れずにreturn!
|
||||||
|
return urls;
|
||||||
|
}
|
||||||
112
src/components/Footer.tsx
Normal file
|
|
@ -0,0 +1,112 @@
|
||||||
|
import type { CompanyInfo } from "@/types/company";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
type Props = {
|
||||||
|
company: CompanyInfo;
|
||||||
|
};
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
|
export default async function Footer({ company }: Props) {
|
||||||
|
const buildYear = company.build_date
|
||||||
|
? dayjs(company.build_date).year()
|
||||||
|
: new Date().getFullYear();
|
||||||
|
const currentYear = new Date().getFullYear();
|
||||||
|
return (
|
||||||
|
<footer className="bg-gray-900 text-gray-200 mt-12">
|
||||||
|
{/* 上段:メニューや情報 */}
|
||||||
|
<div className="max-w-7xl mx-auto px-6 py-12 grid grid-cols-2 md:grid-cols-3 gap-8">
|
||||||
|
{/* メニュー */}
|
||||||
|
<div>
|
||||||
|
<h2 className="text-lg font-semibold mb-4">Menu</h2>
|
||||||
|
<ul className="space-y-2">
|
||||||
|
<li>
|
||||||
|
<Link href="/">TOP</Link>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<Link href="/schedule">SCHEDULE</Link>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<Link href="/news">NEWS</Link>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<Link href="/brand">BRAND</Link>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<Link href="/company">COMPANY</Link>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<Link href="/webstore">WEBSTORE</Link>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<span className="block font-semibold">Instagram</span>
|
||||||
|
<ul className="ml-4 space-y-1 text-sm">
|
||||||
|
<li>
|
||||||
|
<Link
|
||||||
|
href="https://www.instagram.com/basebettaku"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
Base Bettaku
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<Link
|
||||||
|
href="https://www.instagram.com/basecafe_2024"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
BaseCafe
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<Link href="/reservation">ROOM Reservation</Link>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 会社情報 */}
|
||||||
|
<div>
|
||||||
|
<h2 className="text-lg font-semibold mb-4">Company</h2>
|
||||||
|
<ul className="space-y-2 text-sm">
|
||||||
|
<li className="text-md">{company.name}</li>
|
||||||
|
<li className="text-sm">
|
||||||
|
〒{company.postal_code} {company.address}
|
||||||
|
</li>
|
||||||
|
<li>法人番号:{company.corp_number}</li>
|
||||||
|
<li>適格事業者番号:{company.invoice_number}</li>
|
||||||
|
<li>
|
||||||
|
{company.contacts[0].label}: {company.contacts[0].value}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* SNS */}
|
||||||
|
{/* <div>
|
||||||
|
<h2 className="text-lg font-semibold mb-4">Follow Us</h2>
|
||||||
|
<ul className="space-y-2 text-sm">
|
||||||
|
<li>
|
||||||
|
<Link href="https://www.instagram.com/basecafe" target="_blank">
|
||||||
|
Instagram
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<Link href="https://x.com/" target="_blank">
|
||||||
|
X (Twitter)
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div> */}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 下段:コピーライト */}
|
||||||
|
<div className="border-t border-gray-700 py-4">
|
||||||
|
<div className="max-w-7xl mx-auto px-6 flex justify-center md:justify-between items-center text-sm text-gray-400">
|
||||||
|
<span className="font-semibold text-gray-200">BaseCafe</span>
|
||||||
|
<span>
|
||||||
|
© {buildYear === currentYear ? buildYear : `${buildYear}–${currentYear}`}{" "}
|
||||||
|
{company.name}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
);
|
||||||
|
}
|
||||||
289
src/components/Header.tsx
Normal file
|
|
@ -0,0 +1,289 @@
|
||||||
|
"use client";
|
||||||
|
import type { CompanyInfo } from "@/types/company";
|
||||||
|
type Props = {
|
||||||
|
company: CompanyInfo;
|
||||||
|
};
|
||||||
|
|
||||||
|
import Link from "next/link";
|
||||||
|
import { useState, useEffect, useRef } from "react";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
// Font Awesome
|
||||||
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
import { faInstagram } from "@fortawesome/free-brands-svg-icons";
|
||||||
|
|
||||||
|
// Lucide
|
||||||
|
import { ShoppingBag } from "lucide-react";
|
||||||
|
|
||||||
|
type MenuItem = {
|
||||||
|
label: string;
|
||||||
|
href?: string;
|
||||||
|
external?: boolean;
|
||||||
|
children?: MenuItem[];
|
||||||
|
icon?: React.ReactNode;
|
||||||
|
};
|
||||||
|
|
||||||
|
// --- 省略 ---
|
||||||
|
|
||||||
|
const menuItems: MenuItem[] = [
|
||||||
|
{ label: "スケジュール", href: "/schedule" },
|
||||||
|
{ label: "新着情報", href: "/news" },
|
||||||
|
{ label: "ブランド", href: "/brand" },
|
||||||
|
{ label: "会社情報", href: "/company" },
|
||||||
|
{
|
||||||
|
label: "ウェブストア",
|
||||||
|
href: "https://store.basecafe.jp",
|
||||||
|
external: true,
|
||||||
|
icon: <ShoppingBag className="mr-2 w-4 h-4 text-stone-700" />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Instagram",
|
||||||
|
icon: <FontAwesomeIcon icon={faInstagram} className="mr-2 text-pink-600 w-4 h-4" />,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
label: "Base Bettaku",
|
||||||
|
href: "https://www.instagram.com/basebettaku/",
|
||||||
|
external: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "BaseCafe",
|
||||||
|
href: "https://www.instagram.com/basecafe_2024/",
|
||||||
|
external: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ label: "個室予約", href: "/reservation" },
|
||||||
|
];
|
||||||
|
|
||||||
|
export default function Header({ company }: Props) {
|
||||||
|
const [openSubMenu, setOpenSubMenu] = useState<string | null>(null);
|
||||||
|
const [isDesktop, setIsDesktop] = useState(false);
|
||||||
|
const [mobileOpen, setMobileOpen] = useState(false);
|
||||||
|
const [scrolled, setScrolled] = useState(false); // ← 追加
|
||||||
|
const menuRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// ウィンドウ幅チェック
|
||||||
|
const checkSize = () => setIsDesktop(window.innerWidth >= 1024);
|
||||||
|
checkSize();
|
||||||
|
window.addEventListener("resize", checkSize);
|
||||||
|
|
||||||
|
// クリックアウトサイドでサブメニュー閉じる
|
||||||
|
const handleClickOutside = (event: MouseEvent) => {
|
||||||
|
if (menuRef.current && !menuRef.current.contains(event.target as Node)) {
|
||||||
|
setOpenSubMenu(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
document.addEventListener("mousedown", handleClickOutside);
|
||||||
|
|
||||||
|
// スクロール監視(Headerの半透明切替)
|
||||||
|
const handleScroll = () => {
|
||||||
|
setScrolled(window.scrollY > 20); // 20px以上スクロールで true
|
||||||
|
};
|
||||||
|
window.addEventListener("scroll", handleScroll);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener("resize", checkSize);
|
||||||
|
document.removeEventListener("mousedown", handleClickOutside);
|
||||||
|
window.removeEventListener("scroll", handleScroll);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const toggleSubMenu = (label: string) => {
|
||||||
|
setOpenSubMenu(openSubMenu === label ? null : label);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<header
|
||||||
|
className={`
|
||||||
|
lg:fixed lg:top-0 lg:left-0 lg:right-0 lg:z-50
|
||||||
|
transition-colors duration-300
|
||||||
|
${isDesktop && scrolled ? "bg-white/90 shadow-md backdrop-blur-md" : "bg-white"}
|
||||||
|
`}
|
||||||
|
>
|
||||||
|
<div className="max-w-7xl mx-auto flex justify-between items-center px-6 py-4">
|
||||||
|
{/* ロゴ */}
|
||||||
|
<Link href="/" className="text-2xl font-heading text-brand">
|
||||||
|
{company.name}
|
||||||
|
</Link>
|
||||||
|
|
||||||
|
{/* PCメニュー */}
|
||||||
|
<nav className="hidden lg:flex justify-center flex-1 space-x-6" ref={menuRef}>
|
||||||
|
{menuItems.map((item) => (
|
||||||
|
<div
|
||||||
|
key={item.label}
|
||||||
|
className="relative"
|
||||||
|
{...(isDesktop && {
|
||||||
|
onMouseEnter: () => setOpenSubMenu(item.label),
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
{item.children ? (
|
||||||
|
<button
|
||||||
|
onClick={() => toggleSubMenu(item.label)}
|
||||||
|
className="hover:text-brand px-2 py-1 flex items-center"
|
||||||
|
>
|
||||||
|
{item.icon && item.icon}
|
||||||
|
{item.label}
|
||||||
|
</button>
|
||||||
|
) : item.external ? (
|
||||||
|
<a
|
||||||
|
href={item.href}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="hover:text-brand px-2 py-1 flex items-center"
|
||||||
|
>
|
||||||
|
{item.icon && item.icon}
|
||||||
|
{item.label}
|
||||||
|
</a>
|
||||||
|
) : (
|
||||||
|
<Link
|
||||||
|
href={item.href || "#"}
|
||||||
|
className="hover:text-brand px-2 py-1 flex items-center"
|
||||||
|
>
|
||||||
|
{item.icon && item.icon}
|
||||||
|
{item.label}
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* サブメニュー */}
|
||||||
|
{isDesktop && item.children && openSubMenu === item.label && (
|
||||||
|
<div className="absolute left-0 mt-2 bg-white shadow-lg rounded-md min-w-[160px] z-50">
|
||||||
|
{item.children.map((child) =>
|
||||||
|
child.external ? (
|
||||||
|
<a
|
||||||
|
key={child.label}
|
||||||
|
href={child.href}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="block px-4 py-2 hover:bg-gray-100 whitespace-nowrap"
|
||||||
|
>
|
||||||
|
{child.label}
|
||||||
|
</a>
|
||||||
|
) : (
|
||||||
|
<Link
|
||||||
|
key={child.label}
|
||||||
|
href={child.href || "#"}
|
||||||
|
className="block px-4 py-2 hover:bg-gray-100 whitespace-nowrap"
|
||||||
|
>
|
||||||
|
{child.label}
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
{/* モバイルメニュー ボタン */}
|
||||||
|
<button className="lg:hidden" onClick={() => setMobileOpen((prev) => !prev)}>
|
||||||
|
{mobileOpen ? (
|
||||||
|
// Xアイコン
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
className="h-6 w-6"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke="currentColor"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
strokeWidth={2}
|
||||||
|
d="M6 18L18 6M6 6l12 12"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
) : (
|
||||||
|
// ハンバーガーアイコン
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
className="h-6 w-6"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke="currentColor"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
strokeWidth={2}
|
||||||
|
d="M4 6h16M4 12h16M4 18h16"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* モバイルメニュー */}
|
||||||
|
{mobileOpen && (
|
||||||
|
<nav
|
||||||
|
className={`lg:hidden fixed top-[64px] left-0 w-full h-[calc(100vh-64px)]
|
||||||
|
bg-white shadow-md z-40 overflow-y-auto transition-all duration-300
|
||||||
|
${mobileOpen ? "animate-fadeInUp" : "animate-fadeOutUp pointer-events-none"}`}
|
||||||
|
>
|
||||||
|
{menuItems.map((item) => (
|
||||||
|
<div key={item.label} className="border-b border-stone-200">
|
||||||
|
{item.children ? (
|
||||||
|
<>
|
||||||
|
<button
|
||||||
|
onClick={() => toggleSubMenu(item.label)}
|
||||||
|
className="w-full text-left px-4 py-3 hover:bg-stone-100 flex items-center text-stone-800"
|
||||||
|
>
|
||||||
|
{item.icon && item.icon}
|
||||||
|
{item.label}
|
||||||
|
</button>
|
||||||
|
{openSubMenu === item.label && (
|
||||||
|
<div className="pl-6 bg-stone-50">
|
||||||
|
{item.children.map((child) =>
|
||||||
|
child.external ? (
|
||||||
|
<a
|
||||||
|
key={child.label}
|
||||||
|
href={child.href}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="block px-4 py-2 hover:bg-stone-100"
|
||||||
|
onClick={() => setMobileOpen(false)}
|
||||||
|
>
|
||||||
|
{child.label}
|
||||||
|
</a>
|
||||||
|
) : (
|
||||||
|
<Link
|
||||||
|
key={child.label}
|
||||||
|
href={child.href || "#"}
|
||||||
|
className="block px-4 py-2 hover:bg-stone-100"
|
||||||
|
onClick={() => setMobileOpen(false)}
|
||||||
|
>
|
||||||
|
{child.label}
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
) : item.external ? (
|
||||||
|
<a
|
||||||
|
href={item.href}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="flex px-4 py-3 hover:bg-stone-100 items-center text-stone-800"
|
||||||
|
onClick={() => setMobileOpen(false)}
|
||||||
|
>
|
||||||
|
{item.icon && item.icon}
|
||||||
|
{item.label}
|
||||||
|
</a>
|
||||||
|
) : (
|
||||||
|
<Link
|
||||||
|
href={item.href || "#"}
|
||||||
|
className="flex px-4 py-3 hover:bg-stone-100 items-center text-stone-800"
|
||||||
|
onClick={() => setMobileOpen(false)}
|
||||||
|
>
|
||||||
|
{item.icon && item.icon}
|
||||||
|
{item.label}
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</nav>
|
||||||
|
)}
|
||||||
|
</header>
|
||||||
|
);
|
||||||
|
}
|
||||||
41
src/components/ScrollToTop.tsx
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useState, useEffect } from "react";
|
||||||
|
import { ArrowUp } from "lucide-react";
|
||||||
|
|
||||||
|
export default function ScrollToTop() {
|
||||||
|
const [visible, setVisible] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const toggleVisibility = () => {
|
||||||
|
if (window.scrollY > 200) {
|
||||||
|
setVisible(true);
|
||||||
|
} else {
|
||||||
|
setVisible(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener("scroll", toggleVisibility);
|
||||||
|
return () => window.removeEventListener("scroll", toggleVisibility);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const scrollToTop = () => {
|
||||||
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
visible && (
|
||||||
|
<button
|
||||||
|
onClick={scrollToTop}
|
||||||
|
className="flex items-center justify-center
|
||||||
|
fixed bottom-6 right-6 z-50 w-12 h-12
|
||||||
|
rounded-full bg-brand text-white shadow-lg ring-1 ring-stone-300/40
|
||||||
|
hover:bg-brand/90 hover:shadow-xl transition-all duration-300
|
||||||
|
backdrop-blur-sm"
|
||||||
|
aria-label="ページ上部へ戻る"
|
||||||
|
>
|
||||||
|
<ArrowUp className="w-6 h-6" />
|
||||||
|
</button>
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
76
src/components/brand/BrandList.tsx
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
import type { CompanyBrand } from "@/types/brand";
|
||||||
|
import Carousel from "@/components/ui/Carousel";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
|
const formatTime = (time?: string) => {
|
||||||
|
if (!time) return "";
|
||||||
|
// 時刻だけを日付付きに変換
|
||||||
|
const t = dayjs(`1970-01-01T${time}`);
|
||||||
|
return t.isValid() ? t.format("H:mm") : "";
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function BrandList({ brands }: { brands: CompanyBrand[] }) {
|
||||||
|
return (
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||||
|
{brands.map((brand) => (
|
||||||
|
<article
|
||||||
|
key={brand.id}
|
||||||
|
className="bg-white shadow-md rounded-2xl overflow-hidden p-6"
|
||||||
|
>
|
||||||
|
{/* ブランド名 */}
|
||||||
|
<h2 className="text-2xl font-semibold mb-4">{brand.name}</h2>
|
||||||
|
|
||||||
|
{/* ✅ カルーセル化された画像 */}
|
||||||
|
{brand.images.length > 0 && (
|
||||||
|
<Carousel name={brand.name} images={brand.images} interval={5000} />
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* 紹介文 */}
|
||||||
|
{brand.contents && (
|
||||||
|
<div
|
||||||
|
className="prose max-w-none mb-4 text-gray-700"
|
||||||
|
dangerouslySetInnerHTML={{ __html: brand.contents }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* 営業時間 */}
|
||||||
|
{(brand.business_hours.start ||
|
||||||
|
brand.business_hours.end ||
|
||||||
|
brand.business_hours.comment) && (
|
||||||
|
<div className="text-sm text-gray-700 mb-3">
|
||||||
|
<p>
|
||||||
|
営業時間:{formatTime(brand.business_hours.start)}〜
|
||||||
|
{formatTime(brand.business_hours.end)}
|
||||||
|
</p>
|
||||||
|
{brand.business_hours.comment && (
|
||||||
|
<p className="text-gray-500 text-xs">
|
||||||
|
{brand.business_hours.comment}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* 連絡先 */}
|
||||||
|
{brand.contacts?.length > 0 && (
|
||||||
|
<div className="border-t pt-3 mt-3 text-sm text-gray-700 space-y-1">
|
||||||
|
{brand.contacts.map((c) => (
|
||||||
|
<p key={c.id}>
|
||||||
|
{c.label}:{c.value}
|
||||||
|
</p>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* 備考 */}
|
||||||
|
{brand.notes?.length > 0 && (
|
||||||
|
<div className="text-xs text-gray-500 mt-2">
|
||||||
|
{brand.notes.map((n) => (
|
||||||
|
<p key={n.id}>{n.content}</p>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</article>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
21
src/components/home/Banner.tsx
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
// src/components/home/Banner.tsx
|
||||||
|
"use client";
|
||||||
|
import Image from "next/image";
|
||||||
|
import { useCompany } from "@/components/providers/CompanyProvider";
|
||||||
|
|
||||||
|
export default function Banner() {
|
||||||
|
const company = useCompany();
|
||||||
|
const bannerSrc = `${process.env.NEXT_PUBLIC_DIRECTUS_URL}/assets/${company.top_banner}`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="relative w-full aspect-[16/9] overflow-hidden">
|
||||||
|
<Image
|
||||||
|
src={bannerSrc}
|
||||||
|
alt={`${company.name} トップバナー`}
|
||||||
|
fill
|
||||||
|
priority
|
||||||
|
className="w-full h-auto object-cover"
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
83
src/components/news/NewsCard.tsx
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
// src/components/news/NewsCard.tsx
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import Image from "next/image";
|
||||||
|
import Link from "next/link";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { useMemo } from "react";
|
||||||
|
import type { NewsItem } from "@/types/news";
|
||||||
|
|
||||||
|
const stripTags = (html?: string | null) => (html ? html.replace(/<[^>]+>/g, "") : "");
|
||||||
|
|
||||||
|
export default function NewsCard({ item }: { item: NewsItem }) {
|
||||||
|
const summary = useMemo(() => {
|
||||||
|
if (!item.content) return "";
|
||||||
|
const plain = stripTags(item.content);
|
||||||
|
return plain.length > 80 ? plain.slice(0, 80) + "…" : plain;
|
||||||
|
}, [item.content]);
|
||||||
|
const href =
|
||||||
|
item.linkurl && item.linkurl !== ""
|
||||||
|
? item.linkurl
|
||||||
|
: item.content
|
||||||
|
? `/news/${item.id}`
|
||||||
|
: null;
|
||||||
|
|
||||||
|
const target = item.link_target === "_blank" ? "_blank" : "_self";
|
||||||
|
const isExternal = href?.startsWith("http");
|
||||||
|
|
||||||
|
const imageId = typeof item.thumbnail === "string" ? item.thumbnail : item.thumbnail?.id;
|
||||||
|
const imageSrc = imageId
|
||||||
|
? `${process.env.NEXT_PUBLIC_DIRECTUS_ASSETS_URL}/assets/${imageId}?fit=cover`
|
||||||
|
: "/dummy_thumb.png";
|
||||||
|
const date = dayjs(item.published_at).format("YYYY.MM.DD");
|
||||||
|
|
||||||
|
const cardInner = (
|
||||||
|
<article className="flex flex-col justify-between h-full bg-stone-50 border border-stone-200 rounded-2xl overflow-hidden shadow-sm hover:shadow-md transition-all duration-300 hover:-translate-y-1">
|
||||||
|
<div className="relative w-full aspect-[4/3] bg-stone-100 overflow-hidden">
|
||||||
|
<Image
|
||||||
|
src={imageSrc}
|
||||||
|
alt={stripTags(item.title) || "NEWS"}
|
||||||
|
fill
|
||||||
|
className="object-cover transition-transform duration-700 group-hover:scale-105"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="p-5 flex flex-col flex-1 font-sans">
|
||||||
|
<p className="text-xs text-stone-500 mb-1">{date}</p>
|
||||||
|
<h3 className="font-heading text-lg text-stone-800 mb-2 leading-tight line-clamp-2 min-h-[3rem]">
|
||||||
|
{stripTags(item.title)}
|
||||||
|
</h3>
|
||||||
|
{summary && <p className="text-sm text-stone-600 truncate mb-3">{summary}</p>}
|
||||||
|
<div className="mt-auto pt-2">
|
||||||
|
{Array.isArray(item.tags) && item.tags.length > 0 && (
|
||||||
|
<div className="flex flex-wrap gap-2">
|
||||||
|
{item.tags.map((tag, i) => (
|
||||||
|
<span
|
||||||
|
key={i}
|
||||||
|
className="text-xs bg-stone-200 text-stone-700 px-2 py-1 rounded-full"
|
||||||
|
>
|
||||||
|
#{tag}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!href) return cardInner;
|
||||||
|
|
||||||
|
if (isExternal)
|
||||||
|
return (
|
||||||
|
<a href={href} target={target} rel="noopener noreferrer" className="group block h-full">
|
||||||
|
{cardInner}
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Link href={href} target={target} className="group block h-full">
|
||||||
|
{cardInner}
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
}
|
||||||
39
src/components/news/NewsClientPage.tsx
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useState } from "react";
|
||||||
|
import type { NewsItem } from "@/types/news";
|
||||||
|
import NewsList from "@/components/news/NewsList";
|
||||||
|
import TagList from "@/components/news/TagList";
|
||||||
|
|
||||||
|
export default function NewsClientPage({
|
||||||
|
items,
|
||||||
|
allTags,
|
||||||
|
}: {
|
||||||
|
items: NewsItem[];
|
||||||
|
allTags: string[];
|
||||||
|
}) {
|
||||||
|
const [selectedTag, setSelectedTag] = useState<string | null>(null);
|
||||||
|
|
||||||
|
// タグ絞り込み
|
||||||
|
const filteredItems =
|
||||||
|
selectedTag && selectedTag !== "ALL"
|
||||||
|
? items.filter((item) => item.tags?.includes(selectedTag))
|
||||||
|
: items;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<main className="max-w-7xl mx-auto px-4 py-12">
|
||||||
|
<div className="grid grid-cols-1 lg:grid-cols-[1fr_300px] gap-12">
|
||||||
|
{/* 左:ニュースリスト */}
|
||||||
|
<section>
|
||||||
|
<h1 className="text-3xl font-bold mb-8">新着情報</h1>
|
||||||
|
<NewsList items={filteredItems} />
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{/* 右:タグ一覧 */}
|
||||||
|
<aside className="lg:sticky lg:top-24 h-fit">
|
||||||
|
<TagList tags={allTags} selectedTag={selectedTag} onSelect={setSelectedTag} />
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
66
src/components/news/NewsDetail.tsx
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
// src/components/news/NewsDetail.tsx
|
||||||
|
"use client";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import Link from "next/link";
|
||||||
|
import { ArrowLeft } from "lucide-react";
|
||||||
|
import Carousel from "@/components/ui/Carousel";
|
||||||
|
import type { NewsItem } from "@/types/news";
|
||||||
|
|
||||||
|
export default function NewsDetail({ item }: { item: NewsItem }) {
|
||||||
|
// mainimg が Directus の多対多構造を前提にしている場合に対応
|
||||||
|
|
||||||
|
const images =
|
||||||
|
Array.isArray(item.mainimg) && item.mainimg.length > 0
|
||||||
|
? item.mainimg.map(
|
||||||
|
(img) =>
|
||||||
|
`${process.env.NEXT_PUBLIC_DIRECTUS_URL}/assets/${img.directus_files_id}`
|
||||||
|
)
|
||||||
|
: [];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<main className="max-w-3xl mx-auto px-6 py-10">
|
||||||
|
{/* --- mainimg --- */}
|
||||||
|
{images.length > 0 && <Carousel name={item.title} images={images} interval={5000} />}
|
||||||
|
|
||||||
|
<p className="text-sm text-gray-500 mb-2">
|
||||||
|
{item.published_at ? dayjs(item.published_at).format("YYYY.MM.DD") : ""}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h1
|
||||||
|
className="text-3xl font-bold mb-6 leading-tight"
|
||||||
|
dangerouslySetInnerHTML={{ __html: item.title }}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{item.content && (
|
||||||
|
<div
|
||||||
|
className="prose max-w-none mb-8"
|
||||||
|
dangerouslySetInnerHTML={{ __html: item.content }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{Array.isArray(item.tags) && item.tags.length > 0 && (
|
||||||
|
<div className="flex flex-wrap gap-2">
|
||||||
|
{item.tags.map((tag, i) => (
|
||||||
|
<span
|
||||||
|
key={i}
|
||||||
|
className="text-sm bg-gray-100 text-gray-700 px-3 py-1 rounded-full"
|
||||||
|
>
|
||||||
|
#{tag}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* --- 一覧に戻るリンク --- */}
|
||||||
|
<div className="mt-12 text-center">
|
||||||
|
<Link
|
||||||
|
href="/news"
|
||||||
|
className="inline-flex items-center gap-2 text-sm px-6 py-3 rounded-full bg-gray-100 hover:bg-gray-200 text-gray-700 transition"
|
||||||
|
>
|
||||||
|
<ArrowLeft size={16} />
|
||||||
|
新着情報一覧に戻る
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
30
src/components/news/NewsList.tsx
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
// src/components/news/NewsList.tsx
|
||||||
|
"use client";
|
||||||
|
import type { NewsItem } from "@/types/news";
|
||||||
|
import NewsCard from "@/components/news/NewsCard";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NewsList
|
||||||
|
* ニュース一覧をグリッドで表示する
|
||||||
|
* 各カードの高さを統一し、レスポンシブ対応
|
||||||
|
*/
|
||||||
|
export default function NewsList({ items }: { items: NewsItem[] }) {
|
||||||
|
if (!items?.length) {
|
||||||
|
return <p className="text-center text-stone-500 py-8">現在お知らせはありません。</p>;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="
|
||||||
|
grid
|
||||||
|
grid-cols-1 sm:grid-cols-2 lg:grid-cols-3
|
||||||
|
gap-8
|
||||||
|
items-stretch
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{items.map((item) => (
|
||||||
|
<NewsCard key={item.id} item={item} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
44
src/components/news/TagList.tsx
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
export default function TagList({
|
||||||
|
tags,
|
||||||
|
selectedTag,
|
||||||
|
onSelect,
|
||||||
|
}: {
|
||||||
|
tags: string[];
|
||||||
|
selectedTag: string | null;
|
||||||
|
onSelect: (tag: string | null) => void;
|
||||||
|
}) {
|
||||||
|
if (!tags?.length) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="bg-stone-50 border border-stone-200 rounded-xl p-4 shadow-sm">
|
||||||
|
<h3 className="text-lg font-semibold mb-3">タグ一覧</h3>
|
||||||
|
<div className="flex flex-wrap gap-2">
|
||||||
|
<button
|
||||||
|
onClick={() => onSelect(null)}
|
||||||
|
className={`text-sm px-3 py-1 rounded-full border transition ${
|
||||||
|
selectedTag === null
|
||||||
|
? "bg-gray-800 text-white"
|
||||||
|
: "bg-white text-gray-700 hover:bg-gray-100"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
全て
|
||||||
|
</button>
|
||||||
|
{tags.map((tag, i) => (
|
||||||
|
<button
|
||||||
|
key={i}
|
||||||
|
onClick={() => onSelect(tag)}
|
||||||
|
className={`text-sm px-3 py-1 rounded-full border transition ${
|
||||||
|
selectedTag === tag
|
||||||
|
? "bg-gray-800 text-white"
|
||||||
|
: "bg-white text-gray-700 hover:bg-gray-100"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
#{tag}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
0
src/components/news/index.ts
Normal file
26
src/components/providers/CompanyProvider.tsx
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { createContext, useContext } from "react";
|
||||||
|
import type { CompanyInfo } from "@/types/company";
|
||||||
|
|
||||||
|
const CompanyContext = createContext<CompanyInfo | null>(null);
|
||||||
|
|
||||||
|
export function useCompany() {
|
||||||
|
const ctx = useContext(CompanyContext);
|
||||||
|
if (!ctx) throw new Error("useCompany must be used inside CompanyProvider");
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CompanyProvider({
|
||||||
|
company,
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
company: CompanyInfo;
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<CompanyContext.Provider value={company}>
|
||||||
|
{children}
|
||||||
|
</CompanyContext.Provider>
|
||||||
|
);
|
||||||
|
}
|
||||||
15
src/components/schedule/ScheduleComment.tsx
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
// src/components/schedule/ScheduleComment.tsx
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
interface ScheduleCommentProps {
|
||||||
|
html: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function ScheduleComment({ html }: ScheduleCommentProps) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="px-6 py-8 text-stone-700 font-sans text-sm leading-relaxed prose prose-stone max-w-none"
|
||||||
|
dangerouslySetInnerHTML={{ __html: html }}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
121
src/components/ui/Carousel.tsx
Normal file
|
|
@ -0,0 +1,121 @@
|
||||||
|
// src/components/ui/Carousel.tsx
|
||||||
|
/* eslint-disable @next/next/no-img-element */
|
||||||
|
"use client";
|
||||||
|
import { useState, useEffect } from "react";
|
||||||
|
|
||||||
|
interface CarouselProps {
|
||||||
|
name?: string;
|
||||||
|
images: string[];
|
||||||
|
interval?: number;
|
||||||
|
autoPlay?: boolean;
|
||||||
|
className?: string;
|
||||||
|
enableZoom?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Carousel({
|
||||||
|
name = "",
|
||||||
|
images,
|
||||||
|
interval = 5000,
|
||||||
|
autoPlay = true,
|
||||||
|
className = "",
|
||||||
|
enableZoom = false,
|
||||||
|
}: CarouselProps) {
|
||||||
|
const [current, setCurrent] = useState(0);
|
||||||
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
const total = images.length;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!autoPlay || total <= 1) return;
|
||||||
|
const timer = setInterval(() => {
|
||||||
|
setCurrent((prev) => (prev + 1) % total);
|
||||||
|
}, interval);
|
||||||
|
return () => clearInterval(timer);
|
||||||
|
}, [autoPlay, total, interval]);
|
||||||
|
|
||||||
|
if (total === 0) return null;
|
||||||
|
|
||||||
|
const next = () => setCurrent((p) => (p + 1) % total);
|
||||||
|
const prev = () => setCurrent((p) => (p - 1 + total) % total);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className={`relative w-full bg-stone-100 flex flex-col items-center ${className}`}>
|
||||||
|
{/* ✅ 高さ固定せず、画像サイズに応じて親が伸縮 */}
|
||||||
|
<div className="w-full flex justify-center items-center overflow-visible">
|
||||||
|
<img
|
||||||
|
key={images[current]}
|
||||||
|
src={`${images[current]}`}
|
||||||
|
alt={`${name} ${current + 1}`}
|
||||||
|
className={`block max-w-full h-auto object-contain transition-all duration-500 ${
|
||||||
|
enableZoom ? "cursor-zoom-in" : ""
|
||||||
|
}`}
|
||||||
|
style={{
|
||||||
|
maxHeight: "90vh", // 画面より大きくならないよう保険
|
||||||
|
}}
|
||||||
|
loading={current === 0 ? "eager" : "lazy"}
|
||||||
|
onClick={() => {
|
||||||
|
if (enableZoom) {
|
||||||
|
setIsOpen(true);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* ナビゲーション */}
|
||||||
|
{total > 1 && (
|
||||||
|
<>
|
||||||
|
<button
|
||||||
|
onClick={prev}
|
||||||
|
className="absolute left-4 top-1/2 -translate-y-1/2 bg-white/80 hover:bg-white text-gray-700 rounded-full p-2 shadow-md"
|
||||||
|
aria-label="Previous"
|
||||||
|
>
|
||||||
|
‹
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={next}
|
||||||
|
className="absolute right-4 top-1/2 -translate-y-1/2 bg-white/80 hover:bg-white text-gray-700 rounded-full p-2 shadow-md"
|
||||||
|
aria-label="Next"
|
||||||
|
>
|
||||||
|
›
|
||||||
|
</button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* ドット */}
|
||||||
|
{total > 1 && (
|
||||||
|
<div className="flex justify-center gap-2 mt-3">
|
||||||
|
{images.map((_, i) => (
|
||||||
|
<button
|
||||||
|
key={i}
|
||||||
|
onClick={() => setCurrent(i)}
|
||||||
|
className={`h-2 w-2 rounded-full transition-colors ${
|
||||||
|
i === current ? "bg-gray-800" : "bg-gray-300"
|
||||||
|
}`}
|
||||||
|
aria-label={`Go to slide ${i + 1}`}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* ✅ フルスクリーン拡大表示(enableZoom時のみ) */}
|
||||||
|
{enableZoom && isOpen && (
|
||||||
|
<div
|
||||||
|
className="fixed inset-0 z-50 bg-black/90 flex items-center justify-center"
|
||||||
|
onClick={() => setIsOpen(false)}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src={images[current]}
|
||||||
|
alt={`${name} zoomed`}
|
||||||
|
className="max-h-[95vh] max-w-[95vw] object-contain"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
onClick={() => setIsOpen(false)}
|
||||||
|
className="absolute top-4 right-4 text-white text-3xl"
|
||||||
|
>
|
||||||
|
✕
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
35
src/components/ui/LoadingLayout.tsx
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
"use client";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { usePathname } from "next/navigation";
|
||||||
|
import LoadingOverlay from "@/components/ui/LoadingOverlay";
|
||||||
|
|
||||||
|
export default function LoadingLayout({ children }: { children: React.ReactNode }) {
|
||||||
|
const pathname = usePathname();
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleClick = (e: MouseEvent) => {
|
||||||
|
const target = e.target as HTMLElement | null;
|
||||||
|
const anchor = target?.closest("a[href]") as HTMLAnchorElement | null;
|
||||||
|
// 🔸 target="_blank" のリンクは除外
|
||||||
|
if (anchor && !anchor.target && anchor.href.startsWith(window.location.origin)) {
|
||||||
|
setLoading(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
window.addEventListener("click", handleClick);
|
||||||
|
return () => window.removeEventListener("click", handleClick);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// ページが切り替わったらローディングを止める
|
||||||
|
useEffect(() => {
|
||||||
|
const timer = setTimeout(() => setLoading(false), 500);
|
||||||
|
return () => clearTimeout(timer);
|
||||||
|
}, [pathname]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{children}
|
||||||
|
<LoadingOverlay visible={loading} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
25
src/components/ui/LoadingOverlay.tsx
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
"use client";
|
||||||
|
import { motion, AnimatePresence } from "framer-motion";
|
||||||
|
|
||||||
|
export default function LoadingOverlay({ visible }: { visible: boolean }) {
|
||||||
|
return (
|
||||||
|
<AnimatePresence>
|
||||||
|
{visible && (
|
||||||
|
<motion.div
|
||||||
|
initial={{ opacity: 0 }}
|
||||||
|
animate={{ opacity: 1 }}
|
||||||
|
exit={{ opacity: 0 }}
|
||||||
|
transition={{ duration: 0.3 }}
|
||||||
|
className="fixed inset-0 z-[9999] flex items-center justify-center
|
||||||
|
bg-white/60 backdrop-blur-sm"
|
||||||
|
>
|
||||||
|
<div className="flex flex-col items-center text-stone-700">
|
||||||
|
{/* ロゴ or スピナー */}
|
||||||
|
<div className="w-10 h-10 border-4 border-stone-300 border-t-brand rounded-full animate-spin" />
|
||||||
|
<p className="mt-4 text-sm">Loading...</p>
|
||||||
|
</div>
|
||||||
|
</motion.div>
|
||||||
|
)}
|
||||||
|
</AnimatePresence>
|
||||||
|
);
|
||||||
|
}
|
||||||
8
src/lib/api.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
// src/lib/api.ts
|
||||||
|
export async function fetchNews(limit = 5) {
|
||||||
|
const res = await fetch(
|
||||||
|
`${process.env.NEXT_PUBLIC_DIRECTUS_URL}/items/news?sort=-published_at&limit=${limit}`,
|
||||||
|
);
|
||||||
|
const data = await res.json();
|
||||||
|
return data.data;
|
||||||
|
}
|
||||||
16
src/lib/db.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
// src/lib/db.ts
|
||||||
|
import mysql from "mysql2/promise";
|
||||||
|
|
||||||
|
export const dbConfig = {
|
||||||
|
host: process.env.DB_HOST,
|
||||||
|
port: Number(process.env.DB_PORT),
|
||||||
|
user: process.env.DB_USER,
|
||||||
|
password: process.env.DB_PASSWORD,
|
||||||
|
database: process.env.DB_NAME,
|
||||||
|
};
|
||||||
|
|
||||||
|
// ✅ 接続ヘルパー
|
||||||
|
export async function getConnection() {
|
||||||
|
const conn = await mysql.createConnection(dbConfig);
|
||||||
|
return conn;
|
||||||
|
}
|
||||||
47
src/lib/directus/brand.ts
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
// src/lib/directus/brand.ts
|
||||||
|
import { directusFetch } from "@/lib/directus/";
|
||||||
|
|
||||||
|
export type BrandContact = {
|
||||||
|
id: number;
|
||||||
|
label: string;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type BrandNote = {
|
||||||
|
id: number;
|
||||||
|
content: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type BrandItem = {
|
||||||
|
id: number;
|
||||||
|
brand_name: string;
|
||||||
|
business_hour_start: string;
|
||||||
|
business_hour_end: string;
|
||||||
|
business_hours_comment?: string;
|
||||||
|
contents?: string; // HTML対応紹介文
|
||||||
|
contacts?: BrandContact[];
|
||||||
|
notes?: BrandNote[];
|
||||||
|
image?: { directus_files_id: string }[]; // 多対多対応
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全ブランド情報を取得
|
||||||
|
*/
|
||||||
|
export async function getAllBrands(): Promise<BrandItem[]> {
|
||||||
|
return await directusFetch<BrandItem[]>(
|
||||||
|
`/items/company_brand?fields=id,brand_name,business_hour_start,business_hour_end,business_hours_comment,contents,contacts.id,contacts.label,contacts.value,notes.id,notes.content,image.directus_files_id&sort=id`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 単一ブランドをIDで取得
|
||||||
|
*/
|
||||||
|
export async function getBrandById(id: number): Promise<BrandItem | null> {
|
||||||
|
try {
|
||||||
|
return await directusFetch<BrandItem>(
|
||||||
|
`/items/company_brand/${id}?fields=id,brand_name,business_hour_start,business_hour_end,business_hours_comment,contents,contacts.id,contacts.label,contacts.value,notes.id,notes.content,image.directus_files_id`
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
107
src/lib/directus/company.ts
Normal file
|
|
@ -0,0 +1,107 @@
|
||||||
|
import { directusFetch } from "@/lib/directus/index";
|
||||||
|
|
||||||
|
// ========== 型定義 ==========
|
||||||
|
export type CompanyContact = { id: number; label: string; value: string };
|
||||||
|
export type BrandContact = { id: number; label: string; value: string };
|
||||||
|
export type BrandNote = { id: number; content: string };
|
||||||
|
export type CompanyNote = { id: number; content: string };
|
||||||
|
|
||||||
|
export type Brand = {
|
||||||
|
id: number;
|
||||||
|
brand_name: string;
|
||||||
|
business_hour_start: string; // ← sなし
|
||||||
|
business_hour_end: string; // ← sなし
|
||||||
|
business_hours_comment?: string;
|
||||||
|
contacts?: BrandContact[];
|
||||||
|
notes?: BrandNote[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Company = {
|
||||||
|
id: number;
|
||||||
|
company_name: string;
|
||||||
|
postal_code?: string;
|
||||||
|
address?: string;
|
||||||
|
contacts?: CompanyContact[];
|
||||||
|
brand_ids?: number[];
|
||||||
|
brand_list?: Brand[];
|
||||||
|
notes?: CompanyNote[];
|
||||||
|
map_embed?: string;
|
||||||
|
// 追加カラム
|
||||||
|
build_date?: string; // 会社設立日
|
||||||
|
Representative_director?: string; // 代表者名
|
||||||
|
corp_number?: string; // 法人番号
|
||||||
|
invoice_number?: string; // インボイス登録番号
|
||||||
|
};
|
||||||
|
|
||||||
|
// ========== 共通 fetch ヘルパー ==========
|
||||||
|
// async function directusFetch<T>(path: string): Promise<T> {
|
||||||
|
// const res = await fetch(`${BASE_URL}${path}`, {
|
||||||
|
// headers: { Accept: "application/json" },
|
||||||
|
// next: { revalidate: 120 },
|
||||||
|
// });
|
||||||
|
// if (!res.ok) throw new Error(`Directus fetch failed: ${res.status}`);
|
||||||
|
// const json = await res.json();
|
||||||
|
// return json.data as T;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// ========== 会社情報 + ブランド取得(二段fetch) ==========
|
||||||
|
export async function getCompanyData(): Promise<Company> {
|
||||||
|
// --- ① company_info(基本情報とbrand IDs)---
|
||||||
|
const companyRes = await directusFetch<
|
||||||
|
{
|
||||||
|
id: number;
|
||||||
|
company_name: string;
|
||||||
|
postal_code: string;
|
||||||
|
address: string;
|
||||||
|
map_embed: string;
|
||||||
|
contacts: CompanyContact[];
|
||||||
|
brand: number[];
|
||||||
|
notes: CompanyNote[];
|
||||||
|
// ✅ 新しいフィールド
|
||||||
|
build_date?: string;
|
||||||
|
representative_director?: string;
|
||||||
|
corp_number?: string;
|
||||||
|
invoice_number?: string;
|
||||||
|
}[]
|
||||||
|
>(
|
||||||
|
`/items/company_info?fields[]=
|
||||||
|
id,
|
||||||
|
company_name,
|
||||||
|
postal_code,
|
||||||
|
address,
|
||||||
|
map_embed,
|
||||||
|
contacts.id,
|
||||||
|
contacts.label,
|
||||||
|
contacts.value,
|
||||||
|
brand,
|
||||||
|
notes.id,
|
||||||
|
notes.content,
|
||||||
|
build_date,
|
||||||
|
Representative_director,
|
||||||
|
corp_number,
|
||||||
|
invoice_number
|
||||||
|
&limit=1`.replace(/\s+/g, "")
|
||||||
|
);
|
||||||
|
|
||||||
|
const company = companyRes[0];
|
||||||
|
if (!company) throw new Error("Company data not found");
|
||||||
|
|
||||||
|
// --- ② brand詳細 ---
|
||||||
|
const brandIds = company.brand;
|
||||||
|
if (!brandIds || brandIds.length === 0) {
|
||||||
|
return { ...company, brand_ids: [], brand_list: [] };
|
||||||
|
}
|
||||||
|
const brandQuery =
|
||||||
|
`/items/company_brand?filter[id][_in]=${brandIds.join(",")}` +
|
||||||
|
`&fields[]=id&fields[]=brand_name&fields[]=business_hour_start&fields[]=business_hour_end` +
|
||||||
|
`&fields[]=business_hours_comment&fields[]=contacts.id&fields[]=contacts.label&fields[]=contacts.value`;
|
||||||
|
|
||||||
|
const brandRes = await directusFetch<Brand[]>(brandQuery);
|
||||||
|
|
||||||
|
// --- ③ 結果統合 ---
|
||||||
|
return {
|
||||||
|
...company,
|
||||||
|
brand_ids: brandIds,
|
||||||
|
brand_list: brandRes,
|
||||||
|
};
|
||||||
|
}
|
||||||
14
src/lib/directus/index.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
// src/lib/directus/index.ts
|
||||||
|
export const BASE_URL = process.env.NEXT_PUBLIC_DIRECTUS_URL!;
|
||||||
|
|
||||||
|
// 共通Directusフェッチヘルパー
|
||||||
|
export async function directusFetch<T>(path: string, revalidate: number = 60): Promise<T> {
|
||||||
|
const res = await fetch(`${BASE_URL}${path}`, {
|
||||||
|
headers: { Accept: "application/json" },
|
||||||
|
next: { revalidate },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!res.ok) throw new Error(`Directus fetch failed: ${res.status}`);
|
||||||
|
const json = await res.json();
|
||||||
|
return json.data as T;
|
||||||
|
}
|
||||||
33
src/lib/directus/news.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
// src/lib/directus/news.ts
|
||||||
|
import { directusFetch } from "@/lib/directus/index";
|
||||||
|
import { NewsItem } from "@/types/news";
|
||||||
|
/**
|
||||||
|
* 最新ニュース5件取得
|
||||||
|
*/
|
||||||
|
export async function getLatestNews(): Promise<NewsItem[]> {
|
||||||
|
return await directusFetch<NewsItem[]>(
|
||||||
|
`/items/news?sort[]=-published_at&limit=5&fields[]=id&fields[]=title&fields[]=slug&fields[]=published_at&fields[]=thumbnail.id&fields[]=thumbnail.filename_disk&fields[]=linkurl&fields[]=link_target&fields[]=tags`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全ニュース一覧取得
|
||||||
|
*/
|
||||||
|
export async function getAllNews(): Promise<NewsItem[]> {
|
||||||
|
return await directusFetch<NewsItem[]>(
|
||||||
|
`/items/news?sort[]=-published_at&fields[]=id&fields[]=title&fields[]=slug&fields[]=published_at&fields[]=thumbnail.id&fields[]=thumbnail.filename_disk&fields[]=linkurl&fields[]=link_target&fields[]=tags&fields[]=content`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ニュースID指定で詳細取得
|
||||||
|
*/
|
||||||
|
export async function getNewsById(id: number): Promise<NewsItem | null> {
|
||||||
|
try {
|
||||||
|
return await directusFetch<NewsItem>(
|
||||||
|
`/items/news/${id}?fields=id,title,content,published_at,tags,status,thumbnail.id,mainimg.*`
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
38
src/lib/directus/schedule.ts
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
// lib/directus.schedule.ts
|
||||||
|
import { directusFetch } from "@/lib/directus/index";
|
||||||
|
|
||||||
|
export type Schedule = {
|
||||||
|
id: number;
|
||||||
|
ch_ym: string;
|
||||||
|
ch_img: string;
|
||||||
|
ch_img2?: string;
|
||||||
|
comment?: string | null;
|
||||||
|
img_xy?: "horizontal" | "vertical"; // レイアウト指定
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ScheduleItem = {
|
||||||
|
id: number;
|
||||||
|
ch_ym: string;
|
||||||
|
ch_img: string;
|
||||||
|
ch_img2?: string;
|
||||||
|
comment?: string;
|
||||||
|
img_xy?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* すべてのスケジュールを取得
|
||||||
|
*/
|
||||||
|
export async function getAllSchedules(): Promise<ScheduleItem[]> {
|
||||||
|
return await directusFetch<ScheduleItem[]>(
|
||||||
|
`/items/schedule?sort[]=-ch_ym&fields[]=id&fields[]=ch_ym&fields[]=ch_img&fields[]=ch_img2&fields[]=comment&fields[]=img_xy`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最新3件のスケジュールを取得(TOPページなど)
|
||||||
|
*/
|
||||||
|
export async function getLatestSchedules(): Promise<ScheduleItem[]> {
|
||||||
|
return await directusFetch<ScheduleItem[]>(
|
||||||
|
`/items/schedule?sort[]=-ch_ym&limit=3&fields[]=id&fields[]=ch_ym&fields[]=ch_img&fields[]=ch_img2&fields[]=comment&fields[]=img_xy`
|
||||||
|
);
|
||||||
|
}
|
||||||
34
src/lib/fonts.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
// src/lib/fonts.ts
|
||||||
|
import { M_PLUS_Rounded_1c } from "next/font/google";
|
||||||
|
import { Shippori_Mincho } from "next/font/google";
|
||||||
|
import { Yusei_Magic } from "next/font/google";
|
||||||
|
import { RocknRoll_One } from "next/font/google";
|
||||||
|
|
||||||
|
// ✅ 各フォントを「関数呼び出し形式」で設定
|
||||||
|
export const rounded = M_PLUS_Rounded_1c({
|
||||||
|
subsets: ["latin"],
|
||||||
|
weight: ["400", "500", "700"],
|
||||||
|
variable: "--font-rounded", // ← CSS変数として登録
|
||||||
|
display: "swap",
|
||||||
|
});
|
||||||
|
|
||||||
|
export const mincho = Shippori_Mincho({
|
||||||
|
subsets: ["latin"],
|
||||||
|
weight: ["400", "700"],
|
||||||
|
variable: "--font-mincho",
|
||||||
|
display: "swap",
|
||||||
|
});
|
||||||
|
|
||||||
|
export const yusei = Yusei_Magic({
|
||||||
|
subsets: ["latin"],
|
||||||
|
weight: ["400"],
|
||||||
|
variable: "--font-yusei",
|
||||||
|
display: "swap",
|
||||||
|
});
|
||||||
|
|
||||||
|
export const rocknroll = RocknRoll_One({
|
||||||
|
subsets: ["latin"],
|
||||||
|
weight: ["400"],
|
||||||
|
variable: "--font-rocknroll",
|
||||||
|
display: "swap",
|
||||||
|
});
|
||||||
10
src/lib/getCompanyBrandInfo.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
import type { CompanyBrand } from "@/types/brand";
|
||||||
|
|
||||||
|
export async function getCompanyBrandInfo(): Promise<CompanyBrand[]> {
|
||||||
|
const base =
|
||||||
|
process.env.NEXT_PUBLIC_SITE_ORIGIN || process.env.VERCEL_URL || "http://localhost:3000";
|
||||||
|
const url = new URL("/api/company/brand", base).toString();
|
||||||
|
const res = await fetch(url, { next: { revalidate: 3600 } });
|
||||||
|
if (!res.ok) throw new Error("Failed to fetch /api/company/brand");
|
||||||
|
return res.json() as Promise<CompanyBrand[]>;
|
||||||
|
}
|
||||||
10
src/lib/getCompanyInfo.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
import type { CompanyInfo } from "@/types/company";
|
||||||
|
|
||||||
|
export async function getCompanyInfo(): Promise<CompanyInfo> {
|
||||||
|
const base =
|
||||||
|
process.env.NEXT_PUBLIC_SITE_ORIGIN || process.env.VERCEL_URL || "http://localhost:3000";
|
||||||
|
const url = new URL("/api/company/info", base).toString();
|
||||||
|
const res = await fetch(url, { cache: "no-store" }); // ここでキャッシュ方針統一
|
||||||
|
if (!res.ok) throw new Error("Failed to fetch /api/company/info");
|
||||||
|
return res.json() as Promise<CompanyInfo>;
|
||||||
|
}
|
||||||
30
src/lib/mail.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
import nodemailer from "nodemailer";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BaseCafe mail utility module
|
||||||
|
* 現在は sendmail 経由のみ(将来 Gmail API / SMTP 対応予定)
|
||||||
|
*/
|
||||||
|
export const mailer = nodemailer.createTransport({
|
||||||
|
sendmail: true,
|
||||||
|
newline: "unix",
|
||||||
|
path: "/usr/sbin/sendmail", // Ubuntu標準パス
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* メール送信テスト関数
|
||||||
|
*/
|
||||||
|
export async function sendTestMail(to: string) {
|
||||||
|
try {
|
||||||
|
const info = await mailer.sendMail({
|
||||||
|
from: "noreply@basecafe.jp",
|
||||||
|
to,
|
||||||
|
subject: "[BaseCafe] テストメール",
|
||||||
|
text: "このメールは BaseCafe サーバからの送信テストです。",
|
||||||
|
});
|
||||||
|
console.log("✅ Mail sent:", info.envelope);
|
||||||
|
return info;
|
||||||
|
} catch (error) {
|
||||||
|
console.error("❌ Mail send failed:", error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
24
src/lib/reservation.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
// src/lib/reservation.ts
|
||||||
|
import { RowDataPacket } from "mysql2/promise";
|
||||||
|
import type { Reservation } from "@/types/reservation";
|
||||||
|
import { getConnection } from "@/lib/db";
|
||||||
|
|
||||||
|
export type { Reservation } from "@/types/reservation";
|
||||||
|
|
||||||
|
export async function getRoomReservations(
|
||||||
|
room: string,
|
||||||
|
): Promise<Reservation[]> {
|
||||||
|
const conn = await getConnection();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const [rows] = await conn.execute<RowDataPacket[]>(
|
||||||
|
`SELECT room, type, sdate, start, end, summary, datetime
|
||||||
|
FROM room_schedule
|
||||||
|
WHERE room = ?`,
|
||||||
|
[room],
|
||||||
|
);
|
||||||
|
return rows as unknown as Reservation[];
|
||||||
|
} finally {
|
||||||
|
await conn.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/lib/roominfo.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
export type RoomInfoType = {
|
||||||
|
url: string;
|
||||||
|
// 将来的に他の情報も追加可能
|
||||||
|
capacity?: number;
|
||||||
|
description?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const RoomInfo: Record<string, RoomInfoType> = {
|
||||||
|
ENJI: { url: "https://spayce.jp/BaseBettaku/space/16/reserve" },
|
||||||
|
PINK: { url: "https://spayce.jp/BaseBettaku/space/17/reserve" },
|
||||||
|
MINT: { url: "https://spayce.jp/BaseBettaku/space/18/reserve" },
|
||||||
|
};
|
||||||
9
src/types/brand.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
export interface CompanyBrand {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
business_hours: { start: string; end: string; comment: string | null };
|
||||||
|
contents: string;
|
||||||
|
contacts: { id: number; label: string; value: string }[];
|
||||||
|
notes: { id: number; content: string }[];
|
||||||
|
images: string[]; // Directus file id list
|
||||||
|
}
|
||||||
34
src/types/company.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
export interface Contact {
|
||||||
|
id: number;
|
||||||
|
label: string;
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
export interface Note {
|
||||||
|
id: number;
|
||||||
|
content: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BrandLite {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
business_hours: { start: string; end: string; comment: string | null };
|
||||||
|
contents: string;
|
||||||
|
contacts: number[] | { id: number; label: string; value: string }[]; // Directus構成による
|
||||||
|
images: string[]; // or string[] (file id)
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CompanyInfo {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
postal_code?: string;
|
||||||
|
address?: string;
|
||||||
|
map_embed?: string;
|
||||||
|
top_banner?: string;
|
||||||
|
contacts: Contact[];
|
||||||
|
notes: Note[];
|
||||||
|
brands: BrandLite[]; // brand.*.* 展開済み(あれば)
|
||||||
|
build_date?: string; // 会社設立日 (Date)
|
||||||
|
representative_director?: string; // 代表者名
|
||||||
|
corp_number?: string; // 法人番号
|
||||||
|
invoice_number?: string; // 適格事業者登録番号
|
||||||
|
}
|
||||||
20
src/types/news.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
// src/types/news.ts
|
||||||
|
export interface NewsImage {
|
||||||
|
id: number;
|
||||||
|
news_id: number;
|
||||||
|
directus_files_id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface NewsItem {
|
||||||
|
id: number;
|
||||||
|
title: string;
|
||||||
|
slug?: string;
|
||||||
|
published_at?: string;
|
||||||
|
status?: number; // ← ここは optional 推奨
|
||||||
|
thumbnail?: { id: string; filename_disk?: string };
|
||||||
|
linkurl?: string;
|
||||||
|
link_target?: string;
|
||||||
|
tags?: string[];
|
||||||
|
content?: string;
|
||||||
|
mainimg?: { directus_files_id: { id: string; filename_download: string } }[];
|
||||||
|
}
|
||||||
14
src/types/reservation.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
// src/types/reservation.ts
|
||||||
|
|
||||||
|
import type { RowDataPacket } from "mysql2/promise";
|
||||||
|
|
||||||
|
// MySQLの1行を表す型
|
||||||
|
export interface Reservation extends RowDataPacket {
|
||||||
|
room: string;
|
||||||
|
type: string;
|
||||||
|
sdate: string;
|
||||||
|
start: string;
|
||||||
|
end: string;
|
||||||
|
summary: string;
|
||||||
|
datetime: string;
|
||||||
|
}
|
||||||
33
tailwind.config.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
// import type { Config } from "tailwindcss";
|
||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
import type { Config } from "tailwindcss";
|
||||||
|
import lineClamp from "@tailwindcss/line-clamp";
|
||||||
|
const config: Config = {
|
||||||
|
content: {
|
||||||
|
files: [
|
||||||
|
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
|
||||||
|
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
|
||||||
|
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
|
||||||
|
],
|
||||||
|
// @ts-expect-error -- TailwindCSS v4.x: `safelist` not yet typed but supported
|
||||||
|
safelist: [
|
||||||
|
{
|
||||||
|
pattern:
|
||||||
|
/text-(red|blue|green|yellow|gray|stone|emerald|sky|pink|purple|white)-(100|200|300|400|500|600|700|800|900)/,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
theme: {
|
||||||
|
extend: {
|
||||||
|
fontFamily: {
|
||||||
|
sans: ["var(--font-rounded)", "Noto Sans JP", "sans-serif"],
|
||||||
|
heading: ["var(--font-yusei)", "sans-serif"],
|
||||||
|
serif: ["var(--font-mincho)", "serif"],
|
||||||
|
deco: ["var(--font-rocknroll)", "sans-serif"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
plugins: [lineClamp],
|
||||||
|
};
|
||||||
|
export default config;
|
||||||
36
tsconfig.json
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2017",
|
||||||
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
|
"allowJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"strict": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"jsx": "preserve",
|
||||||
|
"types": ["react", "react-dom"],
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"incremental": true,
|
||||||
|
"plugins": [
|
||||||
|
{
|
||||||
|
"name": "next"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"baseUrl": "src",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"next-env.d.ts",
|
||||||
|
"**/*.ts",
|
||||||
|
"**/*.tsx",
|
||||||
|
".next/types/**/*.ts",
|
||||||
|
".next/types/app/news/[id]/page.tsx"
|
||||||
|
],
|
||||||
|
"exclude": ["node_modules"]
|
||||||
|
}
|
||||||