-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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) #36 (2) #64 (3) #65 Associated epic: GH-63 Depends on GH-65 Relates to: GH-36, GH-64 GH-66
- Loading branch information
1 parent
701ec43
commit a7d283c
Showing
4 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "./BaseLayout"; |
22 changes: 22 additions & 0 deletions
22
test/components/layouts/core/BaseLayout/BaseLayout.test.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); |
9 changes: 9 additions & 0 deletions
9
test/components/layouts/core/BaseLayout/__snapshots__/BaseLayout.test.jsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
`; |