Skip to content

Core Layout Component: BaseLayout #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
`;