Skip to content

Commit

Permalink
feat: add plugins and more schema classes
Browse files Browse the repository at this point in the history
  • Loading branch information
martapanc-resourcify committed Jul 7, 2023
1 parent 1e12886 commit db28722
Show file tree
Hide file tree
Showing 8 changed files with 507 additions and 29 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@emotion/styled": "^11.11.0",
"@mui/material": "^5.13.5",
"@sanity/client": "^6.1.4",
"@sanity/code-input": "^4.1.1",
"@sanity/icons": "^2.0.0",
"@sanity/image-url": "1",
"@sanity/types": "^3.0.0",
Expand All @@ -48,6 +49,7 @@
"react-icons": "^4.10.1",
"react-tippy": "^1.4.0",
"sanity": "^3.0.0",
"sanity-plugin-media": "^2.2.1",
"styled-components": "^5.2.0",
"tailwind-merge": "^1.12.0"
},
Expand Down
6 changes: 4 additions & 2 deletions sanity.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
* This configuration is used to for the Sanity Studio that’s mounted on the `/app/studio/[[...index]]/page.tsx` route
*/

import { codeInput } from '@sanity/code-input';
import { visionTool } from '@sanity/vision';
import { defineConfig } from 'sanity';
import { deskTool } from 'sanity/desk';
import { media } from 'sanity-plugin-media';

// Go to https://www.sanity.io/docs/api-versioning to learn how API versioning works
import { apiVersion, dataset, projectId } from './sanity/env';
Expand All @@ -17,9 +19,9 @@ export default defineConfig({
// Add and edit the content schema in the './sanity/schema' folder
schema,
plugins: [
codeInput(),
deskTool(),
// Vision is a tool that lets you query your content with GROQ in the studio
// https://www.sanity.io/docs/the-vision-plugin
media(),
visionTool({ defaultApiVersion: apiVersion }),
],
});
3 changes: 2 additions & 1 deletion sanity/schema.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type SchemaTypeDefinition } from 'sanity';

import job from '../src/schemas/job';
import skill from '../src/schemas/skill';
import skillIcon from '../src/schemas/skillIcon';

export const schema: { types: SchemaTypeDefinition[] } = {
types: [skill, skillIcon],
types: [job, skill, skillIcon],
};
68 changes: 68 additions & 0 deletions src/schemas/job.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { defineField, defineType } from 'sanity';

export default defineType({
name: 'job',
title: 'Job',
type: 'document',
fields: [
defineField({
name: 'id',
title: 'Id',
type: 'string',
}),
defineField({
name: 'company',
title: 'Company',
type: 'string',
}),
defineField({
name: 'icon',
title: 'Icon',
type: 'image',
}),
defineField({
name: 'location',
title: 'Location',
type: 'string',
}),
defineField({
name: 'jobTitle',
title: 'Job Title',
type: 'string',
}),
defineField({
name: 'startYear',
title: 'Start Year',
type: 'number',
initialValue: new Date().getFullYear() - 3,
}),
defineField({
name: 'endYear',
title: 'End Year',
type: 'number',
initialValue: new Date().getFullYear() - 1,
}),
defineField({
name: 'isCurrentJob',
title: 'Current Job?',
type: 'boolean',
initialValue: false,
}),
defineField({
name: 'description',
title: 'Description',
type: 'array',
of: [{ type: 'block' }],
}),
defineField({
name: 'technologies',
title: 'Technologies',
type: 'array',
of: [
{
type: 'string',
},
],
}),
],
});
3 changes: 2 additions & 1 deletion src/schemas/skill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export default defineType({
defineField({
name: 'description',
title: 'Description',
type: 'string',
type: 'array',
of: [{ type: 'block' }],
}),
defineField({
name: 'icons',
Expand Down
6 changes: 3 additions & 3 deletions src/schemas/skillIcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export default defineType({
type: 'string',
}),
defineField({
name: 'url',
title: 'Url',
type: 'string',
name: 'icon',
title: 'Icon',
type: 'image',
}),
],
});
12 changes: 12 additions & 0 deletions src/types/Job.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export interface Skill {
id: string;
company: string;
icon: string;
location: string;
jobTitle: string;
startYear: number;
endYear: number;
isCurrentJob: boolean;
description: object;
technologies: string[];
}
Loading

0 comments on commit db28722

Please sign in to comment.