From e046a8fd4bea053b3c720dd479d39b1398910dff Mon Sep 17 00:00:00 2001 From: Simon Vrachliotis Date: Fri, 24 Nov 2023 13:08:08 +1100 Subject: [PATCH 1/9] page layout + keystatic schema --- docs/keystatic.config.tsx | 72 +++++++- docs/next.config.js | 5 +- docs/src/app/(public)/resources/layout.tsx | 29 +++ docs/src/app/(public)/resources/page.tsx | 173 ++++++++++++++++++ docs/src/content/navigation.yaml | 5 + .../resources/7-things-i-about-keystatic.yaml | 16 ++ ...debase-editing-with-minimal-footprint.yaml | 16 ++ ...rkdoc-what-is-it-and-why-do-i-love-it.yaml | 16 ++ ...atic-with-astro-s-content-collections.yaml | 16 ++ .../meet-keystatic-by-jed-watson.yaml | 14 ++ ...time-previews-with-next-js-draft-mode.yaml | 18 ++ 11 files changed, 378 insertions(+), 2 deletions(-) create mode 100644 docs/src/app/(public)/resources/layout.tsx create mode 100644 docs/src/app/(public)/resources/page.tsx create mode 100644 docs/src/content/resources/7-things-i-about-keystatic.yaml create mode 100644 docs/src/content/resources/codebase-editing-with-minimal-footprint.yaml create mode 100644 docs/src/content/resources/dinesh-pandiyan-markdoc-what-is-it-and-why-do-i-love-it.yaml create mode 100644 docs/src/content/resources/keystatic-with-astro-s-content-collections.yaml create mode 100644 docs/src/content/resources/meet-keystatic-by-jed-watson.yaml create mode 100644 docs/src/content/resources/real-time-previews-with-next-js-draft-mode.yaml diff --git a/docs/keystatic.config.tsx b/docs/keystatic.config.tsx index fb6d786f3..2417af903 100644 --- a/docs/keystatic.config.tsx +++ b/docs/keystatic.config.tsx @@ -89,7 +89,7 @@ export default config({ name: 'Keystatic Docs', }, navigation: { - Pages: ['pages', 'blog', 'projects'], + Pages: ['pages', 'blog', 'projects', 'resources'], Config: ['authors', 'navigation'], Experimental: ['pagesWithMarkdocField'], }, @@ -261,6 +261,76 @@ export default config({ }, }), + // ------------------------------ + // Resources + // ------------------------------ + resources: collection({ + label: 'Resources', + path: 'src/content/resources/*', + slugField: 'title', + schema: { + title: fields.slug({ name: { label: 'Title' } }), + type: fields.conditional( + fields.select({ + label: 'Resource type', + options: [ + { label: 'YouTube video', value: 'youtube-video' }, + { label: 'Talk', value: 'talk' }, + { label: 'Article', value: 'article' }, + ], + defaultValue: 'youtube-video', + }), + { + // "none" condition + none: fields.empty(), + // "youtube-video" condition + 'youtube-video': fields.object({ + videoId: fields.text({ + label: 'Video ID', + description: 'The ID of the video (not the URL!)', + validation: { length: { min: 1 } }, + }), + thumbnail: fields.object({ + asset: fields.cloudImage({ + label: 'Video thumbnail', + description: 'A 16/9 thumbnail image for the video.', + }), + }), + description: fields.text({ + label: 'Video description', + multiline: true, + }), + }), + talk: fields.object({ + videoId: fields.text({ + label: 'Video ID', + description: 'The ID of the video (not the URL!)', + validation: { length: { min: 1 } }, + }), + thumbnail: fields.object({ + asset: fields.cloudImage({ + label: 'Video thumbnail', + description: 'A 16/9 thumbnail image for the video.', + }), + }), + description: fields.text({ + label: 'Video description', + multiline: true, + }), + }), + // TODO: + article: fields.object({}), + } + ), + sortIndex: fields.integer({ + label: 'Sort index', + description: + 'A number value to sort items (low to high) on the front end.', + defaultValue: 10, + }), + }, + }), + // ------------------------------ // For testing purposes only // ------------------------------ diff --git a/docs/next.config.js b/docs/next.config.js index 2c6155886..c4bd261fc 100644 --- a/docs/next.config.js +++ b/docs/next.config.js @@ -6,7 +6,10 @@ module.exports = { externalDir: true, }, images: { - remotePatterns: [{ hostname: 'thinkmill-labs.keystatic.net' }], + remotePatterns: [ + { hostname: 'thinkmill-labs.keystatic.net' }, + { hostname: 'i3.ytimg.com' }, + ], }, async redirects() { return [ diff --git a/docs/src/app/(public)/resources/layout.tsx b/docs/src/app/(public)/resources/layout.tsx new file mode 100644 index 000000000..5241189d3 --- /dev/null +++ b/docs/src/app/(public)/resources/layout.tsx @@ -0,0 +1,29 @@ +import { Main } from '../../../components/main'; +import Footer from '../../../components/footer'; + +export const metadata = { + title: { + template: '%s - Resources | Keystatic', + default: 'Resources', + }, +}; + +export default async function RootLayout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> +
+ {/** CONTENT */} + +
+ {/** INNER CONTENT */} +
{children}
+
+
+