adding sanity components

This commit is contained in:
briannelson95
2025-09-30 19:40:25 -04:00
parent 3c0e27d7f2
commit f016b39e5c
32 changed files with 3062 additions and 8 deletions

View File

@@ -0,0 +1,17 @@
import { defineField, defineType } from 'sanity';
export const launchDate = defineType({
name: 'launchDate',
title: 'Launch Date',
type: 'object',
fields: [
defineField({
name: 'launchAt',
title: 'Launch At',
type: 'datetime'
})
],
options: {
collapsed: true
}
})

View File

@@ -0,0 +1,33 @@
import { defineField, defineType } from 'sanity';
export const newsData = defineType({
name: 'newsData',
title: 'News',
type: 'object',
fields: [
defineField({
name: 'nav',
title: 'Navigation',
type: 'array',
of: [
{type: 'string'}
]
}),
defineField({
name: 'posts',
title: 'Posts',
type: 'array',
of: [
{
type: 'reference',
to: [
{type: 'newsPost'}
]
}
]
})
],
options: {
collapsed: true
}
})

View File

@@ -0,0 +1,66 @@
import MyPreviewComponent from '@/components/MyPreviewComponent';
import { defineField, defineType } from 'sanity';
export const productInfo = defineType({
name: 'productInfo',
title: 'Product Info',
type: 'object',
fields: [
defineField({
name: 'title',
title: 'Title',
type: 'string'
}),
defineField({
name: 'mobileImage',
type: 'reference',
to: {
type: 'media',
components: {
preview: MyPreviewComponent
}
},
}),
defineField({
name: 'deskImage',
type: 'reference',
to: {
type: 'media',
components: {
preview: MyPreviewComponent
}
},
}),
defineField({
name: 'price',
title: 'Price',
type: 'object',
fields: [
defineField({
name: 'ogPrice',
title: 'Original Price',
type: 'number'
}),
defineField({
name: 'newPrice',
title: 'New Price',
type: 'number'
}),
]
}),
defineField({
name: 'category',
title: 'Category',
type: 'string'
// I would make this a reference if there was more products
}),
defineField({
name: 'desc',
title: 'Description',
type: 'text'
})
],
options: {
collapsed: true
}
})

View File

@@ -0,0 +1,37 @@
import { defineField, defineType } from 'sanity';
import MyPreviewComponent from '../../../components/MyPreviewComponent'
export const qrCode = defineType({
name: 'qrCode',
title: 'QR Code',
type: 'object',
fields: [
defineField({
name: 'image',
type: 'reference',
to: {
type: 'media',
components: {
preview: MyPreviewComponent
}
},
}),
defineField({
name: 'text',
type: 'object',
fields: [
defineField({
name: 'title',
type: 'string',
}),
defineField({
name: 'subtitle',
type: 'string',
}),
]
})
],
options: {
collapsed: true
}
})

View File

@@ -0,0 +1,52 @@
import { defineField, defineType } from 'sanity';
export const resultsSum = defineType({
name: 'resultsSum',
title: 'Results Summary',
type: 'object',
fields: [
defineField({
name: 'allResults',
title: 'Results',
type: 'object',
fields: [
defineField({
name: 'resultArr',
type: 'array',
of: [
{
type: 'scores'
}
]
})
]
}),
defineField({
name: 'reaction',
title: 'Reaction',
type: 'number',
validation: Rule => Rule.max(100)
}),
defineField({
name: 'memory',
title: 'Memory',
type: 'number',
validation: Rule => Rule.max(100)
}),
defineField({
name: 'verbal',
title: 'Verbal',
type: 'number',
validation: Rule => Rule.max(100)
}),
defineField({
name: 'visual',
title: 'Visual',
type: 'number',
validation: Rule => Rule.max(100)
}),
],
options: {
collapsed: true
}
})

View File

@@ -0,0 +1,29 @@
import { defineField, defineType } from 'sanity';
export const scores = defineType({
name: 'scores',
title: 'Scores',
type: 'object',
fields: [
defineField({
name: 'title',
title: 'Title',
type: 'string'
}),
defineField({
name: 'score',
title: 'Score',
type: 'number',
validation: Rule => Rule.max(100)
})
],
options: {
columns: 2
},
preview: {
select: {
title: 'score',
subtitle: 'title'
}
}
})