Skip to content

Commit 3a6b27c

Browse files
authored
feat: add paginated table example, update example project (#16)
* feat: add paginated table example * chore: fix types * chore: add comments * feat: add new example dataset, update examples * chore!: remove previous example studio
1 parent 5a88e25 commit 3a6b27c

File tree

29 files changed

+2833
-2630
lines changed

29 files changed

+2833
-2630
lines changed
File renamed without changes.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# Sanity Clean Content Studio
1+
# Sanity Movies Content Studio
22

33
Congratulations, you have now installed the Sanity Content Studio, an open-source real-time content editing environment connected to the Sanity backend.
44

55
Now you can do the following things:
66

77
- [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme)
8+
- Check out one of the example frontends: [React](https://github.com/sanity-io/example-frontend-next-js)[React Native](https://github.com/sanity-io/example-app-react-native) | [Vue](https://github.com/sanity-io/example-frontend-vue-js)[PHP](https://github.com/sanity-io/example-frontend-silex-twig)
89
- [Join the community Slack](https://slack.sanity.io/?utm_source=readme)
910
- [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme)

studio-sdk-examples/package.json renamed to sdk-examples-movies/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "sdk-examples",
2+
"name": "sdk-examples-movies",
33
"private": true,
44
"version": "1.0.0",
55
"main": "package.json",
@@ -15,14 +15,15 @@
1515
"sanity"
1616
],
1717
"dependencies": {
18-
"@sanity/vision": "^3.71.2",
18+
"@sanity/vision": "^3.80.1",
1919
"react": "^18.2.0",
2020
"react-dom": "^18.2.0",
21-
"sanity": "^3.71.2",
21+
"react-icons": "^3.11.0",
22+
"sanity": "^3.80.1",
2223
"styled-components": "^6.1.8"
2324
},
2425
"devDependencies": {
25-
"@sanity/eslint-config-studio": "^5.0.1",
26+
"@sanity/eslint-config-studio": "^5.0.2",
2627
"@types/react": "^18.0.25",
2728
"eslint": "^9.9.0",
2829
"prettier": "^3.0.2",

studio-sdk-examples/pnpm-lock.yaml renamed to sdk-examples-movies/pnpm-lock.yaml

Lines changed: 2218 additions & 2456 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

studio-sdk-examples/sanity.cli.ts renamed to sdk-examples-movies/sanity.cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {defineCliConfig} from 'sanity/cli'
22

33
export default defineCliConfig({
44
api: {
5-
projectId: 'flahoy03',
5+
projectId: 'v28v5k8m',
66
dataset: 'production'
77
},
88
/**

studio-sdk-examples/sanity.config.ts renamed to sdk-examples-movies/sanity.config.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ import {schemaTypes} from './schemaTypes'
55

66
export default defineConfig({
77
name: 'default',
8-
title: 'sdk-examples',
8+
title: 'sdk-examples-movies',
99

10-
projectId: 'flahoy03',
10+
projectId: 'v28v5k8m',
1111
dataset: 'production',
1212

13-
plugins: [structureTool(), visionTool()],
13+
plugins: [
14+
structureTool(),
15+
visionTool(),
16+
],
1417

1518
schema: {
1619
types: schemaTypes,
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import {defineArrayMember, defineType} from 'sanity'
2+
3+
/**
4+
* This is the schema definition for the rich text fields used for
5+
* for this blog studio. When you import it in schemas.js it can be
6+
* reused in other parts of the studio with:
7+
* {
8+
* name: 'someName',
9+
* title: 'Some title',
10+
* type: 'blockContent'
11+
* }
12+
*/
13+
export default defineType({
14+
title: 'Block Content',
15+
name: 'blockContent',
16+
type: 'array',
17+
of: [
18+
defineArrayMember({
19+
title: 'Block',
20+
type: 'block',
21+
// Styles let you set what your user can mark up blocks with. These
22+
// correspond with HTML tags, but you can set any title or value
23+
// you want and decide how you want to deal with it where you want to
24+
// use your content.
25+
styles: [
26+
{title: 'Normal', value: 'normal'},
27+
{title: 'H1', value: 'h1'},
28+
{title: 'H2', value: 'h2'},
29+
{title: 'H3', value: 'h3'},
30+
{title: 'H4', value: 'h4'},
31+
{title: 'Quote', value: 'blockquote'},
32+
],
33+
lists: [{title: 'Bullet', value: 'bullet'}],
34+
// Marks let you mark up inline text in the block editor.
35+
marks: {
36+
// Decorators usually describe a single property – e.g. a typographic
37+
// preference or highlighting by editors.
38+
decorators: [
39+
{title: 'Strong', value: 'strong'},
40+
{title: 'Emphasis', value: 'em'},
41+
],
42+
// Annotations can be any object structure – e.g. a link or a footnote.
43+
annotations: [
44+
{
45+
title: 'URL',
46+
name: 'link',
47+
type: 'object',
48+
fields: [
49+
{
50+
title: 'URL',
51+
name: 'href',
52+
type: 'url',
53+
},
54+
],
55+
},
56+
],
57+
},
58+
}),
59+
// You can add additional types here. Note that you can't use
60+
// primitive types such as 'string' and 'number' in the same array
61+
// as a block type.
62+
defineArrayMember({
63+
type: 'image',
64+
options: {hotspot: true},
65+
}),
66+
],
67+
})
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import {defineField, defineType} from 'sanity'
2+
3+
export default defineType({
4+
name: 'castMember',
5+
title: 'Cast Member',
6+
type: 'object',
7+
fields: [
8+
defineField({
9+
name: 'characterName',
10+
title: 'Character Name',
11+
type: 'string',
12+
}),
13+
defineField({
14+
name: 'person',
15+
title: 'Actor',
16+
type: 'reference',
17+
to: [{type: 'person'}],
18+
}),
19+
defineField({
20+
name: 'externalId',
21+
title: 'External ID',
22+
type: 'number',
23+
}),
24+
defineField({
25+
name: 'externalCreditId',
26+
title: 'External Credit ID',
27+
type: 'string',
28+
}),
29+
],
30+
preview: {
31+
select: {
32+
subtitle: 'characterName',
33+
title: 'person.name',
34+
media: 'person.image',
35+
},
36+
},
37+
})
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// @ts-check
2+
import {defineField, defineType} from 'sanity'
3+
4+
export default defineType({
5+
name: 'crewMember',
6+
title: 'Crew Member',
7+
type: 'object',
8+
fields: [
9+
defineField({
10+
name: 'department',
11+
title: 'Department',
12+
type: 'string',
13+
}),
14+
defineField({
15+
name: 'job',
16+
title: 'Job',
17+
type: 'string',
18+
}),
19+
defineField({
20+
name: 'person',
21+
title: 'Person',
22+
type: 'reference',
23+
to: [{type: 'person'}],
24+
}),
25+
defineField({
26+
name: 'externalId',
27+
title: 'External ID',
28+
type: 'number',
29+
}),
30+
defineField({
31+
name: 'externalCreditId',
32+
title: 'External Credit ID',
33+
type: 'string',
34+
}),
35+
],
36+
preview: {
37+
select: {
38+
name: 'person.name',
39+
job: 'job',
40+
department: 'department',
41+
media: 'person.image',
42+
},
43+
prepare(selection) {
44+
const {name, job, department, media} = selection
45+
return {
46+
title: name,
47+
subtitle: `${job} [${department}]`,
48+
media,
49+
}
50+
},
51+
},
52+
})

0 commit comments

Comments
 (0)