-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add initial page-building test studio (#6735)
This is just some initial test studio code to get us going on page building. Nothing is set in stone.
- Loading branch information
1 parent
e9b967f
commit cca14f3
Showing
14 changed files
with
267 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "@sanity/eslint-config-studio" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# Dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# Compiled Sanity Studio | ||
/dist | ||
|
||
# Temporary Sanity runtime, generated by the CLI on every dev server start | ||
/.sanity | ||
|
||
# Logs | ||
/logs | ||
*.log | ||
|
||
# Coverage directory used by testing tools | ||
/coverage | ||
|
||
# Misc | ||
.DS_Store | ||
*.pem | ||
|
||
# Typescript | ||
*.tsbuildinfo | ||
|
||
# Dotenv and similar local-only files | ||
*.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Page Building Studio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "sanity-page-building-studio", | ||
"version": "3.43.0", | ||
"private": true, | ||
"license": "MIT", | ||
"author": "Sanity.io <[email protected]>", | ||
"scripts": { | ||
"build": "../.bin/sanity build", | ||
"clean": "rimraf .sanity dist", | ||
"dev": "../.bin/sanity dev", | ||
"lint": "eslint .", | ||
"start": "../.bin/sanity start" | ||
}, | ||
"dependencies": { | ||
"@sanity/vision": "workspace:*", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-icons": "^5.2.1", | ||
"sanity": "workspace:*", | ||
"styled-components": "^6.1.8" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import {defineCliConfig} from 'sanity/cli' | ||
|
||
export default defineCliConfig({ | ||
api: { | ||
projectId: 'ppsg7ml5', | ||
dataset: 'page-building', | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {visionTool} from '@sanity/vision' | ||
import {defineConfig} from 'sanity' | ||
import {structureTool} from 'sanity/structure' | ||
|
||
import {schemaTypes} from './schemaTypes' | ||
|
||
export default defineConfig({ | ||
name: 'page-building', | ||
title: 'Page Building', | ||
|
||
projectId: 'ppsg7ml5', | ||
dataset: 'page-building', | ||
|
||
plugins: [structureTool(), visionTool()], | ||
|
||
schema: { | ||
types: schemaTypes, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import {MdMonitor} from 'react-icons/md' | ||
import {defineField, defineType} from 'sanity' | ||
|
||
export const hero = defineType({ | ||
type: 'object', | ||
name: 'hero', | ||
title: 'Hero', | ||
fields: [ | ||
defineField({ | ||
type: 'string', | ||
name: 'title', | ||
title: 'Title', | ||
}), | ||
defineField({ | ||
type: 'string', | ||
name: 'lead', | ||
title: 'Lead', | ||
}), | ||
], | ||
preview: { | ||
select: { | ||
title: 'title', | ||
}, | ||
prepare({title}) { | ||
return { | ||
title, | ||
subtitle: 'Hero', | ||
media: MdMonitor, | ||
} | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import {hero} from './hero' | ||
import {logoCarousel} from './logoCarousel' | ||
import {page} from './page' | ||
import {testimonial, testimonials} from './testimonials' | ||
|
||
export const schemaTypes = [page, hero, logoCarousel, testimonial, testimonials] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import {FaArrowsRotate} from 'react-icons/fa6' | ||
import {defineField, defineType} from 'sanity' | ||
|
||
export const logoCarousel = defineType({ | ||
type: 'object', | ||
name: 'logo-carousel', | ||
title: 'Logos', | ||
description: 'Logo carousel', | ||
fields: [ | ||
defineField({ | ||
type: 'array', | ||
name: 'logos', | ||
title: 'Logos', | ||
of: [{type: 'image'}], | ||
}), | ||
], | ||
preview: { | ||
select: {}, | ||
prepare() { | ||
return { | ||
title: 'Logos', | ||
subtitle: 'Logo carousel', | ||
media: FaArrowsRotate, | ||
} | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {defineField, defineType} from 'sanity' | ||
|
||
export const page = defineType({ | ||
type: 'document', | ||
name: 'page', | ||
title: 'Page', | ||
fields: [ | ||
defineField({ | ||
type: 'string', | ||
name: 'title', | ||
title: 'Title', | ||
}), | ||
defineField({ | ||
name: 'blocks', | ||
title: 'Blocks', | ||
type: 'array', | ||
of: [{type: 'hero'}, {type: 'logo-carousel'}, {type: 'testimonials'}], | ||
}), | ||
], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import {SlSpeech} from 'react-icons/sl' | ||
import {defineField, defineType} from 'sanity' | ||
|
||
export const testimonials = defineType({ | ||
type: 'object', | ||
name: 'testimonials', | ||
title: 'Testimonials', | ||
fields: [ | ||
defineField({ | ||
type: 'array', | ||
name: 'testimonials', | ||
title: 'Testimonials', | ||
of: [ | ||
{ | ||
type: 'reference', | ||
to: [{type: 'testimonial'}], | ||
}, | ||
], | ||
}), | ||
], | ||
preview: { | ||
select: { | ||
testimonials: 'testimonials', | ||
quotee0: 'testimonials.0.quotee', | ||
quotee1: 'testimonials.1.quotee', | ||
quotee2: 'testimonials.2.quotee', | ||
}, | ||
prepare({quotee0, quotee1, quotee2}) { | ||
const quotees = [quotee0, quotee1].filter(Boolean) | ||
const subtitle = quotees.length > 0 ? quotees.join(', ') : '' | ||
const hasMore = Boolean(quotee2) | ||
|
||
return { | ||
title: 'Testimonials', | ||
subtitle: hasMore ? `${subtitle}...` : subtitle, | ||
media: SlSpeech, | ||
} | ||
}, | ||
}, | ||
}) | ||
|
||
export const testimonial = defineType({ | ||
type: 'document', | ||
name: 'testimonial', | ||
title: 'Testimonial', | ||
fields: [ | ||
defineField({ | ||
type: 'array', | ||
name: 'quote', | ||
title: 'Quote', | ||
of: [{type: 'block'}], | ||
}), | ||
defineField({ | ||
type: 'string', | ||
name: 'quotee', | ||
title: 'Quotee', | ||
}), | ||
defineField({ | ||
type: 'string', | ||
name: 'jobTitle', | ||
title: 'Job Title', | ||
}), | ||
], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": ["../tsconfig.dev"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.