mirror of
https://github.com/kogakure/website-astro-stefanimhoff.de.git
synced 2026-02-03 20:15:27 +00:00
refactor: move schemas into individual files
This commit is contained in:
@@ -1,85 +1,8 @@
|
|||||||
import { defineCollection, z } from 'astro:content';
|
import { aiArt, haiku, projects, sketchnotes } from '../schema';
|
||||||
|
|
||||||
const haikuCollection = defineCollection({
|
|
||||||
schema: z.object({
|
|
||||||
date: z.date(),
|
|
||||||
de: z.string(),
|
|
||||||
en: z.string(),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
const projectCollection = defineCollection({
|
|
||||||
schema: z.object({
|
|
||||||
title: z.string(),
|
|
||||||
format: z.enum(['100-end', '100-start', '50-end', '50-start', '70-end', '70-start']),
|
|
||||||
image: z
|
|
||||||
.object({
|
|
||||||
src: z.string(),
|
|
||||||
height: z.number().optional(),
|
|
||||||
width: z.number().optional(),
|
|
||||||
aspectRatio: z.number().optional(),
|
|
||||||
})
|
|
||||||
.optional(),
|
|
||||||
sort: z.number().optional(),
|
|
||||||
showcase: z.boolean().optional(),
|
|
||||||
description: z.string().optional(),
|
|
||||||
intro: z.string().optional(),
|
|
||||||
categories: z.array(
|
|
||||||
z.enum([
|
|
||||||
'Design',
|
|
||||||
'Graphic Design',
|
|
||||||
'Icon Design',
|
|
||||||
'Illustration',
|
|
||||||
'Painting',
|
|
||||||
'Photography',
|
|
||||||
'Poetry',
|
|
||||||
'Typeface Design',
|
|
||||||
'Web Design',
|
|
||||||
'Web Development',
|
|
||||||
'Writing',
|
|
||||||
])
|
|
||||||
),
|
|
||||||
more: z
|
|
||||||
.object({
|
|
||||||
text: z.string().optional(),
|
|
||||||
link: z.string(),
|
|
||||||
})
|
|
||||||
.optional(),
|
|
||||||
class: z.string().optional(),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
const sketchnotesCollection = defineCollection({
|
|
||||||
schema: z.object({
|
|
||||||
title: z.string(),
|
|
||||||
sort: z.number().optional(),
|
|
||||||
coverSize: z.enum(['small', 'medium', 'large']).default('small'),
|
|
||||||
images: z.array(
|
|
||||||
z.object({
|
|
||||||
src: z.string(),
|
|
||||||
aspectRatio: z.number(),
|
|
||||||
})
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
const aiArtCollection = defineCollection({
|
|
||||||
schema: z.object({
|
|
||||||
title: z.string(),
|
|
||||||
sort: z.number().optional(),
|
|
||||||
coverSize: z.enum(['small', 'medium', 'large']).default('small'),
|
|
||||||
images: z.array(
|
|
||||||
z.object({
|
|
||||||
src: z.string(),
|
|
||||||
aspectRatio: z.number(),
|
|
||||||
})
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const collections = {
|
export const collections = {
|
||||||
haiku: haikuCollection,
|
haiku: haiku,
|
||||||
projects: projectCollection,
|
projects: projects,
|
||||||
sketchnotes: sketchnotesCollection,
|
sketchnotes: sketchnotes,
|
||||||
'ai-art': aiArtCollection,
|
'ai-art': aiArt,
|
||||||
};
|
};
|
||||||
|
|||||||
15
src/schema/ai-art.ts
Normal file
15
src/schema/ai-art.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { defineCollection, z } from 'astro:content';
|
||||||
|
|
||||||
|
export const aiArt = defineCollection({
|
||||||
|
schema: z.object({
|
||||||
|
title: z.string(),
|
||||||
|
sort: z.number().optional(),
|
||||||
|
coverSize: z.enum(['small', 'medium', 'large']).default('small'),
|
||||||
|
images: z.array(
|
||||||
|
z.object({
|
||||||
|
src: z.string(),
|
||||||
|
aspectRatio: z.number(),
|
||||||
|
})
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
});
|
||||||
9
src/schema/haiku.ts
Normal file
9
src/schema/haiku.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { defineCollection, z } from 'astro:content';
|
||||||
|
|
||||||
|
export const haiku = defineCollection({
|
||||||
|
schema: z.object({
|
||||||
|
date: z.date(),
|
||||||
|
de: z.string(),
|
||||||
|
en: z.string(),
|
||||||
|
}),
|
||||||
|
});
|
||||||
4
src/schema/index.ts
Normal file
4
src/schema/index.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export * from './ai-art';
|
||||||
|
export * from './haiku';
|
||||||
|
export * from './projects';
|
||||||
|
export * from './sketchnotes';
|
||||||
42
src/schema/projects.ts
Normal file
42
src/schema/projects.ts
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import { defineCollection, z } from 'astro:content';
|
||||||
|
|
||||||
|
export const projects = defineCollection({
|
||||||
|
schema: z.object({
|
||||||
|
title: z.string(),
|
||||||
|
format: z.enum(['100-end', '100-start', '50-end', '50-start', '70-end', '70-start']),
|
||||||
|
image: z
|
||||||
|
.object({
|
||||||
|
src: z.string(),
|
||||||
|
height: z.number().optional(),
|
||||||
|
width: z.number().optional(),
|
||||||
|
aspectRatio: z.number().optional(),
|
||||||
|
})
|
||||||
|
.optional(),
|
||||||
|
sort: z.number().optional(),
|
||||||
|
showcase: z.boolean().optional(),
|
||||||
|
description: z.string().optional(),
|
||||||
|
intro: z.string().optional(),
|
||||||
|
categories: z.array(
|
||||||
|
z.enum([
|
||||||
|
'Design',
|
||||||
|
'Graphic Design',
|
||||||
|
'Icon Design',
|
||||||
|
'Illustration',
|
||||||
|
'Painting',
|
||||||
|
'Photography',
|
||||||
|
'Poetry',
|
||||||
|
'Typeface Design',
|
||||||
|
'Web Design',
|
||||||
|
'Web Development',
|
||||||
|
'Writing',
|
||||||
|
])
|
||||||
|
),
|
||||||
|
more: z
|
||||||
|
.object({
|
||||||
|
text: z.string().optional(),
|
||||||
|
link: z.string(),
|
||||||
|
})
|
||||||
|
.optional(),
|
||||||
|
class: z.string().optional(),
|
||||||
|
}),
|
||||||
|
});
|
||||||
15
src/schema/sketchnotes.ts
Normal file
15
src/schema/sketchnotes.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { defineCollection, z } from 'astro:content';
|
||||||
|
|
||||||
|
export const sketchnotes = defineCollection({
|
||||||
|
schema: z.object({
|
||||||
|
title: z.string(),
|
||||||
|
sort: z.number().optional(),
|
||||||
|
coverSize: z.enum(['small', 'medium', 'large']).default('small'),
|
||||||
|
images: z.array(
|
||||||
|
z.object({
|
||||||
|
src: z.string(),
|
||||||
|
aspectRatio: z.number(),
|
||||||
|
})
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user