Skip to content

Commit cf7fac1

Browse files
Setup schemas
1 parent 59ef761 commit cf7fac1

File tree

9 files changed

+254
-33
lines changed

9 files changed

+254
-33
lines changed

studio/.gitignore

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
*.pid.lock
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage
19+
20+
# nyc test coverage
21+
.nyc_output
22+
23+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+
.grunt
25+
26+
# Bower dependency directory (https://bower.io/)
27+
bower_components
28+
29+
# node-waf configuration
30+
.lock-wscript
31+
32+
# Compiled binary addons (http://nodejs.org/api/addons.html)
33+
build/Release
34+
35+
# Dependency directories
36+
node_modules/
37+
jspm_packages/
38+
39+
# Typescript v1 declaration files
40+
typings/
41+
42+
# Optional npm cache directory
43+
.npm
44+
45+
# Optional eslint cache
46+
.eslintcache
47+
48+
# Optional REPL history
49+
.node_repl_history
50+
51+
# Output of 'npm pack'
52+
*.tgz
53+
54+
# dotenv environment variable files
55+
.env*
56+
57+
# gatsby files
58+
.cache/
59+
public
60+
61+
# Mac files
62+
.DS_Store
63+
64+
# Yarn
65+
yarn-error.log
66+
.pnp/
67+
.pnp.js
68+
# Yarn Integrity file
69+
.yarn-integrity

