From 721dc0d0a6f39903e92a518ae0dc57fbd70cf6a8 Mon Sep 17 00:00:00 2001 From: watchakorn-18k Date: Sun, 24 Nov 2024 21:36:55 +0700 Subject: [PATCH] fix : change background image --- next.config.ts | 4 +- src/app/globals.css | 8 +--- src/app/history/loading.tsx | 4 ++ src/app/history/page.tsx | 77 +++++++++++++++++++++++++++---------- src/app/layout.tsx | 14 ++++--- src/app/page.tsx | 2 +- tailwind.config.ts | 3 ++ 7 files changed, 75 insertions(+), 37 deletions(-) create mode 100644 src/app/history/loading.tsx diff --git a/next.config.ts b/next.config.ts index 240ee3d..9e7f18e 100644 --- a/next.config.ts +++ b/next.config.ts @@ -2,8 +2,8 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { /* config options here */ - basePath: "/18k-radio.github.io", - output: "export", + // basePath: "/18k-radio.github.io", + // output: "export", reactStrictMode: true, images: { remotePatterns: [ diff --git a/src/app/globals.css b/src/app/globals.css index d0d1cfa..bd6213e 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -1,9 +1,3 @@ @tailwind base; @tailwind components; -@tailwind utilities; - -@import url('https://fonts.googleapis.com/css2?family=Kanit:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap'); - -*{ - font-family: 'Kanit', sans-serif; -} \ No newline at end of file +@tailwind utilities; \ No newline at end of file diff --git a/src/app/history/loading.tsx b/src/app/history/loading.tsx new file mode 100644 index 0000000..d6a3f55 --- /dev/null +++ b/src/app/history/loading.tsx @@ -0,0 +1,4 @@ +export default function Loading() { + // Or a custom loading skeleton component + return

Loading...

+} \ No newline at end of file diff --git a/src/app/history/page.tsx b/src/app/history/page.tsx index bfc9e24..7858357 100644 --- a/src/app/history/page.tsx +++ b/src/app/history/page.tsx @@ -9,11 +9,13 @@ export default function History() { const [data, setData] = useState(); const [loading, setLoading] = useState(true); const [dataLogo, setDataLogo] = useState(); + const [currentBackground, setCurrentBackground] = useState(""); const GetData = async () => { const response = await fetchData(); setData(response); setDataLogo(response.images[0].logo); + setCurrentBackground(response.images[0].cover || ''); setLoading(false); } @@ -22,6 +24,7 @@ export default function History() { console.log(target.textContent); if (!data) return; setDataLogo(data.images.filter((image: ImageData) => image.year === target.textContent)[0].logo); + setCurrentBackground(data.images.filter((image: ImageData) => image.year === target.textContent)[0].cover || ''); } useEffect(() => { @@ -33,35 +36,67 @@ export default function History() { } return ( -
-
-

History

+
+ {/* พื้นหลังแบบเบลอ */} +
+ + {/* คอนเทนต์หลัก */} +
+

History

- {!loading ? Logo : } + {!loading ? ( + Logo + ) : ( + + )}
+ {/* Carousel */}
- {!loading && data.images?.map((image: ImageData, index: number) => ( - image.cover &&
- Cover -
- ))} + {!loading && + data.images?.map((image: ImageData, index: number) => ( + image.cover && ( +
+ Cover +
+ ) + ))}
-
- {!loading && data.images?.map((image: ImageData, index: number) => ( - image.cover && {image.year} - ))} +
+ {!loading && + data.images?.map((image: ImageData, index: number) => ( + image.cover && ( + + {image.year} + + ) + ))}
-
+ ) } \ No newline at end of file diff --git a/src/app/layout.tsx b/src/app/layout.tsx index efbfc89..8639814 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,13 +1,18 @@ import type { Metadata } from "next"; import "./globals.css"; import Navbar from "./components/Navbar"; -import Head from "next/head"; +import { Kanit } from 'next/font/google' export const metadata: Metadata = { title: "18K", - description: "About 18K Radio", + description: "About 18K Radio and its history.", + icons: { + icon: "/images/apple-touch-icon.png", + } }; +const kanit = Kanit({ subsets: ['latin'], weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'] }) + export default function RootLayout({ children, }: Readonly<{ @@ -15,10 +20,7 @@ export default function RootLayout({ }>) { return ( - - - - + {children} diff --git a/src/app/page.tsx b/src/app/page.tsx index 272146c..f6a35d4 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -36,7 +36,7 @@ const Page = () => {

ประวัติ

-

{!loading ? data.lang?.th?.story : }

+

{!loading ? data.lang?.th?.story : }

diff --git a/tailwind.config.ts b/tailwind.config.ts index fff2d7a..d78f85f 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -15,4 +15,7 @@ export default { }, }, plugins: [require('daisyui')], + daisyui: { + themes: ["light"], + } } satisfies Config;