Skip to content

Commit 208c9ac

Browse files
Merge pull request #68 from arcticicestudio/feature/gh-66-core-layout-component-baselayout
Core Layout Component: BaseLayout
2 parents 701ec43 + ab29461 commit 208c9ac

File tree

6 files changed

+75
-4
lines changed

6 files changed

+75
-4
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
3+
* Copyright (C) 2018-present Sven Greb <[email protected]>
4+
*
5+
* Project: Nord Docs
6+
* Repository: https://github.com/arcticicestudio/nord-docs
7+
* License: MIT
8+
*/
9+
10+
import React, { Fragment } from "react";
11+
import PropTypes from "prop-types";
12+
13+
import Page from "containers/core/Page";
14+
import Root from "containers/core/Root";
15+
16+
/**
17+
* The base page layout providing the main container that wraps the content.
18+
*
19+
* @since 0.3.0
20+
*/
21+
const BaseLayout = ({ children }) => (
22+
<Root>
23+
<Fragment>
24+
<Page>{children}</Page>
25+
</Fragment>
26+
</Root>
27+
);
28+
29+
BaseLayout.propTypes = {
30+
children: PropTypes.node.isRequired
31+
};
32+
33+
export default BaseLayout;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from "./BaseLayout";

src/pages/index.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99
import React, { Fragment } from "react";
1010

11-
import Root from "containers/core/Root";
11+
import BaseLayout from "layouts/core/BaseLayout";
1212

1313
/**
1414
* The landing page component representing the root/index of the site.
@@ -18,9 +18,9 @@ import Root from "containers/core/Root";
1818
* @since 0.1.0
1919
*/
2020
const Landing = () => (
21-
<Root>
21+
<BaseLayout>
2222
<Fragment />
23-
</Root>
23+
</BaseLayout>
2424
);
2525

2626
export default Landing;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
3+
* Copyright (C) 2018-present Sven Greb <[email protected]>
4+
*
5+
* Project: Nord Docs
6+
* Repository: https://github.com/arcticicestudio/nord-docs
7+
* License: MIT
8+
*/
9+
10+
import React, { Fragment } from "react";
11+
import { render } from "react-testing-library";
12+
13+
import BaseLayout from "layouts/core/BaseLayout";
14+
15+
test("snapshot", () => {
16+
const { container } = render(
17+
<BaseLayout>
18+
<Fragment />
19+
</BaseLayout>
20+
);
21+
expect(container).toMatchSnapshot();
22+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`snapshot 1`] = `
4+
<div>
5+
<main
6+
class="sc-bdVaJa eYFyfX"
7+
/>
8+
</div>
9+
`;
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`snapshot 1`] = `<div />`;
3+
exports[`snapshot 1`] = `
4+
<div>
5+
<main
6+
class="sc-bdVaJa eYFyfX"
7+
/>
8+
</div>
9+
`;

0 commit comments

Comments
 (0)