Last active
June 18, 2018 11:39
-
-
Save kettanaito/c194449a3889deefe1f168034a8a8c25 to your computer and use it in GitHub Desktop.
Atomic layout - Nested composition
This file contains hidden or 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
| import React from 'react' | |
| import { Composition } from 'atomic-layout' | |
| import SearchBar from './SearchBar' | |
| const templateMobile = ` | |
| 'logo' | |
| 'search' | |
| ` | |
| const Header = () => ( | |
| <Composition | |
| template={templateMobile} | |
| gutter={10}> | |
| {({ Logo, Search }) => ( | |
| <React.Fragment> | |
| <Logo> | |
| <img src="logo.png" /> | |
| </Logo> | |
| <Search> | |
| {/* Nested composition! */} | |
| <SearchBar /> | |
| </Search> | |
| </React.Fragment> | |
| )} | |
| </Composition> | |
| ) | |
| export default Header |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment