From ba3b7b7d402fc193a4dfbee821bf96232053574d Mon Sep 17 00:00:00 2001 From: nyomansunima Date: Sun, 28 May 2023 18:56:01 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20update:=20complete=20bio=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/studio/schemas/documents/page.ts | 36 ++++ apps/studio/schemas/index.ts | 4 +- apps/studio/schemas/objects/content/bio.ts | 99 +++++++++++ apps/web/app.vue | 3 +- apps/web/pages/bio.vue | 192 +++++++++++++++++++++ apps/web/types/content.d.ts | 20 +++ 6 files changed, 352 insertions(+), 2 deletions(-) create mode 100644 apps/studio/schemas/documents/page.ts create mode 100644 apps/studio/schemas/objects/content/bio.ts create mode 100644 apps/web/pages/bio.vue diff --git a/apps/studio/schemas/documents/page.ts b/apps/studio/schemas/documents/page.ts new file mode 100644 index 0000000..bd367d3 --- /dev/null +++ b/apps/studio/schemas/documents/page.ts @@ -0,0 +1,36 @@ +import { Folder } from 'react-iconly' +import { defineField, defineType } from 'sanity' + +export default defineType({ + title: 'Pages', + name: 'page', + type: 'document', + icon: Folder, + fields: [ + defineField({ + title: 'Title', + name: 'title', + type: 'string' + }), + defineField({ + title: 'Slug', + name: 'slug', + type: 'slug', + options: { + source: 'title' + } + }), + defineField({ + title: 'Content', + name: 'content', + type: 'array', + of: [{ type: 'bioContent', title: 'Bio' }] + }) + ], + preview: { + select: { + title: 'title', + subtitle: 'slug.current' + } + } +}) diff --git a/apps/studio/schemas/index.ts b/apps/studio/schemas/index.ts index a1a1a90..9767372 100644 --- a/apps/studio/schemas/index.ts +++ b/apps/studio/schemas/index.ts @@ -1,3 +1,5 @@ import blog from './documents/blog' +import page from './documents/page' +import bio from './objects/content/bio' -export const schemaTypes = [blog] +export const schemaTypes = [blog, page, bio] diff --git a/apps/studio/schemas/objects/content/bio.ts b/apps/studio/schemas/objects/content/bio.ts new file mode 100644 index 0000000..7b0c3cd --- /dev/null +++ b/apps/studio/schemas/objects/content/bio.ts @@ -0,0 +1,99 @@ +import { Activity } from 'react-iconly' +import { defineField, defineType } from 'sanity' + +export default defineType({ + title: 'Bio', + name: 'bioContent', + type: 'object', + icon: Activity, + fields: [ + defineField({ + title: 'Avatar', + name: 'avatar', + type: 'image' + }), + defineField({ + title: 'Short Description', + name: 'desc', + type: 'text' + }), + defineField({ + title: 'Stats', + name: 'stats', + type: 'object', + fields: [ + defineField({ + title: 'Total Follower', + name: 'totalFollower', + type: 'number' + }), + defineField({ + title: 'Total Subscriber', + name: 'totalSubscriber', + type: 'number' + }) + ] + }), + defineField({ + title: 'Socials', + name: 'socials', + type: 'array', + of: [ + { + title: 'Social', + type: 'object', + fields: [ + defineField({ + title: 'Label', + name: 'label', + type: 'string' + }), + defineField({ + title: 'URL', + name: 'url', + type: 'url' + }), + defineField({ + title: 'Icon Code', + name: 'iconCode', + type: 'string' + }) + ] + } + ] + }), + defineField({ + title: 'Special Buttons', + name: 'links', + type: 'array', + of: [ + { + title: 'Link', + type: 'object', + fields: [ + defineField({ + title: 'URL', + name: 'url', + type: 'url' + }), + defineField({ + title: 'Label', + name: 'label', + type: 'string' + }), + defineField({ + title: 'Icon Code', + name: 'iconCode', + type: 'string' + }), + defineField({ + title: 'Custom Background Color', + name: 'customColor', + type: 'color' + }) + ] + } + ] + }) + ] +}) diff --git a/apps/web/app.vue b/apps/web/app.vue index d88c29b..d731be5 100644 --- a/apps/web/app.vue +++ b/apps/web/app.vue @@ -10,7 +10,8 @@ useHead({ titleTemplate: '%s - Nyoman Sunima', bodyAttrs: { - class: 'font-sans font-medium text-base leading-normal text-black bg-white' + class: + 'font-sans font-medium text-base leading-normal text-black bg-white dark:bg-black' } }) diff --git a/apps/web/pages/bio.vue b/apps/web/pages/bio.vue new file mode 100644 index 0000000..224cf50 --- /dev/null +++ b/apps/web/pages/bio.vue @@ -0,0 +1,192 @@ + + + diff --git a/apps/web/types/content.d.ts b/apps/web/types/content.d.ts index 9cfbcf7..3aab425 100644 --- a/apps/web/types/content.d.ts +++ b/apps/web/types/content.d.ts @@ -20,3 +20,23 @@ export interface BlogDetail { } related: BlogPost[] } + +export interface BioContent { + avatar: string + desc: string + stats: { + totalFollower: number + totalSubscriber: number + } + socials: { + label: string + iconCode: string + url: string + }[] + links: { + label: string + iconCode: string + url: string + customColor: string + }[] +}