Last active
March 30, 2019 17:48
-
-
Save johnnyBira/d04b3a7c32effd2c4e18b6b9d3c22f9e to your computer and use it in GitHub Desktop.
Medium #1 - Grid Example 5
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
import React from 'react' | |
// Import ThemeProvider from Styled Components | |
import { ThemeProvider } from 'styled-components' | |
// The components we created in the previous step | |
import { Row, Column } from './Grid' | |
// Create a theme | |
const theme = { | |
// Responsove Props config object | |
responsiveProps: { | |
breakpoints: { | |
xxs: 0, | |
xs: 320, | |
s: 576, | |
m: 768, | |
l: 992, | |
xl: 1200 | |
} | |
} | |
} | |
//Pass the theme to Styled Components ThemeProvider | |
// All components enhanced with Responsive Props that are wrapped inside this provider can now target the media queries from the config above | |
const Example = () => ( | |
<ThemeProvider theme={theme}> | |
<Row> | |
<Column span={{ s: 6, l: 3, xl: 2 }} order={{ l: 2 }} /> | |
<Column span={{ s: 6, l: 3, xl: 2 }} order={{ l: 1 }} /> | |
<Column span={{ s: 6 }} hidden={{ l: true }} /> | |
<Column span={{ s: 6 }} hidden={{ l: true }} /> | |
</Row> | |
<ThemeProvider theme={theme}> | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment