diff --git a/package.json b/package.json index c0173c5..33185de 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ }, "devDependencies": { "@diplodoc/babel-preset": "^1.0.2", - "@diplodoc/components": "^3.9.1", + "@diplodoc/components": "^4.0.0", "@diplodoc/eslint-config": "^2.0.0", "@diplodoc/openapi-extension": "^2.1.0", "@diplodoc/prettier-config": "^2.0.0", diff --git a/src/components/App/App.tsx b/src/components/App/App.tsx index b01521f..5bc8aeb 100644 --- a/src/components/App/App.tsx +++ b/src/components/App/App.tsx @@ -9,14 +9,17 @@ import { } from '@gravity-ui/page-constructor'; import {ThemeProvider} from '@gravity-ui/uikit'; import { - DocLeadingPage, + ConstructorPageData, DocLeadingPageData, - DocPage, DocPageData, + DocumentType, Lang, Router, Theme, + getPageByType, + getPageType } from '@diplodoc/components'; + import {HeaderControls} from '../HeaderControls'; import {getDirection, updateRootClassName} from '../../utils'; import {Layout} from '../Layout'; @@ -35,9 +38,10 @@ import './App.scss'; export interface AppProps { lang: Lang; router: Router; + type: DocumentType; } -export type DocInnerProps = { +export type DocInnerProps = { data: Data; } & AppProps; @@ -65,9 +69,9 @@ function Runtime(props: RuntimeProps) { ); } -function Page(props: DocInnerProps) { +export function Page(props: DocInnerProps) { const {data, ...pageProps} = props; - const Page = data.leading ? DocLeadingPage : DocPage; + const Page = getPageByType(props?.type); return ( @@ -111,6 +115,8 @@ export function App(props: DocInnerProps): ReactElement { const {theme, textSize, wideFormat, fullScreen, showMiniToc, onChangeFullScreen} = settings; const fullHeader = !fullScreen && Boolean(navigation); const headerHeight = fullHeader ? 64 : 0; + const type = getPageType(data); + const pageProps = { headerHeight, data, @@ -122,6 +128,7 @@ export function App(props: DocInnerProps): ReactElement { textSize, fullScreen, onChangeFullScreen, + type, }; const direction = getDirection(lang); @@ -169,7 +176,7 @@ export function App(props: DocInnerProps): ReactElement { ), }, }} - content={{ + content={type === DocumentType.ConstructorPage && 'data' in data && 'fullScreen' in data.data && data.data.fullScreen ? data.data : { blocks: [ { type: 'page', diff --git a/src/styles/overrides.scss b/src/styles/overrides.scss index 282d142..8837b0a 100644 --- a/src/styles/overrides.scss +++ b/src/styles/overrides.scss @@ -8,6 +8,13 @@ margin-top: var(--pc-first-block-indent, 96px); } +.pc-Grid .pc-Grid { + .container-fluid .pc-header-block__container-fluid { + padding-right: 40px; + padding-left: 40px; + } +} + .pc-block-base { padding: 0 !important; } diff --git a/tsconfig.json b/tsconfig.json index 094f1f3..646eb8d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "target": "es2020", "moduleResolution": "node", + "resolveJsonModule": true, "lib": ["DOM"], "declaration": true, "outDir": "build",