From db485056e0b61596f3df7ece03e19035d82b23f5 Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Sun, 23 Feb 2020 02:31:05 +0300 Subject: [PATCH] added optional breadcrumbs; page layout refactoring; other chages --- pages/[...slug].tsx | 12 +++++++- src/components/App/Header.tsx | 22 -------------- src/components/App/index.tsx | 42 +++++++++++++++++---------- src/components/Breadcrumbs/index.tsx | 31 ++++++++++++++++++++ src/components/Breadcrumbs/styles.css | 7 +++++ src/components/Button/index.tsx | 11 +++++-- src/components/Button/styles.css | 28 ++++++++++++++---- src/components/Content/index.tsx | 23 +++++++++++++++ src/components/Page/index.tsx | 1 - src/components/Wrapper/index.tsx | 15 +++------- src/style.css | 4 +-- src/types.ts | 7 +++-- 12 files changed, 140 insertions(+), 63 deletions(-) delete mode 100644 src/components/App/Header.tsx create mode 100644 src/components/Breadcrumbs/index.tsx create mode 100644 src/components/Breadcrumbs/styles.css create mode 100644 src/components/Content/index.tsx diff --git a/pages/[...slug].tsx b/pages/[...slug].tsx index 5b59f97c..8a59c1ad 100644 --- a/pages/[...slug].tsx +++ b/pages/[...slug].tsx @@ -5,6 +5,8 @@ import { Page } from 'src/components/Page' import { Meta } from 'src/components/Meta' import { meta } from 'src/lib/meta' import { createApiUrl, requestGet, wrapInitialProps, IResponseItems } from 'src/next-lib' +import { NextPage } from 'next' +import { IBreadcumbsPart, IMeta } from 'src/types' function array(value: T | T[]) { return Array.isArray(value) @@ -12,12 +14,20 @@ function array(value: T | T[]) { : [value] } -const Index = props => ( +type Props = { + title: string + content: string + breadcrumbs: IBreadcumbsPart[] + meta: IMeta +} + +const Index: NextPage = props => ( {props.title} diff --git a/src/components/App/Header.tsx b/src/components/App/Header.tsx deleted file mode 100644 index db9ce493..00000000 --- a/src/components/App/Header.tsx +++ /dev/null @@ -1,22 +0,0 @@ -export const Header: React.FC = props => ( -
- - -
-
- {props.children} -
-
-
-) diff --git a/src/components/App/index.tsx b/src/components/App/index.tsx index 4fc789ff..77d26707 100644 --- a/src/components/App/index.tsx +++ b/src/components/App/index.tsx @@ -1,12 +1,13 @@ import dynamic from 'next/dynamic' -import cx from 'classnames' import Comments from '../Comments' -import { useReducedMotion } from 'src/hooks/useReducedMotion' import { Wrapper } from '../Wrapper' -import { Header } from './Header' import { ConfigContext } from 'src/context/ConfigContext' import config from 'src/config' import { Footer } from '../Footer' +import { Content } from '../Content' +import { Block } from '../Block' +import { Breadcrumbs } from '../Breadcrumbs' +import { IBreadcumbsPart } from 'src/types' const Navigation = dynamic(() => import('../Navigation').then(mod => mod.Navigation), { ssr: false, @@ -16,18 +17,31 @@ export interface IAppProps { showAuthor: boolean wide?: boolean contentStyle?: React.CSSProperties + breadcrumbs?: IBreadcumbsPart[] } -export const App: React.FC = ({ wide = false, ...props }) => { - const motionDisabled = useReducedMotion() +export const App: React.FC = props => { + const wide = props.wide ?? false + const blockStyle = { + alignItems: 'center' + } return ( +
-
+ {!props.breadcrumbs ? null : ( + + + + + + )} + )} footer={(