Skip to content

Commit

Permalink
Implement core layout component BaseLayout
Browse files Browse the repository at this point in the history
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) #36
  (2) #64
  (3) #65

Associated epic: GH-63
Depends on GH-65
Relates to: GH-36, GH-64
GH-66
  • Loading branch information
arcticicestudio committed Dec 6, 2018
1 parent 701ec43 commit a7d283c
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/components/layouts/core/BaseLayout/BaseLayout.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
* Copyright (C) 2018-present Sven Greb <[email protected]>
*
* 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 }) => (
<Root>
<Fragment>
<Page>{children}</Page>
</Fragment>
</Root>
);

BaseLayout.propTypes = {
children: PropTypes.node.isRequired
};

export default BaseLayout;
1 change: 1 addition & 0 deletions src/components/layouts/core/BaseLayout/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./BaseLayout";
22 changes: 22 additions & 0 deletions test/components/layouts/core/BaseLayout/BaseLayout.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
* Copyright (C) 2018-present Sven Greb <[email protected]>
*
* 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(
<BaseLayout>
<Fragment />
</BaseLayout>
);
expect(container).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`snapshot 1`] = `
<div>
<main
class="sc-bdVaJa eYFyfX"
/>
</div>
`;

0 comments on commit a7d283c

Please sign in to comment.