Skip to content

Commit

Permalink
Added achievements, info cards about trainers
Browse files Browse the repository at this point in the history
  • Loading branch information
arlagonix committed Jul 10, 2024
1 parent 00b6008 commit 464764d
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 16 deletions.
51 changes: 51 additions & 0 deletions src/app/trainers/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Section from '@/components/Section'
import { trainersData } from '@/data/trainersData'
import Image from 'next/image'
import { notFound } from 'next/navigation'
import { PropsWithChildren } from 'react'

const breadCrumbsData: BreadcrumbType[] = [
{
Expand All @@ -21,6 +22,31 @@ const breadCrumbsData: BreadcrumbType[] = [
},
]

const CardsWrapper = ({ children }: PropsWithChildren) => {
return (
<div className="mt-6 flex flex-wrap justify-center gap-6">{children}</div>
)
}

const Card = ({
title,
description,
}: {
title: string
description?: string
}) => {
return (
<div className="flex max-w-[240px] flex-[0_1] basis-[240px] flex-col justify-center gap-2 rounded-xl border border-slate-100 bg-white p-6 shadow-md mobile:max-w-[100%] mobile:basis-[100%]">
<p className="text-center text-xl">
<strong>{title}</strong>
</p>
{description && (
<p className="text-center text-slate-500">{description}</p>
)}
</div>
)
}

const TrainerPage = ({ params: { slug } }: { params: { slug: string } }) => {
const trainer = trainersData.find((item) => item.slug === slug)
if (trainer === undefined) notFound()
Expand Down Expand Up @@ -51,7 +77,32 @@ const TrainerPage = ({ params: { slug } }: { params: { slug: string } }) => {
{item}
</P>
))}
{trainer.aboutCards !== undefined && (
<CardsWrapper>
{trainer.aboutCards.map((item) => (
<Card
key={item.title}
title={item.title}
description={item.description}
/>
))}
</CardsWrapper>
)}
</Section>
{trainer.achievements !== undefined && (
<Section>
<H2>Достижения</H2>
<CardsWrapper>
{trainer?.achievements?.map((item) => (
<Card
key={item.title}
title={item.title}
description={item.description}
/>
))}
</CardsWrapper>
</Section>
)}
</Main>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/trainers/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const TrainersPage = () => {
<Main>
<H1>Преподаватели</H1>
<Breadcrumbs breadcrumbsData={breadCrumbsData} />
<div className="mt-16 grid grid-cols-[repeat(auto-fit,minmax(min(320px,100%),1fr))] gap-16">
<div className="mt-8 grid grid-cols-[repeat(auto-fit,minmax(min(320px,100%),1fr))] gap-16">
{trainersData.map((trainer) => (
<TrainerCard
key={trainer.name}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type BreadcrumbsProps = {
const Breadcrumbs = ({ breadcrumbsData }: BreadcrumbsProps) => {
if (breadcrumbsData.length === 0) return null
return (
<div className="mt-4 flex items-center justify-center gap-2">
<div className="mt-8 flex flex-wrap items-center justify-center gap-2">
{breadcrumbsData.map((item, index, arr) => {
if (index !== arr.length - 1)
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/ClassSignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const ClassSignUp = ({
isIncludeContract = false,
}: ClassSignUpProps) => {
return (
<div className="mt-16 flex flex-col gap-4">
<div className="mt-8 flex flex-col gap-4">
<p className="text-center">
{description ??
'Начни танцевать хастл бесплатно: запишись на бесплатный пробный урок'}
Expand Down
93 changes: 80 additions & 13 deletions src/data/trainersData.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const defaultPath = '/trainers'

// link: `${defaultPath}/roman_samohvalov`,

export const trainersData: TrainerType[] = [
{
slug: 'roman_samohvalov',
Expand All @@ -12,9 +10,68 @@ export const trainersData: TrainerType[] = [
'Танцует 19 лет',
'Преподает 10 лет',
],
aboutCards: [
{
title: 'Судья 1-й категории АСХ',
},
{
title: 'А класс',
description: 'Хастл/Дискофокс',
},
{
title: 'Champion класс',
description: 'Хастл ДнД',
},
{
title: '19 лет',
description: 'Танцует',
},
{
title: '10 лет',
description: 'Преподает',
},
],
pageDescription: ['Руководитель Школы танцев D.A.N.C.E'],
ranks: ['Champion', 'A'],
imgSrc: '/trainers/roman_samohvalov.jpg',
imgSrc: `${defaultPath}/roman_samohvalov.jpg`,
achievements: [
{
title: 'Вице-чемпион России',
description: "Абсолют '23",
},
{
title: 'Чемпион Москвы',
description: "А класс '22/'23",
},
{
title: 'Победитель Nord Cup',
description: "Абсолют '23",
},
{
title: 'Абсолютный Чемпион России',
description: "'18/'21",
},
{
title: 'Чемпион Галактики',
description: "Сhampion ДнД '19/'20",
},
{
title: 'Вице-чемпион Москвы',
description: "Champion ДнД '19/'21",
},
{
title: 'Чемпион России',
description: "Star ДнД '18",
},
{
title: 'Вице-чемпион Европы',
description: "IDO '18",
},
{
title: 'Чемпион России',
description: "Шоу '17",
},
],
},
{
slug: 'daria_koshevaya',
Expand All @@ -25,14 +82,14 @@ export const trainersData: TrainerType[] = [
'Преподает 14 лет',
],
ranks: ['Champion', 'A'],
imgSrc: '/trainers/daria_koshevaya.jpg',
imgSrc: `${defaultPath}/daria_koshevaya.jpg`,
},
{
slug: 'leonid_leonov',
name: 'Леонид Леонов',
description: ['Танцует 10 лет', 'Преподает 6 лет'],
ranks: ['Star', 'B'],
imgSrc: '/trainers/leonid_leonov.jpg',
imgSrc: `${defaultPath}/leonid_leonov.jpg`,
},
{
slug: 'daria_samohvalova',
Expand All @@ -43,49 +100,49 @@ export const trainersData: TrainerType[] = [
'Преподает 8 лет',
],
ranks: ['Main', 'D'],
imgSrc: '/trainers/daria_samohvalova.jpg',
imgSrc: `${defaultPath}/daria_samohvalova.jpg`,
},
{
slug: 'alexander_nosov',
name: 'Александр Носов',
description: ['Танцует 4 года', 'Преподает 2 года'],
ranks: ['Star', 'C'],
imgSrc: '/trainers/alexander_nosov.jpg',
imgSrc: `${defaultPath}/alexander_nosov.jpg`,
},
{
slug: 'anna_stramilova',
name: 'Анна Страмилова',
description: ['Танцует 4 года', 'Преподает 2 года'],
ranks: ['Main', 'D'],
imgSrc: '/trainers/anna_stramilova.jpg',
imgSrc: `${defaultPath}/anna_stramilova.jpg`,
},
{
slug: 'maxim_yaremchuk',
name: 'Максим Яремчук',
description: ['Танцует 7 лет', 'Преподает 2 года'],
ranks: ['Main', 'C'],
imgSrc: '/trainers/maxim_yaremchuk.jpg',
imgSrc: `${defaultPath}/maxim_yaremchuk.jpg`,
},
{
slug: 'vyacheslav_vyazov',
name: 'Вячеслав Вязов',
description: ['Танцует 11 лет', 'Преподает 9 лет'],
ranks: ['Main', 'C'],
imgSrc: '/trainers/vyacheslav_vyazov.jpg',
imgSrc: `${defaultPath}/vyacheslav_vyazov.jpg`,
},
{
slug: 'victoria_balganova',
name: 'Виктория Балганова',
description: ['Танцует 16 лет', 'Преподает 2 года'],
ranks: ['Star', 'C'],
imgSrc: '/trainers/victoria_balganova.jpg',
imgSrc: `${defaultPath}/victoria_balganova.jpg`,
},
{
slug: 'anna_vasilieva',
name: 'Анна Васильева',
description: ['Танцует 15 лет', 'Преподает 3 года'],
ranks: ['Star', 'D'],
imgSrc: '/trainers/anna_vasilieva.jpg',
imgSrc: `${defaultPath}/anna_vasilieva.jpg`,
},
{
slug: 'tatiana_parol',
Expand All @@ -95,7 +152,7 @@ export const trainersData: TrainerType[] = [
'Танцует 25 лет',
'Преподает 20 лет',
],
imgSrc: '/trainers/tatiana_parol.jpg',
imgSrc: `${defaultPath}/tatiana_parol.jpg`,
},
]

Expand All @@ -112,4 +169,14 @@ export type TrainerType = {
ranks?: string[]
/** Source of the trainer avatar image */
imgSrc: string
/** About the teacher in cards */
aboutCards?: {
title: string
description?: string
}[]
/** Trainer's achievements */
achievements?: {
title: string
description?: string
}[]
}

0 comments on commit 464764d

Please sign in to comment.