studio/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
"sanity"
1515
],
1616
"dependencies": {
17-
"@sanity/base": "^1.149.8",
18-
"@sanity/components": "^1.149.8",
17+
"@sanity/base": "^1.149.10",
18+
"@sanity/components": "^1.149.10",
1919
"@sanity/core": "^1.149.9",
20-
"@sanity/default-layout": "^1.149.8",
20+
"@sanity/default-layout": "^1.149.10",
2121
"@sanity/default-login": "^1.149.7",
22-
"@sanity/desk-tool": "^1.149.8",
22+
"@sanity/desk-tool": "^1.149.10",
2323
"@sanity/vision": "^1.149.0",
2424
"prop-types": "^15.6",
2525
"react": "^16.2",

studio/schemas/external_link.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export default {
2+
title: 'External Link',
3+
name: 'external_link',
4+
type: 'document',
5+
fields: [
6+
{
7+
title: 'Description',
8+
name: 'description',
9+
type: 'string'
10+
},
11+
{
12+
title: 'Url',
13+
name: 'url',
14+
type: 'url'
15+
},
16+
]
17+
}

studio/schemas/schema.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
// First, we must import the schema creator
21
import createSchema from 'part:@sanity/base/schema-creator'
3-
4-
// Then import schema types from any plugins that might expose them
52
import schemaTypes from 'all:part:@sanity/base/schema-type'
63

7-
// Then we give our schema to the builder and provide the result to Sanity
4+
import section from './section'
5+
import subsection from './subsection'
6+
import external_link from './external_link'
7+
import shortcut from './shortcut'
8+
89
export default createSchema({
9-
// We name our schema
10-
name: 'default',
11-
// Then proceed to concatenate our document type
12-
// to the ones provided by any plugins that are installed
10+
name: 'cheatsheetSchema',
1311
types: schemaTypes.concat([
14-
/* Your types here! */
12+
section,
13+
subsection,
14+
external_link,
15+
shortcut
1516
])
1617
})

studio/schemas/section.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
export default {
2+
title: 'Section',
3+
name: 'section',
4+
type: 'document',
5+
fields: [
6+
{
7+
title: 'Name',
8+
name: 'name',
9+
type: 'string'
10+
},
11+
{
12+
title: 'Type',
13+
name: 'type',
14+
type: 'string'
15+
},
16+
{
17+
title: 'Description',
18+
name: 'description',
19+
type: 'text'
20+
},
21+
{
22+
title: 'Subsections',
23+
name: 'subsections',
24+
type: 'array',
25+
of: [{
26+
type: 'reference',
27+
to: [
28+
{ type: 'general_subsection' },
29+
{ type: 'shortcut_subsection' }
30+
]
31+
}],
32+
validation: Rule => Rule.unique()
33+
},
34+
{
35+
title: 'Section Active',
36+
name: 'section_active',
37+
type: 'boolean'
38+
},
39+
{
40+
title: 'External Links',
41+
name: 'external_links',
42+
type: 'array',
43+
of: [{
44+
type: 'reference',
45+
to: [{ type: 'external_link' }]
46+
}]
47+
},
48+
]
49+
}

studio/schemas/shortcut.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
export default {
2+
title: 'Shortcut Subsection',
3+
name: 'shortcut_subsection',
4+
type: 'document',
5+
fields: [
6+
{
7+
title: 'Name',
8+
name: 'name',
9+
type: 'string'
10+
},
11+
{
12+
title: 'Mac Command',
13+
name: 'mac_command',
14+
type: 'string'
15+
},
16+
{
17+
title: 'Windows Command',
18+
name: 'windows_command',
19+
type: 'string'
20+
},
21+
{
22+
title: 'Url',
23+
name: 'url',
24+
type: 'url'
25+
},
26+
{
27+
title: 'Notes & Details',
28+
name: 'notes',
29+
type: 'array',
30+
of: [{ type: 'text' }]
31+
}
32+
]
33+
}

studio/schemas/subsection.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
export default {
2+
title: 'General Subsection',
3+
name: 'general_subsection',
4+
type: 'document',
5+
fields: [
6+
{
7+
title: 'Name',
8+
name: 'name',
9+
type: 'string',
10+
validation: Rule => Rule.unique()
11+
},
12+
{
13+
title: 'Description',
14+
name: 'description',
15+
type: 'text',
16+
},
17+
{
18+
title: 'Code Samples',
19+
name: 'code_samples',
20+
type: 'string'
21+
},
22+
{
23+
title: 'Syntax',
24+
name: 'syntax',
25+
type: 'string'
26+
},
27+
{
28+
title: 'Subsection Active',
29+
name: 'subsection_active',
30+
type: 'boolean'
31+
},
32+
{
33+
title: 'External Links',
34+
name: 'external_links',
35+
type: 'array',
36+
of: [{
37+
type: 'reference',
38+
to: [{ type: 'external_link' }]
39+
}]
40+
},
41+
]
42+
}

studio/yarn.lock

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -801,9 +801,9 @@
801801
version "0.7.4"
802802
resolved "https://registry.npmjs.org/@reach/auto-id/-/auto-id-0.7.4.tgz#c20bf6db87ef2f34b1bfb4bf450d675524a368c1"
803803

804-
"@sanity/base@1.149.8", "@sanity/base@^1.149.8":
805-
version "1.149.8"
806-
resolved "https://registry.npmjs.org/@sanity/base/-/base-1.149.8.tgz#54caab90f5a6ecee67050207bef47a90f30bdf25"
804+
"@sanity/base@1.149.10", "@sanity/base@^1.149.10":
805+
version "1.149.10"
806+
resolved "https://registry.npmjs.org/@sanity/base/-/base-1.149.10.tgz#4b813600b707f4ddc0ea579189d125258d434b49"
807807
dependencies:
808808
"@sanity/client" "1.149.7"
809809
"@sanity/generate-help-url" "1.149.0"
@@ -862,11 +862,11 @@
862862
make-error "^1.3.0"
863863
object-assign "^4.1.1"
864864

865-
"@sanity/components@^1.149.8":
866-
version "1.149.8"
867-
resolved "https://registry.npmjs.org/@sanity/components/-/components-1.149.8.tgz#10eef046e30709b7ab4dae529fe92bdbd5777b5d"
865+
"@sanity/components@^1.149.10":
866+
version "1.149.10"
867+
resolved "https://registry.npmjs.org/@sanity/components/-/components-1.149.10.tgz#b674eb8262a3e26404f07e2bbe553ceb38b08d22"
868868
dependencies:
869-
"@sanity/base" "1.149.8"
869+
"@sanity/base" "1.149.10"
870870
attr-accept "^1.1.0"
871871
boundless-arrow-key-navigation "^1.1.0"
872872
chance "^1.0.4"
@@ -969,11 +969,11 @@
969969
"@sanity/generate-help-url" "1.149.0"
970970
lodash "^4.17.15"
971971

972-
"@sanity/default-layout@^1.149.8":
973-
version "1.149.8"
974-
resolved "https://registry.npmjs.org/@sanity/default-layout/-/default-layout-1.149.8.tgz#cfc18bf3c0b8167f677292842c6a345cf01fee9d"
972+
"@sanity/default-layout@^1.149.10":
973+
version "1.149.10"
974+
resolved "https://registry.npmjs.org/@sanity/default-layout/-/default-layout-1.149.10.tgz#82893c604c49884d1828ffd8c5ca484c56f69707"
975975
dependencies:
976-
"@sanity/base" "1.149.8"
976+
"@sanity/base" "1.149.10"
977977
"@sanity/generate-help-url" "1.149.0"
978978
is-hotkey "^0.1.4"
979979
lodash "^4.17.15"
@@ -991,17 +991,17 @@
991991
prop-types "^15.6.0"
992992
rxjs "^6.5.3"
993993

994-
"@sanity/desk-tool@^1.149.8":
995-
version "1.149.8"
996-
resolved "https://registry.npmjs.org/@sanity/desk-tool/-/desk-tool-1.149.8.tgz#da21d94fc87d6552fa499d83376c425609ca9138"
994+
"@sanity/desk-tool@^1.149.10":
995+
version "1.149.10"
996+
resolved "https://registry.npmjs.org/@sanity/desk-tool/-/desk-tool-1.149.10.tgz#c274c531d9773c8fa327ce87e96b52b05bea4e95"
997997
dependencies:
998998
"@reach/auto-id" "^0.7.2"
999-
"@sanity/base" "1.149.8"
999+
"@sanity/base" "1.149.10"
10001000
"@sanity/data-aspects" "1.149.7"
10011001
"@sanity/form-builder" "1.149.7"
10021002
"@sanity/generate-help-url" "1.149.0"
10031003
"@sanity/mutator" "1.149.0"
1004-
"@sanity/react-hooks" "1.149.8"
1004+
"@sanity/react-hooks" "1.149.10"
10051005
"@sanity/structure" "1.149.7"
10061006
"@sanity/uuid" "1.149.0"
10071007
"@sanity/validation" "1.149.0"
@@ -1175,11 +1175,11 @@
11751175
rxjs "^6.5.3"
11761176
shallow-equals "^1.0.0"
11771177

1178-
"@sanity/react-hooks@1.149.8":
1179-
version "1.149.8"
1180-
resolved "https://registry.npmjs.org/@sanity/react-hooks/-/react-hooks-1.149.8.tgz#18883e949dc9eb7993bf1617377db976591340a3"
1178+
"@sanity/react-hooks@1.149.10":
1179+
version "1.149.10"
1180+
resolved "https://registry.npmjs.org/@sanity/react-hooks/-/react-hooks-1.149.10.tgz#07dddeded163ff2adc7b85917550893f2d18bbe2"
11811181
dependencies:
1182-
"@sanity/base" "1.149.8"
1182+
"@sanity/base" "1.149.10"
11831183
lodash "^4.17.15"
11841184
rxjs "^6.5.3"
11851185
shallow-equals "^1.0.0"

web/gatsby-config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,15 @@ module.exports = {
1212
pathToConfigModule: `src/utils/typography`,
1313
},
1414
},
15+
{
16+
resolve: 'gatsby-source-sanity',
17+
options: {
18+
projectId: 'up6uy0tw',
19+
dataset: 'production',
20+
// a token with read permissions is required
21+
// if you have a private dataset
22+
// token: process.env.MY_SANITY_TOKEN,
23+
},
24+
},
1525
],
1626
}

0 commit comments

Comments
 (0)