From a7d283ce06107173750c39a8f662beee15c5b5e7 Mon Sep 17 00:00:00 2001 From: Arctic Ice Studio Date: Thu, 6 Dec 2018 11:10:55 +0100 Subject: [PATCH] Implement core layout component `BaseLayout` This is the default layout of Nord Docs that consists of the `Root` core container (1) as root element and the core components representing the header (2), the main page container (3) and the footer. References: (1) https://github.com/arcticicestudio/nord-docs/issues/36 (2) https://github.com/arcticicestudio/nord-docs/issues/64 (3) https://github.com/arcticicestudio/nord-docs/issues/65 Associated epic: GH-63 Depends on GH-65 Relates to: GH-36, GH-64 GH-66 --- .../layouts/core/BaseLayout/BaseLayout.jsx | 33 +++++++++++++++++++ .../layouts/core/BaseLayout/index.js | 1 + .../core/BaseLayout/BaseLayout.test.jsx | 22 +++++++++++++ .../__snapshots__/BaseLayout.test.jsx.snap | 9 +++++ 4 files changed, 65 insertions(+) create mode 100644 src/components/layouts/core/BaseLayout/BaseLayout.jsx create mode 100644 src/components/layouts/core/BaseLayout/index.js create mode 100644 test/components/layouts/core/BaseLayout/BaseLayout.test.jsx create mode 100644 test/components/layouts/core/BaseLayout/__snapshots__/BaseLayout.test.jsx.snap diff --git a/src/components/layouts/core/BaseLayout/BaseLayout.jsx b/src/components/layouts/core/BaseLayout/BaseLayout.jsx new file mode 100644 index 00000000..46e753d4 --- /dev/null +++ b/src/components/layouts/core/BaseLayout/BaseLayout.jsx @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2018-present Arctic Ice Studio + * Copyright (C) 2018-present Sven Greb + * + * Project: Nord Docs + * Repository: https://github.com/arcticicestudio/nord-docs + * License: MIT + */ + +import React, { Fragment } from "react"; +import PropTypes from "prop-types"; + +import Page from "containers/core/Page"; +import Root from "containers/core/Root"; + +/** + * The base page layout providing the main container that wraps the content. + * + * @since 0.3.0 + */ +const BaseLayout = ({ children }) => ( + + + {children} + + +); + +BaseLayout.propTypes = { + children: PropTypes.node.isRequired +}; + +export default BaseLayout; diff --git a/src/components/layouts/core/BaseLayout/index.js b/src/components/layouts/core/BaseLayout/index.js new file mode 100644 index 00000000..cd391add --- /dev/null +++ b/src/components/layouts/core/BaseLayout/index.js @@ -0,0 +1 @@ +export { default } from "./BaseLayout"; diff --git a/test/components/layouts/core/BaseLayout/BaseLayout.test.jsx b/test/components/layouts/core/BaseLayout/BaseLayout.test.jsx new file mode 100644 index 00000000..0632f6be --- /dev/null +++ b/test/components/layouts/core/BaseLayout/BaseLayout.test.jsx @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2018-present Arctic Ice Studio + * Copyright (C) 2018-present Sven Greb + * + * Project: Nord Docs + * Repository: https://github.com/arcticicestudio/nord-docs + * License: MIT + */ + +import React, { Fragment } from "react"; +import { render } from "react-testing-library"; + +import BaseLayout from "layouts/core/BaseLayout"; + +test("snapshot", () => { + const { container } = render( + + + + ); + expect(container).toMatchSnapshot(); +}); diff --git a/test/components/layouts/core/BaseLayout/__snapshots__/BaseLayout.test.jsx.snap b/test/components/layouts/core/BaseLayout/__snapshots__/BaseLayout.test.jsx.snap new file mode 100644 index 00000000..3a2e181c --- /dev/null +++ b/test/components/layouts/core/BaseLayout/__snapshots__/BaseLayout.test.jsx.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`snapshot 1`] = ` +
+
+
+`;