Skip to content

Commit

Permalink
Merge pull request #68 from arcticicestudio/feature/gh-66-core-layout…
Browse files Browse the repository at this point in the history
…-component-baselayout

Core Layout Component: BaseLayout
  • Loading branch information
arcticicestudio authored Dec 6, 2018
2 parents 701ec43 + ab29461 commit 208c9ac
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 4 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";
6 changes: 3 additions & 3 deletions src/pages/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
import React, { Fragment } from "react";

import Root from "containers/core/Root";
import BaseLayout from "layouts/core/BaseLayout";

/**
* The landing page component representing the root/index of the site.
Expand All @@ -18,9 +18,9 @@ import Root from "containers/core/Root";
* @since 0.1.0
*/
const Landing = () => (
<Root>
<BaseLayout>
<Fragment />
</Root>
</BaseLayout>
);

export default Landing;
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>
`;
8 changes: 7 additions & 1 deletion test/pages/__snapshots__/index.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

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

0 comments on commit 208c9ac

Please sign in to comment.