96 lines
2.2 KiB
TypeScript
96 lines
2.2 KiB
TypeScript
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({
|
|
title: z.string(),
|
|
description: z.string(),
|
|
image: image(),
|
|
imageAlt: z.string(),
|
|
cta: z
|
|
.object({
|
|
title: z.string(),
|
|
href: z.string(),
|
|
target: z.string().optional(),
|
|
})
|
|
.optional(),
|
|
})
|
|
|
|
export const coaches = defineCollection({
|
|
schema: ({ image }) =>
|
|
z.object({
|
|
order: z.number().optional(),
|
|
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(),
|
|
description: z.string().optional(),
|
|
price: z.string().optional(),
|
|
link: z.object({
|
|
title: z.string(),
|
|
href: z.string(),
|
|
target: z.string().optional(),
|
|
}),
|
|
charachteristics: z
|
|
.array(
|
|
z.object({
|
|
text: z.string(),
|
|
price: z.string().optional(),
|
|
})
|
|
)
|
|
.optional(),
|
|
})
|
|
|
|
export const reviewsSchema = (image: ImageFunction) =>
|
|
z.object({
|
|
review: z.string(),
|
|
author: z.object({
|
|
name: z.string(),
|
|
description: z.string().optional(),
|
|
image: image(),
|
|
imageAlt: z.string(),
|
|
}),
|
|
rating: z.number(),
|
|
})
|
|
|
|
export const footerSchema = z.object({
|
|
copyright: z.string().optional(),
|
|
socialMediaLinks: z.array(socialMediaLinkSchema).optional(),
|
|
})
|
|
|
|
const pages = defineCollection({
|
|
schema: ({ image }) =>
|
|
z.object({
|
|
hero: heroSchema(image).optional(),
|
|
marquee: z.array(z.string()).optional(),
|
|
reviews: z.array(reviewsSchema(image)).optional(),
|
|
slider: z
|
|
.array(
|
|
z.object({
|
|
image: image(),
|
|
imageAlt: z.string(),
|
|
})
|
|
)
|
|
.optional(),
|
|
services: z.array(servicesSchema).optional(),
|
|
footer: footerSchema.optional(),
|
|
}),
|
|
})
|
|
|
|
export const collections = {
|
|
pages,
|
|
coaches,
|
|
}
|