simplified CenteredContent and fixed alignment issues

This commit is contained in:
Jori Lallo
2017-07-04 12:22:23 -05:00
parent 920aee223b
commit 53e4a94c07

View File

@ -4,8 +4,6 @@ import styled from 'styled-components';
type Props = { type Props = {
children?: React.Element<any>, children?: React.Element<any>,
style?: Object,
maxWidth?: string,
}; };
const Container = styled.div` const Container = styled.div`
@ -13,20 +11,17 @@ const Container = styled.div`
margin: 40px 20px; margin: 40px 20px;
`; `;
const CenteredContent = ({ const Content = styled.div`
children, max-width: 740px;
maxWidth = '740px', margin: 0 auto;
style, `;
...rest
}: Props) => {
const styles = {
maxWidth,
...style,
};
const CenteredContent = ({ children, ...rest }: Props) => {
return ( return (
<Container style={styles} {...rest}> <Container {...rest}>
<Content>
{children} {children}
</Content>
</Container> </Container>
); );
}; };