mirror of
https://github.com/lux-tel/websites.git
synced 2026-10-30 20:31:36 +00:00
41 lines
1021 B
TypeScript
41 lines
1021 B
TypeScript
import { DocumentPdfIcon, EarthGlobeIcon } from '@sanity/icons';
|
|
import type { DocumentFields } from '@session/sanity-types';
|
|
import { defineField, defineType } from 'sanity';
|
|
import { routeFields } from './fields/groups/route';
|
|
import type { specialFields, specialSchema } from './special';
|
|
import type { SchemaFieldsType } from './types';
|
|
|
|
export const fileFields = [
|
|
...routeFields,
|
|
defineField({
|
|
title: 'File',
|
|
name: 'file',
|
|
type: 'file',
|
|
}),
|
|
defineField({
|
|
title: 'File Name',
|
|
name: 'fileName',
|
|
type: 'string',
|
|
description: 'The name of the file when it is downloaded',
|
|
validation: (Rule) => Rule.required(),
|
|
}),
|
|
];
|
|
|
|
export const fileSchema = defineType({
|
|
type: 'document',
|
|
name: 'cmsFile',
|
|
title: 'File',
|
|
icon: DocumentPdfIcon,
|
|
fields: fileFields,
|
|
groups: [
|
|
{
|
|
title: 'Route',
|
|
name: 'route',
|
|
icon: EarthGlobeIcon,
|
|
},
|
|
],
|
|
});
|
|
|
|
export type fileSchemaType = DocumentFields<typeof specialSchema> &
|
|
SchemaFieldsType<typeof specialFields>;
|