reworked slider + added coaches page

This commit is contained in:
Salam-vsem
2025-05-15 00:59:22 +03:00
parent 1b8cb5dae9
commit 2c1ebe5dae
32 changed files with 389 additions and 201 deletions

View File

@@ -1,4 +1,10 @@
import { defineCollection, z, type ImageFunction } from 'astro:content'
import { defineCollection, reference, z, type ImageFunction } from 'astro:content'
export const socialMediaLinkSchema = z.object({
icon: z.string(),
href: z.string(),
target: z.string().optional(),
})
export const heroSchema = (image: ImageFunction) =>
z.object({
@@ -15,14 +21,17 @@ export const heroSchema = (image: ImageFunction) =>
.optional(),
})
export const coachesSchema = (image: ImageFunction) =>
z.object({
name: z.string(),
description: z.string().optional(),
image: image(),
imageAlt: z.string(),
link: z.string().optional(),
})
export const coaches = defineCollection({
schema: ({ image }) =>
z.object({
name: z.string(),
description: z.string().optional(),
cover: image(),
coverAlt: z.string(),
gallery: z.array(image()).optional(),
socialMediaLinks: z.array(socialMediaLinkSchema).optional(),
}),
})
export const servicesSchema = z.object({
title: z.string(),
@@ -57,15 +66,7 @@ export const reviewsSchema = (image: ImageFunction) =>
export const footerSchema = z.object({
copyright: z.string().optional(),
socialMediaLinks: z
.array(
z.object({
icon: z.string(),
href: z.string(),
target: z.string().optional(),
})
)
.optional(),
socialMediaLinks: z.array(socialMediaLinkSchema).optional(),
})
const pages = defineCollection({
@@ -73,7 +74,6 @@ const pages = defineCollection({
z.object({
hero: heroSchema(image).optional(),
marquee: z.array(z.string()).optional(),
coaches: z.array(coachesSchema(image)).optional(),
reviews: z.array(reviewsSchema(image)).optional(),
slider: z
.array(
@@ -90,4 +90,5 @@ const pages = defineCollection({
export const collections = {
pages,
coaches,
}