Skip to content

Commit

Permalink
refactor: techs enum to data collection
Browse files Browse the repository at this point in the history
  • Loading branch information
nix6839 committed Sep 17, 2023
1 parent 8e62fab commit f655586
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
29 changes: 11 additions & 18 deletions apps/portfolio/src/content/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineCollection, z } from 'astro:content';
import { defineCollection, reference, z } from 'astro:content';

const worksCollection = defineCollection({
type: 'content',
Expand All @@ -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,
};
4 changes: 4 additions & 0 deletions apps/portfolio/src/content/techs/astro.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"fullName": "Astro",
"icon": "<path fill='#e4e4e7' d='M81.504 9.465c.973 1.207 1.469 2.836 2.457 6.09l21.656 71.136a90.08 90.08 0 0 0-25.89-8.765L65.629 30.28a1.833 1.833 0 0 0-3.52.004L48.18 77.902a90.106 90.106 0 0 0-26.003 8.778l21.758-71.14c.996-3.25 1.492-4.876 2.464-6.083a8.023 8.023 0 0 1 3.243-2.398c1.433-.575 3.136-.575 6.535-.575H71.72c3.402 0 5.105 0 6.543.579a7.985 7.985 0 0 1 3.241 2.402Z'></path><path fill='#ff5d01' d='M84.094 90.074c-3.57 3.055-10.696 5.137-18.903 5.137-10.07 0-18.515-3.137-20.754-7.356-.8 2.418-.98 5.184-.98 6.954 0 0-.527 8.675 5.508 14.71a5.669 5.669 0 0 1 5.672-5.671c5.37 0 5.367 4.683 5.363 8.488v.336c0 5.773 3.527 10.719 8.543 12.805a11.62 11.62 0 0 1-1.172-5.098c0-5.508 3.23-7.555 6.988-9.938 2.989-1.894 6.309-4 8.594-8.222a15.514 15.514 0 0 0 1.875-7.41 15.552 15.552 0 0 0-.734-4.735Z'></path>"
}
4 changes: 4 additions & 0 deletions apps/portfolio/src/content/techs/tailwind.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"fullName": "Tailwind CSS",
"icon": "<path fill='#38bdf8' d='M64.004 25.602c-17.067 0-27.73 8.53-32 25.597 6.398-8.531 13.867-11.73 22.398-9.597 4.871 1.214 8.352 4.746 12.207 8.66C72.883 56.629 80.145 64 96.004 64c17.066 0 27.73-8.531 32-25.602-6.399 8.536-13.867 11.735-22.399 9.602-4.87-1.215-8.347-4.746-12.207-8.66-6.27-6.367-13.53-13.738-29.394-13.738zM32.004 64c-17.066 0-27.73 8.531-32 25.602C6.402 81.066 13.87 77.867 22.402 80c4.871 1.215 8.352 4.746 12.207 8.66 6.274 6.367 13.536 13.738 29.395 13.738 17.066 0 27.73-8.53 32-25.597-6.399 8.531-13.867 11.73-22.399 9.597-4.87-1.214-8.347-4.746-12.207-8.66C55.128 71.371 47.868 64 32.004 64zm0 0'></path>"
}
4 changes: 4 additions & 0 deletions apps/portfolio/src/content/techs/typescript.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"fullName": "TypeScript",
"icon": "<path fill='#fff' d='M28 58h89v59H28V58Z'></path><path fill='#007acc' d='M1.5 63.91v62.5h125v-125H1.5v62.5Zm100.73-5a15.56 15.56 0 0 1 7.82 4.5 20.584 20.584 0 0 1 3 4c0 .16-5.4 3.81-8.69 5.85-.12.08-.6-.44-1.13-1.23a7.096 7.096 0 0 0-5.87-3.53c-3.79-.26-6.23 1.73-6.21 5a4.58 4.58 0 0 0 .54 2.34c.83 1.73 2.38 2.76 7.24 4.86 8.95 3.85 12.78 6.39 15.16 10 2.66 4 3.25 10.46 1.45 15.24-2 5.2-6.9 8.73-13.83 9.9a38.295 38.295 0 0 1-9.52-.1 23.006 23.006 0 0 1-12.72-6.63c-1.15-1.27-3.39-4.58-3.25-4.82a9.34 9.34 0 0 1 1.15-.73L82 101l3.59-2.08.75 1.11a16.78 16.78 0 0 0 4.74 4.54c4 2.1 9.46 1.81 12.16-.62a5.427 5.427 0 0 0 .69-6.92c-1-1.39-3-2.56-8.59-5-6.45-2.78-9.23-4.5-11.77-7.24a16.48 16.48 0 0 1-3.43-6.25 25 25 0 0 1-.22-8c1.33-6.23 6-10.58 12.82-11.87a31.662 31.662 0 0 1 9.49.26v-.02Zm-29.34 5.24v5.12H56.66v46.23H45.15V69.26H28.88v-5a49.19 49.19 0 0 1 .12-5.17C29.08 59 39 59 51 59h21.83l.06 5.15Z' ></path>"
}

0 comments on commit f655586

Please sign in to comment.