Created
May 1, 2018 23:26
-
-
Save ruohki/17756a1e718f3b501decba2d03a1ab4e 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
// Simple Flexbox Layout for Styled Components | |
import React from "react"; | |
import styled from "styled-components"; | |
const ColorContainer = styled.div` | |
background-color: ${({ bg }) => (bg ? bg : "inherit")}; | |
`; | |
export const Main = styled(ColorContainer)` | |
width: 100vw; | |
height: 100vh; | |
`; | |
export const Split = styled(ColorContainer)` | |
display: flex; | |
height: 100%; | |
width: 100%; | |
justify-content: ${({ justify }) => (justify ? justify : "flex-start")}; | |
flex-direction: ${({ direction }) => (direction ? direction : "row")}; | |
align-items: ${({ items }) => (items ? items : "stretch")}; | |
align-content: ${({ content }) => (content ? content : "flex-start")}; | |
`; | |
export const Child = styled(ColorContainer)` | |
box-sizing: border-box; | |
flex-grow: ${({ fill }) => (fill ? "1" : "0")}; | |
align-self: ${({ self }) => (self ? self : "stretch")}; | |
flex-basis: ${({ basis }) => (basis ? basis : "content")}; | |
padding: ${({ padding }) => (padding ? padding : "inherit")}; | |
`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment