From f655586bd24d71e611581fa027fb1656703d8609 Mon Sep 17 00:00:00 2001 From: Han Yeong-woo Date: Sun, 17 Sep 2023 20:50:40 +0900 Subject: [PATCH] refactor: techs enum to data collection --- apps/portfolio/src/content/config.ts | 29 +++++++------------ apps/portfolio/src/content/techs/astro.json | 4 +++ .../portfolio/src/content/techs/tailwind.json | 4 +++ .../src/content/techs/typescript.json | 4 +++ 4 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 apps/portfolio/src/content/techs/astro.json create mode 100644 apps/portfolio/src/content/techs/tailwind.json create mode 100644 apps/portfolio/src/content/techs/typescript.json diff --git a/apps/portfolio/src/content/config.ts b/apps/portfolio/src/content/config.ts index 4101025..c4e81ed 100644 --- a/apps/portfolio/src/content/config.ts +++ b/apps/portfolio/src/content/config.ts @@ -1,4 +1,4 @@ -import { defineCollection, z } from 'astro:content'; +import { defineCollection, reference, z } from 'astro:content'; const worksCollection = defineCollection({ type: 'content', @@ -7,26 +7,19 @@ const worksCollection = defineCollection({ cover: image(), title: z.string().nonempty(), description: z.string().nonempty(), - techs: z - .enum([ - 'javascript', - 'typescript', - 'react', - 'astro', - 'tailwind', - - 'prettier', - 'eslint', - 'github-actions', - - 'cloudflare-pages', - 'chrome-web-store', - ]) - .array() - .nonempty(), + techs: z.array(reference('techs')), }), }); +const techsCollection = defineCollection({ + type: 'data', + schema: z.object({ + fullName: z.string().nonempty(), + icon: z.string().nonempty(), + }), +}); + export const collections = { works: worksCollection, + techs: techsCollection, }; diff --git a/apps/portfolio/src/content/techs/astro.json b/apps/portfolio/src/content/techs/astro.json new file mode 100644 index 0000000..c76ba7e --- /dev/null +++ b/apps/portfolio/src/content/techs/astro.json @@ -0,0 +1,4 @@ +{ + "fullName": "Astro", + "icon": "" +} diff --git a/apps/portfolio/src/content/techs/tailwind.json b/apps/portfolio/src/content/techs/tailwind.json new file mode 100644 index 0000000..439cae6 --- /dev/null +++ b/apps/portfolio/src/content/techs/tailwind.json @@ -0,0 +1,4 @@ +{ + "fullName": "Tailwind CSS", + "icon": "" +} diff --git a/apps/portfolio/src/content/techs/typescript.json b/apps/portfolio/src/content/techs/typescript.json new file mode 100644 index 0000000..274319d --- /dev/null +++ b/apps/portfolio/src/content/techs/typescript.json @@ -0,0 +1,4 @@ +{ + "fullName": "TypeScript", + "icon": "" +}