diff --git a/core/core/src/configuration.ts b/core/core/src/configuration.ts index f5630ef07..329e1148b 100644 --- a/core/core/src/configuration.ts +++ b/core/core/src/configuration.ts @@ -29,6 +29,11 @@ export interface PageConfiguration { * whether to add to the top navigation menu */ topMenu?: boolean; + + /** + * page container react component + */ + container?: ComponentType | null; } export type PagesConfiguration = Record; @@ -129,11 +134,6 @@ export interface RunOnlyConfiguration { * story sorting function */ storySort?: (a: string, b: string) => number; - - /** - * page container react component - */ - container?: ComponentType; } export type RunConfiguration = RunOnlyConfiguration & @@ -165,6 +165,7 @@ export const defaultRunConfig: RunConfiguration = { }, page: { label: 'Page', + container: null, }, tags: { label: 'Tags', diff --git a/core/webpack-compile/src/utilities.ts b/core/webpack-compile/src/utilities.ts index e20832e66..7b5f2bc10 100644 --- a/core/webpack-compile/src/utilities.ts +++ b/core/webpack-compile/src/utilities.ts @@ -68,6 +68,7 @@ const createConfig = (options: CompileRunProps): webpack.Configuration => { ), 'broadcast-channel': require.resolve('broadcast-channel'), 'theme-ui': require.resolve('theme-ui'), + 'axe-core': require.resolve('axe-core'), '@theme-ui/presets': require.resolve('@theme-ui/presets'), '@theme-ui/core': require.resolve('@theme-ui/core'), '@theme-ui/css': require.resolve('@theme-ui/css'), @@ -75,6 +76,7 @@ const createConfig = (options: CompileRunProps): webpack.Configuration => { 'prism-react-renderer': require.resolve('prism-react-renderer'), 'react-helmet': require.resolve('react-helmet'), 'react-table': require.resolve('react-table'), + 'react-color': require.resolve('react-color/lib'), 'react-tabs': require.resolve('react-tabs'), 'react-switch': require.resolve('react-switch'), 'react-popper': require.resolve('react-popper'), @@ -114,6 +116,7 @@ const createConfig = (options: CompileRunProps): webpack.Configuration => { '@theme-ui/presets': '@theme-ui/presets', '@theme-ui/core': '@theme-ui/core', '@theme-ui/css': '@theme-ui/css', + 'axe-core': 'axe-core', polished: 'polished', lodash: 'lodash', 'broadcast-channel': 'broadcast-channel', @@ -121,6 +124,7 @@ const createConfig = (options: CompileRunProps): webpack.Configuration => { 'prism-react-renderer': 'prism-react-renderer', 'react-helmet': 'react-helmet', 'react-table': 'react-table', + 'react-color/lib': 'react-color/lib', 'react-tabs': 'react-tabs', 'react-switch': 'react-switch', 'react-popper': 'react-popper', diff --git a/examples/gatsby/.config/buildtime.js b/examples/gatsby/.config/buildtime.js index 3aa623ff1..f7e6e25a7 100644 --- a/examples/gatsby/.config/buildtime.js +++ b/examples/gatsby/.config/buildtime.js @@ -9,6 +9,11 @@ module.exports = { '../src/stories/*.stories.(js|jsx|tsx|mdx)', '../../../ui/app/src/**/*.stories.(js|jsx|tsx|mdx)', '../../../ui/components/src/**/*.stories.(js|jsx|tsx|mdx)', + + //'../../../ui/blocks/src/**/*.stories.(js|jsx|tsx|mdx)', + //'../../../core/core/src/stories/**/*.stories.(js|jsx|tsx|mdx)', + //'../../../ui/editors/src/**/*.stories.(js|jsx|tsx|mdx)', + //'../../../plugins/axe-plugin/src/stories/**/*.stories.(js|jsx|tsx|mdx)', ], pages: { story: { diff --git a/ui/app/src/CategoryList/CategoryList.tsx b/ui/app/src/CategoryList/CategoryList.tsx index ae1637434..033d3ce11 100644 --- a/ui/app/src/CategoryList/CategoryList.tsx +++ b/ui/app/src/CategoryList/CategoryList.tsx @@ -22,7 +22,11 @@ export const CategoryList: FC = ({ type }) => { const categories = storeProvider?.getUniquesByCategory(type) || []; const pageConfig = storeProvider?.config?.pages?.[type] || {}; return ( - + {pageConfig.label}
    diff --git a/ui/app/src/CategoryPage/CategoryPage.tsx b/ui/app/src/CategoryPage/CategoryPage.tsx index 58b07b1f3..52c8965ef 100644 --- a/ui/app/src/CategoryPage/CategoryPage.tsx +++ b/ui/app/src/CategoryPage/CategoryPage.tsx @@ -19,7 +19,11 @@ export const CategoryPage: FC = ({ type, category }) => { const Page = customPage && customPage.type === type ? customPage.MDXPage : undefined; return ( - + {category} = ({ type = 'story', ...props }) => { if (hasNoSideBars || isFullPage) { return ( diff --git a/ui/app/src/PageContainer/PageContainer.tsx b/ui/app/src/PageContainer/PageContainer.tsx index 305aab063..0dd466466 100644 --- a/ui/app/src/PageContainer/PageContainer.tsx +++ b/ui/app/src/PageContainer/PageContainer.tsx @@ -2,15 +2,28 @@ import React, { FC, useContext, forwardRef } from 'react'; import { BlockContext, PageContainer as BlockPageContainer, - PageContainerProps, + PageContainerProps as BlockPageContainerProps, } from '@component-controls/blocks'; +import { PageType } from '@component-controls/core'; + import { Container as DefaultContainer } from '../Container'; -export const PageContainer: FC> = forwardRef((props, ref: React.Ref) => { - const { storeProvider } = useContext(BlockContext); - const { container = DefaultContainer } = storeProvider.config || {}; - return ; -}); +export type PageContainerProps = { + /** + * page type + */ + type: PageType; +} & Omit; + +/** + * page container to enhance the inner page wrapper + */ +export const PageContainer: FC = forwardRef( + ({ type, ...props }, ref: React.Ref) => { + const { storeProvider } = useContext(BlockContext); + const { pages } = storeProvider.config || {}; + const page = pages ? pages[type] : undefined; + const { container = DefaultContainer } = page || {}; + return ; + }, +); diff --git a/ui/app/src/PageList/PageList.tsx b/ui/app/src/PageList/PageList.tsx index 161c1e20d..f4008ddca 100644 --- a/ui/app/src/PageList/PageList.tsx +++ b/ui/app/src/PageList/PageList.tsx @@ -19,7 +19,7 @@ export const PageList: FC = ({ type }) => { const pages = storeProvider?.getPageList(type) || []; const pageConfig = storeProvider?.config?.pages?.[type] || {}; return ( - + {pageConfig.label} diff --git a/ui/app/src/SidebarsPage/SidebarsMDXPage.tsx b/ui/app/src/SidebarsPage/SidebarsMDXPage.tsx index 112520c10..f993dfb10 100644 --- a/ui/app/src/SidebarsPage/SidebarsMDXPage.tsx +++ b/ui/app/src/SidebarsPage/SidebarsMDXPage.tsx @@ -20,7 +20,7 @@ export const SidebarsMDXPage: FC = ({ type }) => { - + ); diff --git a/ui/app/src/SidebarsPage/SidebarsStoryPage.tsx b/ui/app/src/SidebarsPage/SidebarsStoryPage.tsx index 386d5b13b..cb3f9854d 100644 --- a/ui/app/src/SidebarsPage/SidebarsStoryPage.tsx +++ b/ui/app/src/SidebarsPage/SidebarsStoryPage.tsx @@ -76,7 +76,11 @@ export const SidebarsStoryPage: FC = ({ pagesFn, type }) => { )} - + {pages && pages.map(page => ( {page.render()} diff --git a/ui/blocks/src/PageContainer/PageContainer.tsx b/ui/blocks/src/PageContainer/PageContainer.tsx index 76a5abd34..21d9f8434 100644 --- a/ui/blocks/src/PageContainer/PageContainer.tsx +++ b/ui/blocks/src/PageContainer/PageContainer.tsx @@ -20,7 +20,7 @@ export interface PageContainerOwnProps { /** * inner wrapper container */ - wrapper?: ComponentType; + wrapper?: ComponentType | null; } export type PageContainerProps = PageContainerOwnProps & diff --git a/ui/components/src/ThemeContext/theme.ts b/ui/components/src/ThemeContext/theme.ts index 66a9ae799..11432858c 100644 --- a/ui/components/src/ThemeContext/theme.ts +++ b/ui/components/src/ThemeContext/theme.ts @@ -602,6 +602,9 @@ export const theme: Theme = { list: {}, item: { my: 2 }, }, + pagelist: { + container: { maxWidth: '1000px' }, + }, categorypage: { pagecontainer: { maxWidth: '1000px' }, titlecontainer: {