Build declarative, responsive layouts in React using CSS Grid.
useResponsiveComponent()
function has been renamed to makeResponsive()
in order to prevent a confusion over that function being a React hook (which it's not).- import { withResponsiveComponent } from 'atomic-layout'
+ import { makeResponsive } from 'atomic-layout'
const Image = styled.img``
- export default withResponsiveComponent(Image)
+ export default makeResponsive(Image)
<Image src="small.png" srcMd="large.png" />
query()
utility function for shorthand composition of inline media queries aligned with your Layout options:import styled from 'styled-components'
import { query } from 'atomic-layout'
const Component = styled.div`
@media ${query({ from: 'md' })} {
background-color: red;
}
`
<MediaQuery/>
component (#309, #313). Please replace its usage in your code with the useMediaQuery
hook:- import { MediaQuery } from 'atomic-layout'
+ import { useMediaQuery } from 'atomic-layout'
const Usage = () => {
+ const matches = useMediaQuery({ minWidth: '500px' })
return (
- <MediaQuery minWidth="500px">
- {matches => matches && <p>Conditional content</p>}
- </MediaQuery>
+ {matches && <p>Conditional content</p>}
)
}
This is published as a minor release, since in case you have a wrongly typed responsive props (i.e.
templatelg
) they worked in the previous release, but will stop doing so in this one.
useResponsiveQuery
hook (docs)Only
to remount its children when the parent component has been updated (#308 , #310)order
CSS property on Box
component and area components generated by Composition
(#300)This release does not introduce new features, but changes the way Atomic Layout functions internally. It's recommended to update to
0.12.0
to test the changes and be ready for the upcoming features.
@atomic-layout/core
library and a single rendering implementation atomic-layout
(styled-components) for backward-compatibility