Skip to content

Instantly share code, notes, and snippets.

@mike-at-redspace
Last active December 14, 2022 12:41
Show Gist options
  • Save mike-at-redspace/5a12db0155df7056998bae93ec79c99e to your computer and use it in GitHub Desktop.
Save mike-at-redspace/5a12db0155df7056998bae93ec79c99e to your computer and use it in GitHub Desktop.
React Emotion Page
import React from 'react';
import styled from '@emotion/styled';
const FlexboxWrapper = styled.div`
display: flex;
flex-direction: ${props => props.direction || 'row'};
align-items: ${props => props.alignItems || 'stretch'};
justify-content: ${props => props.justifyContent || 'flex-start'};
`;
const FlexItem = styled.div`
flex: ${props => props.flex};
align-self: ${props => props.alignSelf};
order: ${props => props.order};
flex-basis: ${props => props.flexBasis};
flex-grow: ${props => props.flexGrow};
flex-shrink: ${props => props.flexShrink};
`;
const Page = () => (
<FlexboxWrapper direction="column" justifyContent="space-between" alignItems="stretch">
<Header flex="0 0 80px">
<FlexboxWrapper alignItems="center">
<FlexItem alignSelf="center">Home</FlexItem>
<FlexItem alignSelf="center">About</FlexItem>
<FlexItem alignSelf="center">Contact</FlexItem>
</FlexboxWrapper>
</Header>
<Sidebar flex="0 0 200px">Sidebar</Sidebar>
<MainContent flexGrow={1}>
Main Content
<Marketing flex="0 0 200px">Marketing Lorem Ipsum</Marketing>
</MainContent>
<Footer flex="0 0 80px">
<p>Copyright 2022. All rights reserved.</p>
</Footer>
</FlexboxWrapper>
);
export default Page;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment