Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Toolpad file schema reference to the docs #1940

Merged
merged 31 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ jobs:
- run:
name: '`yarn prettier` changes committed?'
command: yarn prettier --check
- run:
name: '`yarn jsonSchemas` changes committed?'
command: |
yarn jsonSchemas
git diff --exit-code

test_unit:
<<: *defaults
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.next
.yarn
/docs/export
/docs/schemas
/packages/**/dist
/packages/toolpad-app/.next
/packages/toolpad-app/public
Expand Down
36 changes: 16 additions & 20 deletions docs/data/pages.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import type { MuiPage } from '@mui/monorepo/docs/src/MuiPage';
import SchemaIcon from '@mui/icons-material/Schema';
import BuildIcon from '@mui/icons-material/Build';
import CodeIcon from '@mui/icons-material/Code';
import DescriptionIcon from '@mui/icons-material/Description';
import TableViewIcon from '@mui/icons-material/TableView';
import VisibilityIcon from '@mui/icons-material/Visibility';

const pages: MuiPage[] = [
{
pathname: '/toolpad/getting-started',
icon: 'DescriptionIcon',
icon: DescriptionIcon,
children: [
{ pathname: '/toolpad/getting-started/overview' },
{ pathname: '/toolpad/getting-started/quickstart' },
Expand All @@ -13,7 +19,7 @@ const pages: MuiPage[] = [
},
{
pathname: '/toolpad/connecting-to-datasources',
icon: 'TableViewIcon',
icon: TableViewIcon,
children: [
{
pathname: '/toolpad/connecting-to-datasources/queries',
Expand All @@ -31,7 +37,7 @@ const pages: MuiPage[] = [
{
pathname: '/toolpad/building-ui',
title: 'Building UI',
icon: 'VisibilityIcon',
icon: VisibilityIcon,
children: [
{
pathname: '/toolpad/building-ui/component-library',
Expand All @@ -53,27 +59,17 @@ const pages: MuiPage[] = [
},
{
pathname: '/toolpad/data-binding',
icon: 'CodeIcon',
icon: CodeIcon,
},
{
pathname: '/toolpad/deployment',
icon: 'BuildIcon',
icon: BuildIcon,
},
{
pathname: '/toolpad/schema-reference',
title: 'Schema Reference',
icon: SchemaIcon,
},
// {
// pathname: '/toolpad/versioning-and-deploying',
// title: 'Versioning & deploying [TODO]',
// icon: 'ToggleOnIcon',
// children: [
// {
// pathname: '/toolpad/versioning-and-deploying/releases',
// },
// ],
// },
// {
// pathname: '/toolpad/faq',
// title: 'FAQ [TODO]',
// icon: 'ReaderIcon',
// },
];

export default pages;
2 changes: 2 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"express": "4.18.2",
"fg-loadcss": "3.1.0",
"fs-extra": "11.1.1",
"invariant": "2.2.4",
"jss-rtl": "0.3.0",
"lodash": "4.17.21",
"lz-string": "1.5.0",
Expand Down Expand Up @@ -89,6 +90,7 @@
"@babel/plugin-transform-react-constant-elements": "7.21.3",
"@babel/preset-typescript": "7.21.5",
"@types/doctrine": "0.0.5",
"@types/json-schema": "7.0.11",
"@types/react-is": "^18.2.0",
"cpy-cli": "4.2.0",
"cross-fetch": "3.1.5",
Expand Down
22 changes: 22 additions & 0 deletions docs/pages/toolpad/schema-reference/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as React from 'react';
import { GetStaticProps } from 'next';
import * as path from 'path';
import * as fs from 'fs/promises';
import SchemaReference, {
SchemaReferenceProps,
} from '../../../src/modules/components/SchemaReference';

export const getStaticProps: GetStaticProps<SchemaReferenceProps> = async () => {
const schemaFile = path.join(process.cwd(), './schemas/v1/definitions.json');
const content = await fs.readFile(schemaFile, { encoding: 'utf-8' });

return {
props: {
definitions: JSON.parse(content),
},
};
};

export default function ApiReference(props: SchemaReferenceProps) {
return <SchemaReference {...props} />;
}
Loading
Loading