This file contains hidden or 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
| import React from "react"; | |
| import Img from "gatsby-image"; | |
| import { getFluidGatsbyImage } from "gatsby-source-sanity"; | |
| import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; | |
| import { atomDark } from "react-syntax-highlighter/dist/esm/styles/prism"; | |
| import iconLinksList from "./iconLinksList.js"; | |
| import YouTube from "../components/YouTube.js"; | |
| import getYouTubeID from "get-youtube-id"; | |
| const sanityConfig = { projectId: "rx426fbd", dataset: "production" }; |
This file contains hidden or 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
| @import 'part:@sanity/base/theme/variables-style'; | |
| .item { | |
| padding: var(--small-padding); | |
| } | |
| .searchableSelect { | |
| composes: spacing from 'part:@sanity/components/buttons/default-style'; | |
| grid-column: span 2; |
This file contains hidden or 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
| /* eslint-disable no-console */ | |
| import client from 'part:@sanity/base/client' | |
| // Run this script with: `sanity exec --with-user-token migrations/migrateValues.js` | |
| // | |
| // This example shows how you may write a migration script that migrates a field value | |
| // on a specific document type. | |
| // This will migrate documents in batches of 100 and continue patching until no more documents are | |
| // returned from the query. | |
| // |
This file contains hidden or 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
| // Example of how to output this in a React frontend | |
| import React from 'react' | |
| import BlockContent from '@sanity/block-content-to-react' | |
| import { TwitterTweetEmbed } from 'react-twitter-embed' | |
| const Tweet = ({url}) => { | |
| const exp = /\/status\/(\d+)($|[?/])/ | |
| const [, id] = exp.exec(url) || [] | |
| if (id) { | |
| return <TwitterTweetEmbed className="sliderBoxes" tweetId={id} options={{conversation: 'none', 'hide-thread': true}} /> |
This file contains hidden or 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
| /** | |
| * import.js | |
| * | |
| * Install dependencies: | |
| * yarn add p-queue nanoid | |
| * or | |
| * npm i p-queue nanoid && sanity install | |
| * | |
| * Run this script with: | |
| * sanity exec --with-user-token import.js |
This file contains hidden or 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
| import S from '@sanity/desk-tool/structure-builder' | |
| import eachDayOfInterval from 'date-fns/eachDayOfInterval' | |
| import startOfYear from 'date-fns/startOfYear' | |
| import startOfDay from 'date-fns/startOfDay' | |
| import endOfDay from 'date-fns/endOfDay' | |
| let now = new Date() | |
| export default () => S.listItem() | |
| .title('Entries by day this year') | |
| .child( |
This file contains hidden or 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
| export default { | |
| name: 'gallery', | |
| type: 'array', | |
| title: 'Gallery', | |
| description: 'Drag and drop multiple images onto this field to batch upload', | |
| of: [ | |
| { | |
| type: 'image' | |
| } | |
| ], |
This file contains hidden or 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
| import T from '@sanity/base/initial-value-template-builder' | |
| import client from 'part:@sanity/base/client' | |
| const getNextDigestTitle = async () => { | |
| const titles = await client.fetch(`*[ | |
| _type == "post" && | |
| title match "Community Digest*" | |
| ].title | |
| `) | |
This file contains hidden or 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
| // web/gatsby-node.js | |
| /** | |
| * Implement Gatsby's Node APIs in this file. | |
| * | |
| * See: https://www.gatsbyjs.org/docs/node-apis/ | |
| */ | |
| exports.createResolvers = ({ createResolvers }) => { | |
| const resolvers = { | |
| SanityTopping: { |
This file contains hidden or 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
| export default { | |
| name: 'department', | |
| type: 'document', | |
| title: 'Department', | |
| fields: [ | |
| { | |
| name: 'title', | |
| type: 'string', | |
| title: 'Title', | |
| }, |