Last active
October 29, 2019 12:25
-
-
Save tfiechowski/4a43c4242d28ae55cb3a38ba0f84ab40 to your computer and use it in GitHub Desktop.
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 styled from "styled-components"; | |
export const Grid = styled.div` | |
width: 600px; | |
display: flex; | |
justify-content: start; | |
flex-wrap: wrap; | |
`; | |
export const GridImage = styled.div` | |
flex-grow: 1; | |
border: 1px solid white; | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
background-image: ${props => `url("${props.src}")`}; | |
background-size: cover; | |
background-position: 50%; | |
`; | |
const GridItemWrapper = styled.div` | |
flex: 0 0 33.3%; | |
display: flex; | |
justify-content: center; | |
align-items: stretch; | |
box-sizing: border-box; | |
:before { | |
content: ""; | |
display: table; | |
padding-top: 100%; | |
} | |
`; | |
export const GridItem = ({ forwardedRef, ...props }) => ( | |
<GridItemWrapper ref={forwardedRef} {...props} /> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment