From 5fb5a3d1ccbae3178888963c8477755713cdf7ff Mon Sep 17 00:00:00 2001 From: M1kola Date: Tue, 28 Jan 2025 13:37:53 +0300 Subject: [PATCH] static --- app/events/[slug]/page.tsx | 55 +++++++++--------------------- app/participants/[slug]/page.tsx | 24 ++++++------- components/client-component.tsx | 58 ++++++++++++++++++++++++++++++++ next.config.ts | 8 ++++- 4 files changed, 92 insertions(+), 53 deletions(-) create mode 100644 components/client-component.tsx diff --git a/app/events/[slug]/page.tsx b/app/events/[slug]/page.tsx index 53955d4..edbb8ca 100644 --- a/app/events/[slug]/page.tsx +++ b/app/events/[slug]/page.tsx @@ -1,39 +1,24 @@ -"use client"; -import React, { useState, useEffect } from 'react'; +import React from 'react'; import Breadcrumbs from "@/components/breadcrumb"; import InfoBlock from "@/components/info-block"; import NavSection from "@/components/nav-section"; -import InfoItem from "@/components/info-item"; -import HumanCard from "@/components/human-card"; import SocialItem from "@/components/social-item"; +import ClientComponent from "@/components/client-component"; -// export async function generateStaticParams() { -// // Моканные данные мероприятий -// const events = [ -// { slug: 'event-1' }, -// { slug: 'event-2' }, -// { slug: 'event-3' }, -// ]; -// -// return events.map(event => ({ -// slug: event.slug, -// })); -// } +export async function generateStaticParams() { + // Моканные данные мероприятий + const events = [ + { slug: 'event-1' }, + { slug: 'event-2' }, + { slug: 'event-3' }, + ]; + + return events.map(event => ({ + slug: event.slug, + })); +} export default function Page() { - const [isLg, setIsLg] = useState(false); - - useEffect(() => { - const handleResize = () => { - setIsLg(window.innerWidth >= 1024); - }; - - // Устанавливаем значение при первом рендере - handleResize(); - - window.addEventListener('resize', handleResize); - return () => window.removeEventListener('resize', handleResize); - }, []); const infoItems = [ { @@ -73,17 +58,7 @@ export default function Page() {

Базовая программа подготовки гештальт-терапевтов — добор

-
- {infoItems.map((item, index) => { - return - })} -
-
- {humanCards.map((card, index) => { - return - })} -
+
diff --git a/app/participants/[slug]/page.tsx b/app/participants/[slug]/page.tsx index 6ea436e..b3fde8e 100644 --- a/app/participants/[slug]/page.tsx +++ b/app/participants/[slug]/page.tsx @@ -5,18 +5,18 @@ import InfoItem from "@/components/info-item"; import Image from "next/image"; import SocialItem from "@/components/social-item"; -// export async function generateStaticParams() { -// // Моканные данные участников -// const participants = [ -// { slug: '1' }, -// { slug: '2' }, -// { slug: '3' }, -// ]; -// -// return participants.map(participant => ({ -// slug: participant.slug, -// })); -// } +export async function generateStaticParams() { + // Моканные данные участников + const participants = [ + { slug: '1' }, + { slug: '2' }, + { slug: '3' }, + ]; + + return participants.map(participant => ({ + slug: participant.slug, + })); +} export default function Page() { return( diff --git a/components/client-component.tsx b/components/client-component.tsx new file mode 100644 index 0000000..b0e43d8 --- /dev/null +++ b/components/client-component.tsx @@ -0,0 +1,58 @@ +"use client"; + +import React, { useState, useEffect } from 'react'; +import InfoItem from "@/components/info-item"; +import HumanCard from "@/components/human-card"; + +interface InfoItemProps { + name: string; + img?: string; +} + +interface HumanCardProps { + name: string; + post: string; + skills: string[]; +} + +interface ClientComponentProps { + infoItems: InfoItemProps[]; + humanCards: HumanCardProps[]; +} + +const ClientComponent: React.FC = ({ infoItems, humanCards }) => { + const [isLg, setIsLg] = useState(false); + + useEffect(() => { + const handleResize = () => { + setIsLg(window.innerWidth >= 1024); + }; + // Устанавливаем значение при первом рендере + handleResize(); + window.addEventListener('resize', handleResize); + return () => window.removeEventListener('resize', handleResize); + }, []); + + return ( + <> +
+ {infoItems.map((item, index) => ( + + ))} +
+
+ {humanCards.map((card, index) => ( + + ))} +
+ + ); +}; + +export default ClientComponent; \ No newline at end of file diff --git a/next.config.ts b/next.config.ts index 076eec9..46bddb1 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,7 +1,13 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { - // output: 'export' + output: 'export' +}; + +module.exports = { + images: { + unoptimized: true, + }, }; export default nextConfig;