Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jebeni777 committed Feb 24, 2020
0 parents commit d68c8c0
Show file tree
Hide file tree
Showing 19 changed files with 8,504 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Sanity Blogging Content Studio

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

Now you can do the following things:

- [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme)
- Check out the example frontend: [React/Next.js](https://github.com/sanity-io/tutorial-sanity-blog-react-next)
- [Read the blog post about this template](https://www.sanity.io/blog/build-your-own-blog-with-sanity-and-next-js?utm_source=readme)
- [Join the community Slack](https://slack.sanity.io/?utm_source=readme)
- [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme)
7 changes: 7 additions & 0 deletions config/.checksums
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"#": "Used by Sanity to keep track of configuration file checksums, do not delete or modify!",
"@sanity/default-layout": "bb034f391ba508a6ca8cd971967cbedeb131c4d19b17b28a0895f32db5d568ea",
"@sanity/default-login": "6fb6d3800aa71346e1b84d95bbcaa287879456f2922372bb0294e30b968cd37f",
"@sanity/form-builder": "b38478227ba5e22c91981da4b53436df22e48ff25238a55a973ed620be5068aa",
"@sanity/data-aspects": "d199e2c199b3e26cd28b68dc84d7fc01c9186bf5089580f2e2446994d36b3cb6"
}
3 changes: 3 additions & 0 deletions config/@sanity/data-aspects.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"listOptions": {}
}
6 changes: 6 additions & 0 deletions config/@sanity/default-layout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"toolSwitcher": {
"order": [],
"hidden": []
}
}
7 changes: 7 additions & 0 deletions config/@sanity/default-login.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"providers": {
"mode": "append",
"redirectOnSingle": false,
"entries": []
}
}
5 changes: 5 additions & 0 deletions config/@sanity/form-builder.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"images": {
"directUploads": true
}
}
29 changes: 29 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "backendtoclient",
"private": true,
"version": "1.0.0",
"description": "",
"main": "package.json",
"author": "jebeni777 <[email protected]>",
"license": "UNLICENSED",
"scripts": {
"start": "sanity start",
"test": "sanity check"
},
"keywords": [
"sanity"
],
"dependencies": {
"@sanity/base": "^1.148.5",
"@sanity/components": "^1.148.5",
"@sanity/core": "^1.148.5",
"@sanity/default-layout": "^1.148.5",
"@sanity/default-login": "^1.148.1",
"@sanity/desk-tool": "^1.148.6",
"@sanity/vision": "^1.148.1",
"prop-types": "^15.6",
"react": "^16.2",
"react-dom": "^16.2"
},
"devDependencies": {}
}
1 change: 1 addition & 0 deletions plugins/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
User-specific packages can be placed here
30 changes: 30 additions & 0 deletions sanity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"root": true,
"project": {
"name": "backend-to-client"
},
"api": {
"projectId": "isuhgmk8",
"dataset": "production"
},
"plugins": [
"@sanity/base",
"@sanity/components",
"@sanity/default-layout",
"@sanity/default-login",
"@sanity/desk-tool"
],
"env": {
"development": {
"plugins": [
"@sanity/vision"
]
}
},
"parts": [
{
"name": "part:@sanity/base/schema",
"path": "./schemas/schema.js"
}
]
}
48 changes: 48 additions & 0 deletions schemas/author.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
export default {
name: 'author',
title: 'Author',
type: 'document',
fields: [
{
name: 'name',
title: 'Name',
type: 'string'
},
{
name: 'slug',
title: 'Slug',
type: 'slug',
options: {
source: 'name',
maxLength: 96
}
},
{
name: 'image',
title: 'Image',
type: 'image',
options: {
hotspot: true
}
},
{
name: 'bio',
title: 'Bio',
type: 'array',
of: [
{
title: 'Block',
type: 'block',
styles: [{title: 'Normal', value: 'normal'}],
lists: []
}
]
}
],
preview: {
select: {
title: 'name',
media: 'image'
}
}
}
62 changes: 62 additions & 0 deletions schemas/blockContent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* This is the schema definition for the rich text fields used for
* for this blog studio. When you import it in schemas.js it can be
* reused in other parts of the studio with:
* {
* name: 'someName',
* title: 'Some title',
* type: 'blockContent'
* }
*/
export default {
title: 'Block Content',
name: 'blockContent',
type: 'array',
of: [
{
title: 'Block',
type: 'block',
// Styles let you set what your user can mark up blocks with. These
// corrensponds with HTML tags, but you can set any title or value
// you want and decide how you want to deal with it where you want to
// use your content.
styles: [
{title: 'Normal', value: 'normal'},
{title: 'H1', value: 'h1'},
{title: 'H2', value: 'h2'},
{title: 'H3', value: 'h3'},
{title: 'H4', value: 'h4'},
{title: 'Quote', value: 'blockquote'}
],
lists: [{title: 'Bullet', value: 'bullet'}],
// Marks let you mark up inline text in the block editor.
marks: {
// Decorators usually describe a single property – e.g. a typographic
// preference or highlighting by editors.
decorators: [{title: 'Strong', value: 'strong'}, {title: 'Emphasis', value: 'em'}],
// Annotations can be any object structure – e.g. a link or a footnote.
annotations: [
{
title: 'URL',
name: 'link',
type: 'object',
fields: [
{
title: 'URL',
name: 'href',
type: 'url'
}
]
}
]
}
},
// You can add additional types here. Note that you can't use
// primitive types such as 'string' and 'number' in the same array
// as a block type.
{
type: 'image',
options: {hotspot: true}
}
]
}
17 changes: 17 additions & 0 deletions schemas/category.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default {
name: 'category',
title: 'Category',
type: 'document',
fields: [
{
name: 'title',
title: 'Title',
type: 'string'
},
{
name: 'description',
title: 'Description',
type: 'text'
}
]
}
65 changes: 65 additions & 0 deletions schemas/post.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
export default {
name: 'post',
title: 'Post',
type: 'document',
fields: [
{
name: 'title',
title: 'Title',
type: 'string'
},
{
name: 'slug',
title: 'Slug',
type: 'slug',
options: {
source: 'title',
maxLength: 96
}
},
{
name: 'author',
title: 'Author',
type: 'reference',
to: {type: 'author'}
},
{
name: 'mainImage',
title: 'Main image',
type: 'image',
options: {
hotspot: true
}
},
{
name: 'categories',
title: 'Categories',
type: 'array',
of: [{type: 'reference', to: {type: 'category'}}]
},
{
name: 'publishedAt',
title: 'Published at',
type: 'datetime'
},
{
name: 'body',
title: 'Body',
type: 'blockContent'
}
],

preview: {
select: {
title: 'title',
author: 'author.name',
media: 'mainImage'
},
prepare(selection) {
const {author} = selection
return Object.assign({}, selection, {
subtitle: author && `by ${author}`
})
}
}
}
29 changes: 29 additions & 0 deletions schemas/schema.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// First, we must import the schema creator
import createSchema from 'part:@sanity/base/schema-creator'

// Then import schema types from any plugins that might expose them
import schemaTypes from 'all:part:@sanity/base/schema-type'

// We import object and document schemas
import blockContent from './blockContent'
import category from './category'
import post from './post'
import author from './author'

// Then we give our schema to the builder and provide the result to Sanity
export default createSchema({
// We name our schema
name: 'default',
// Then proceed to concatenate our document type
// to the ones provided by any plugins that are installed
types: schemaTypes.concat([
// The following are document types which will appear
// in the studio.
post,
author,
category,
// When added to this list, object types can be used as
// { type: 'typename' } in other document schemas
blockContent
])
})
1 change: 1 addition & 0 deletions static/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Files placed here will be served by the Sanity server under the `/static`-prefix
Binary file added static/favicon.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"include": ["./node_modules/@sanity/base/types/**/*.ts", "./**/*.ts", "./**/*.tsx"]
}
Loading

0 comments on commit d68c8c0

Please sign in to comment.