Skip to content

Instantly share code, notes, and snippets.

@kettanaito
Last active June 18, 2018 11:39
Show Gist options
  • Select an option

  • Save kettanaito/c194449a3889deefe1f168034a8a8c25 to your computer and use it in GitHub Desktop.

Select an option

Save kettanaito/c194449a3889deefe1f168034a8a8c25 to your computer and use it in GitHub Desktop.
Atomic layout - Nested composition
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