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
// updated to add props editting, rendering component inside iframe & allowing resizing viewer | |
<script context="module"> | |
const modules = import.meta.globEager('/src/sections/*.svelte') | |
const componentNames = Object.keys(modules) | |
</script> | |
<script lang="ts"> | |
import cx from 'clsx' | |
import { browser } from '$app/env' |
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
import S from '@sanity/desk-tool/structure-builder' | |
const DocumentListSansCreate = ({ title, filter }) => { | |
const _documentList = S.documentList() | |
.title(title) | |
.filter(filter) | |
_documentList.__serialize = _documentList.serialize.bind(_documentList) | |
_documentList.serialize = (...args) => { | |
const { menuItems, ...rest } = _documentList.__serialize(...args) |
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
const path = require('path') | |
const fs = require('fs/promises') | |
require('dotenv').config({ | |
// vvvvvvvvvv replace w/ your env | |
path: path.resolve(process.cwd(), '.env.local') | |
}) | |
const createClient = require('@sanity/client') | |
const client = createClient({ | |
projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID, |
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
<script lang="ts"> | |
export let name = 'World' | |
</script> | |
<div>Hello {name}</div> |
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
const { default: Schema } = require("@sanity/schema"); | |
const { htmlToBlocks, randomKey } = require("@sanity/block-tools"); | |
const { JSDOM } = require("jsdom"); | |
const schemaBlog = Schema.compile({ | |
name: "myBlog", | |
types: [ | |
{ | |
title: "Hjelpeartikkel", | |
name: "hjelpeartikkel", |
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
const fs = require('fs') | |
const path = require('path') | |
const toUpperCase = ([first, ...rest]) => [first.toUpperCase(), ...rest].join('') | |
exports.sourceNodes = ({ actions, createContentDigest, store }) => { | |
const { directory } = store.getState().program | |
const raw = fs.readFileSync(path.join(directory, 'package.json')) |
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
const unified = require('unified') | |
const remarkParse = require('remark-parse') | |
const remarkHtml = require('remark-html') | |
exports.createResolvers = ({ | |
createResolvers, | |
}) => { | |
const toHTML = async (source) => { | |
const vfile = await unified() | |
.use(remarkParse) |
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
import differenceBy from 'lodash/differenceBy' | |
export const hasItem = <T>(data: T[], item: T, key: keyof T): boolean => { | |
return data.some(datum => datum[key] === item[key]) | |
} | |
export const removeOutdatedItem = <T>( | |
data: T[], | |
outdated: T[], | |
key: keyof T |
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
/** | |
* This is now a npm package! | |
* Please find the better version of this gist here: | |
* https://github.com/d4rekanguok/netlify-cms-widgets/blob/master/packages/widget-id/src/control.tsx | |
*/ |
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
import React from 'react' | |
import rehypeReact from 'rehype-react' | |
import { Helmet } from 'react-helmet' | |
import { graphql } from 'gatsby' | |
import PropTypes from 'prop-types' | |
import NoteBlock from '../components/note-block' | |
// import '../css/blog-post.css'; // make it pretty! |
NewerOlder