Skip to content

Commit

Permalink
feat: configurable page templates in packages
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Dec 24, 2020
1 parent e7370d3 commit 8aee3b4
Show file tree
Hide file tree
Showing 67 changed files with 2,426 additions and 495 deletions.
23 changes: 12 additions & 11 deletions core/core/src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,11 @@ export interface TabConfiguration {
/**
* title will be used as tab caption
*/
title: string;
/**
* page container type - a key into the component-controls/pages package
*/
type?: string;
title?: string;
/**
* render function, returns a react component
* page template - can be a package deafult template
*/
render?: (props: any) => ReactNode;
template?: string | ComponentType;
}

export type PageTabs = TabConfiguration[];
Expand Down Expand Up @@ -119,7 +115,7 @@ export type PagesConfiguration = Record<DocType, PageConfiguration>;
export type PagesOnlyRoutes = Record<
DocType,
Pick<PageConfiguration, 'basePath' | 'sideNav'> & {
tabs?: Pick<TabConfiguration, 'route'>[];
tabs?: TabConfiguration[];
}
>;

Expand Down Expand Up @@ -367,7 +363,13 @@ export const defaultBuildConfig: BuildConfiguration = {
storyPaths: true,
collapseSingle: true,
},
tabs: [{ route: 'page' }],
tabs: [
{
route: 'page',
title: 'Documentation',
template: require.resolve('@component-controls/pages/ClassicPage'),
},
],
},
blog: {
basePath: 'blogs/',
Expand All @@ -386,7 +388,7 @@ export const defaultBuildConfig: BuildConfiguration = {
/**
* the search plugin search routine
*/
searchingModule: require.resolve('@component-controls/search-fusejs'),
searchingModule: '@component-controls/search-fusejs',
},
};
export const defaultRunConfig: RunConfiguration = {
Expand All @@ -404,7 +406,6 @@ export const defaultRunConfig: RunConfiguration = {
navSidebar: true,
contextSidebar: true,
topMenu: true,
tabs: [{ title: 'Documentation', type: 'ClassicPage' }],
},
blog: {
label: 'Blog',
Expand Down
16 changes: 8 additions & 8 deletions core/instrument/test/__snapshots__/esm-async.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -53,7 +53,7 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
},
"stories": Object {
Expand Down Expand Up @@ -97,7 +97,7 @@ Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -133,7 +133,7 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
},
"stories": Object {
Expand Down Expand Up @@ -193,7 +193,7 @@ Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -229,7 +229,7 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
},
"stories": Object {
Expand Down Expand Up @@ -273,7 +273,7 @@ Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -309,7 +309,7 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
},
"stories": Object {
Expand Down
24 changes: 12 additions & 12 deletions core/instrument/test/__snapshots__/esm-doc.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -64,14 +64,14 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
"73cac298d983c71aec166657453a64fe": Object {
"dependencies": Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -107,7 +107,7 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
},
"stories": Object {},
Expand Down Expand Up @@ -155,7 +155,7 @@ Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -191,14 +191,14 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
"eef0b4fe04a3c49402964c3c8dbe5bc8": Object {
"dependencies": Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -234,7 +234,7 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
},
"stories": Object {},
Expand Down Expand Up @@ -271,7 +271,7 @@ Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -307,7 +307,7 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
},
"stories": Object {},
Expand Down Expand Up @@ -337,7 +337,7 @@ Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -373,7 +373,7 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
},
"stories": Object {},
Expand Down
16 changes: 8 additions & 8 deletions core/instrument/test/__snapshots__/esm-hoisted.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -60,14 +60,14 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
"f287f1a0ceeea6cbbc4c37123d236d06": Object {
"dependencies": Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -103,7 +103,7 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
},
"stories": Object {
Expand Down Expand Up @@ -156,7 +156,7 @@ Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -192,7 +192,7 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
},
"stories": Object {
Expand Down Expand Up @@ -259,7 +259,7 @@ Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -295,7 +295,7 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
},
"stories": Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -53,7 +53,7 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
},
"stories": Object {
Expand Down Expand Up @@ -102,7 +102,7 @@ Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -138,7 +138,7 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
},
"stories": Object {
Expand Down Expand Up @@ -187,7 +187,7 @@ Object {
"@babel/generator": "^7.12.5",
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"@component-controls/core": "^2.2.0",
"@component-controls/core": "^2.3.0",
"@hutson/parse-repository-url": "^5.0.0",
"@mdx-js/loader": "^1.5.5",
"@mdx-js/react": "^1.6.5",
Expand Down Expand Up @@ -223,7 +223,7 @@ Object {
"docs": "https://github.com/ccontrols/component-controls/tree/master#readme",
"issues": "https://github.com/ccontrols/component-controls/issues",
},
"version": "2.2.4",
"version": "2.3.0",
},
},
"stories": Object {},
Expand Down
Loading

0 comments on commit 8aee3b4

Please sign in to comment.