Skip to content

Commit

Permalink
Added navigation buttons in other sections of website (#1218)
Browse files Browse the repository at this point in the history
  • Loading branch information
Utkarsh-123github authored Jan 7, 2025
1 parent 8f2c85f commit 72ae168
Show file tree
Hide file tree
Showing 47 changed files with 315 additions and 12 deletions.
7 changes: 7 additions & 0 deletions pages/[slug].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import getStaticMarkdownProps from '~/lib/getStaticMarkdownProps';
import { Headline1 } from '~/components/Headlines';
import { SectionContext } from '~/context';
import { DocsHelp } from '~/components/DocsHelp';
import NextPrevButton from '~/components/NavigationButtons';

export async function getStaticPaths() {
return getStaticMarkdownPaths('pages');
Expand All @@ -31,6 +32,12 @@ export default function StaticMarkdownPage({
</Head>
<Headline1>{frontmatter.title}</Headline1>
<StyledMarkdown markdown={content} />
<NextPrevButton
prevLabel={frontmatter?.prev?.label}
prevURL={frontmatter?.prev?.url}
nextLabel={frontmatter?.next?.label}
nextURL={frontmatter?.next?.url}
/>
<DocsHelp markdownFile={markdownFile} />
</SectionContext.Provider>
);
Expand Down
7 changes: 7 additions & 0 deletions pages/implementers/[slug].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import getStaticMarkdownProps from '~/lib/getStaticMarkdownProps';
import { Headline1 } from '~/components/Headlines';
import { SectionContext } from '~/context';
import { DocsHelp } from '~/components/DocsHelp';
import NextPrevButton from '~/components/NavigationButtons';

export async function getStaticPaths() {
return getStaticMarkdownPaths('pages/implementers');
Expand All @@ -31,6 +32,12 @@ export default function StaticMarkdownPage({
</Head>
<Headline1>{frontmatter.title}</Headline1>
<StyledMarkdown markdown={content} />
<NextPrevButton
prevLabel={frontmatter?.prev?.label}
prevURL={frontmatter?.prev?.url}
nextLabel={frontmatter?.next?.label}
nextURL={frontmatter?.next?.url}
/>
<DocsHelp markdownFile={markdownFile} />
</SectionContext.Provider>
);
Expand Down
6 changes: 6 additions & 0 deletions pages/implementers/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
title: "For Implementers"
section: docs
prev:
label: Structuring a complex schema
url: /understanding-json-schema/structuring
next:
label: Common Interfaces across Implementations
url: /implementers/interfaces
---

For Implementers
Expand Down
17 changes: 15 additions & 2 deletions pages/implementers/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import StyledMarkdown from '~/components/StyledMarkdown';
import { DocsHelp } from '~/components/DocsHelp';
import { SectionContext } from '~/context';
import Card from '~/components/Card';
import NextPrevButton from '~/components/NavigationButtons';

export async function getStaticProps() {
const block1 = fs.readFileSync('pages/implementers/_index.md', 'utf-8');
Expand All @@ -17,13 +18,19 @@ export async function getStaticProps() {
};
}

export default function ContentExample({ blocks }: { blocks: any[] }) {
export default function ContentExample({
blocks,
}: {
blocks: any[];
frontmatter: any;
content: any;
}) {
const markdownFile = '_indexPage';

return (
<SectionContext.Provider value='docs'>
<StyledMarkdown markdown={blocks[0]} />
<section className='mt-10'>
<section className='my-10'>
<div className='grid grid-cols-1 md:grid-cols-2 gap-4 w-12/12 md:w-11/12 lg:w-10/12 xl:w-10/12 m-auto'>
<Card
key='common-interfaces'
Expand All @@ -45,6 +52,12 @@ export default function ContentExample({ blocks }: { blocks: any[] }) {
/>
</div>
</section>
<NextPrevButton
prevLabel='Structuring a complex schema'
prevURL='/understanding-json-schema/structuring'
nextLabel='Common Interfaces across Implementations'
nextURL='/implementers/interfaces'
/>
<DocsHelp markdownFile={markdownFile} />
</SectionContext.Provider>
);
Expand Down
6 changes: 6 additions & 0 deletions pages/implementers/interfaces.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
title: Common Interfaces across JSON Schema Implementations
section: implementers
prev:
label: For Implementers
url: /implementers
next:
label: Specification
url: /specification
---

JSON Schema is extremely widely used and nearly equally widely implemented.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
title: Creating your first schema
section: docs
prev:
label: Overview
url: /learn
next:
label: Miscellaneous examples
url: /learn/miscellaneous-examples
---

JSON Schema is a vocabulary that you can use to annotate and validate JSON documents. This tutorial guides you through the process of creating a JSON Schema.
Expand Down
15 changes: 14 additions & 1 deletion pages/learn/getting-started-step-by-step/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import StyledMarkdown from '~/components/StyledMarkdown';
import { SectionContext } from '~/context';
import { DocsHelp } from '~/components/DocsHelp';
import GettingStarted from '~/components/GettingStarted';
import NextPrevButton from '~/components/NavigationButtons';

export async function getStaticProps() {
const block1 = fs.readFileSync(
Expand All @@ -28,7 +29,13 @@ export async function getStaticProps() {
};
}

export default function StyledValidator({ blocks }: { blocks: any[] }) {
export default function StyledValidator({
blocks,
}: {
blocks: any[];
frontmatter: any;
content: any;
}) {
const newTitle = 'Creating your first schema';

return (
Expand All @@ -40,6 +47,12 @@ export default function StyledValidator({ blocks }: { blocks: any[] }) {
<StyledMarkdown markdown={blocks[0]} />
<GettingStarted />
<StyledMarkdown markdown={blocks[1]} />
<NextPrevButton
prevLabel='Overview'
prevURL='/learn'
nextLabel='Miscellaneous examples'
nextURL='/learn/miscellaneous-examples'
/>
<DocsHelp />
</SectionContext.Provider>
);
Expand Down
6 changes: 6 additions & 0 deletions pages/learn/glossary.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
title: JSON Schema Glossary
section: docs
prev:
label: Other Examples
url: /learn/json-schema-examples
next:
label: JSON Schema Keywords
url: /understanding-json-schema/keywords
---

This document collects short explanations of terminology one may encounter within the JSON Schema community.
Expand Down
7 changes: 7 additions & 0 deletions pages/learn/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Headline1 } from '~/components/Headlines';
import { SectionContext } from '~/context';
import Card from '~/components/Card';
import { DocsHelp } from '~/components/DocsHelp';
import NextPrevButton from '~/components/NavigationButtons';

export default function Welcome() {
const markdownFile = '_indexPage';
Expand Down Expand Up @@ -39,6 +40,12 @@ export default function Welcome() {
link='https://tour.json-schema.org/'
/>
</div>
<NextPrevButton
prevLabel='Code of Conduct'
prevURL='/overview/code-of-conduct'
nextLabel='Creating your first Schema'
nextURL='/learn/getting-started-step-by-step'
/>
<DocsHelp markdownFile={markdownFile} />
</SectionContext.Provider>
);
Expand Down
4 changes: 2 additions & 2 deletions pages/learn/json-schema-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ prev:
label: Modeling a file system
url: /learn/file-system
next:
label: Miscellaneous examples
url: /learn/miscellaneous-examples
label: JSON Scehma Glossary
url: /learn/glossary
---

In this page, you will find examples illustrating different use cases to help you get the most out of your JSON Schemas. These examples cover a wide range of scenarios, and each example comes with accompanying JSON data and explanation, showcasing how JSON Schemas can be applied to various domains. You can modify these examples to suit your specific needs, as this is just one of the many ways you can utilize JSON Schemas.
Expand Down
3 changes: 3 additions & 0 deletions pages/learn/miscellaneous-examples.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
section: docs
title: Miscellaneous Examples
prev :
label: Creating your first Schema
url: /learn/getting-started-step-by-step
next:
label: Modelling a file system
url: /learn/file-system
Expand Down
4 changes: 2 additions & 2 deletions pages/overview/code-of-conduct/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export default function Content({
<NextPrevButton
prevLabel='Similar-Technologies'
prevURL='/overview/similar-technologies'
nextLabel='What is JSON Schema'
nextURL='/overview/what-is-jsonschema'
nextLabel='Getting Started'
nextURL='/learn'
/>
<DocsHelp />
</SectionContext.Provider>
Expand Down
6 changes: 6 additions & 0 deletions pages/specification-links.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
title: Specification Links
section: docs
prev:
label: Specification
url: /specification
next:
label: Migration
url: /specification/migration
---

<!-- Links on this page should be immutable - none of them should go to `/latest`, etc. -->
Expand Down
6 changes: 6 additions & 0 deletions pages/specification.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
title: Specification [#section]
section: docs
prev:
label: Common Interfaces across Implementations
url: /implementers/interfaces
next:
label: Specification Links
url: /specification-links
---

The current version is *2020-12*!
Expand Down
6 changes: 6 additions & 0 deletions pages/specification/json-hyper-schema/_index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
---
title: JSON Hyper-Schema
prev:
label: Release Notes
url: /specification/release-notes
next:
label: What is JSON Schema?
url: /overview/what-is-jsonschema
---

### Introduction
Expand Down
7 changes: 7 additions & 0 deletions pages/specification/json-hyper-schema/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import StyledMarkdown from '~/components/StyledMarkdown';
import { SectionContext } from '~/context';
import { Headline1 } from '~/components/Headlines';
import { DocsHelp } from '~/components/DocsHelp';
import NextPrevButton from '~/components/NavigationButtons';

export async function getStaticProps() {
const index = fs.readFileSync(
Expand Down Expand Up @@ -44,6 +45,12 @@ export default function ImplementationsPages({

<StyledMarkdown markdown={blocks.index} />
<StyledMarkdown markdown={blocks.body} />
<NextPrevButton
prevLabel={frontmatter?.prev?.label}
prevURL={frontmatter?.prev?.url}
nextLabel={frontmatter?.next?.label}
nextURL={frontmatter?.next?.url}
/>
<DocsHelp markdownFile={markdownFile} />
</SectionContext.Provider>
);
Expand Down
6 changes: 6 additions & 0 deletions pages/specification/migration/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
title: Migrating from older drafts
section: docs
prev:
label: Specification Links
url: /specification-links
next:
label: Release Notes
url: /specification/release-notes
---

The release notes discuss the changes impacting users and implementers:
Expand Down
9 changes: 8 additions & 1 deletion pages/specification/migration/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Headline1 } from '~/components/Headlines';
import { SectionContext } from '~/context';
import Card from '~/components/Card';
import { DocsHelp } from '~/components/DocsHelp';
import NextPrevButton from '~/components/NavigationButtons';

export async function getStaticProps() {
const index = fs.readFileSync(
Expand Down Expand Up @@ -42,7 +43,7 @@ export default function ImplementationsPages({
<Headline1>{frontmatter.title}</Headline1>
<StyledMarkdown markdown={blocks.index} />
<StyledMarkdown markdown={blocks.body} />
<div className='w-full lg:w-full grid grid-cols-1 sm:grid-cols-2 gap-6 my-[10px] mx-auto mt-8'>
<div className='w-full lg:w-full grid grid-cols-1 sm:grid-cols-2 gap-6 my-[10px] mx-auto mt-8 mb-4'>
<Card
title='Draft 2019-09 to Draft 2020-12'
body='Details for migrations from Draft 2019-09 to 2020-12.'
Expand Down Expand Up @@ -72,6 +73,12 @@ export default function ImplementationsPages({
link='/draft-06/json-schema-release-notes'
/>
</div>
<NextPrevButton
prevLabel={frontmatter?.prev?.label}
prevURL={frontmatter?.prev?.url}
nextLabel={frontmatter?.next?.label}
nextURL={frontmatter?.next?.url}
/>
<DocsHelp markdownFile={markdownFile} />
</SectionContext.Provider>
);
Expand Down
6 changes: 6 additions & 0 deletions pages/specification/release-notes/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
title: Release notes
type: docs
prev:
label: Migration
url: /specification/migration
next:
label: JSON Hyper-Schema
url: /specification/json-hyper-schema
---

Find below the Release Notes of all JSON Schema drafts:
9 changes: 8 additions & 1 deletion pages/specification/release-notes/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Headline1 } from '~/components/Headlines';
import { SectionContext } from '~/context';
import Card from '~/components/Card';
import { DocsHelp } from '~/components/DocsHelp';
import NextPrevButton from '~/components/NavigationButtons';

export async function getStaticProps() {
const index = fs.readFileSync(
Expand Down Expand Up @@ -42,7 +43,7 @@ export default function ImplementationsPages({
<Headline1>{frontmatter.title}</Headline1>
<StyledMarkdown markdown={blocks.index} />
<StyledMarkdown markdown={blocks.body} />
<div className='w-full lg:w-full grid grid-cols-1 sm:grid-cols-2 gap-6 my-[10px] mx-auto mt-8'>
<div className='w-full lg:w-full grid grid-cols-1 sm:grid-cols-2 gap-6 my-[10px] mx-auto mt-8 mb-6'>
<Card
title='Draft 2020-12'
body='Draft 2020-12 release notes.'
Expand Down Expand Up @@ -79,6 +80,12 @@ export default function ImplementationsPages({
link='/draft-05#explanation-for-lack-of-draft-05-meta-schema'
/>
</div>
<NextPrevButton
prevLabel={frontmatter?.prev?.label}
prevURL={frontmatter?.prev?.url}
nextLabel={frontmatter?.next?.label}
nextURL={frontmatter?.next?.url}
/>
<DocsHelp markdownFile={markdownFile} />
</SectionContext.Provider>
);
Expand Down
7 changes: 7 additions & 0 deletions pages/understanding-json-schema/[slug].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import getStaticMarkdownProps from '~/lib/getStaticMarkdownProps';
import { Headline1 } from '~/components/Headlines';
import { DocsHelp } from '~/components/DocsHelp';
import { SectionContext } from '~/context';
import NextPrevButton from '~/components/NavigationButtons';

export async function getStaticPaths() {
return getStaticMarkdownPaths('pages/understanding-json-schema');
Expand All @@ -31,6 +32,12 @@ export default function StaticMarkdownPage({
</Head>
<Headline1>{frontmatter.title || 'NO TITLE!'}</Headline1>
<StyledMarkdown markdown={content} />
<NextPrevButton
prevLabel={frontmatter?.prev?.label}
prevURL={frontmatter?.prev?.url}
nextLabel={frontmatter?.next?.label}
nextURL={frontmatter?.next?.url}
/>
<DocsHelp markdownFile={markdownFile} />
</SectionContext.Provider>
);
Expand Down
Loading

0 comments on commit 72ae168

Please sign in to comment.