2018-12-10 09:05:59 -08:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import styled from 'styled-components';
|
2019-01-24 11:24:10 -08:00
|
|
|
import type { Node, ElementProps } from 'react';
|
2018-12-10 09:05:59 -08:00
|
|
|
|
2019-02-08 21:01:05 -08:00
|
|
|
type FlexProps = PropsWithTheme<{
|
|
|
|
alignItems: string,
|
|
|
|
justifyContent: string,
|
|
|
|
}>;
|
2018-12-10 09:05:59 -08:00
|
|
|
const Flex = styled.div`
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
2019-02-08 21:01:05 -08:00
|
|
|
align-items: ${(props: FlexProps) => String(props.alignItems)};
|
|
|
|
justify-content: ${(props: FlexProps) => String(props.justifyContent)};
|
2018-12-10 09:05:59 -08:00
|
|
|
`;
|
|
|
|
|
|
|
|
type Props = {
|
2019-01-24 11:24:10 -08:00
|
|
|
...ElementProps<'div'>,
|
2018-12-10 09:05:59 -08:00
|
|
|
alignItems?: string,
|
|
|
|
justifyContent?: string,
|
2018-12-12 13:14:12 -08:00
|
|
|
className?: string,
|
2018-12-10 09:05:59 -08:00
|
|
|
children: Node,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const RowComponent = ({ children, ...props }: Props) => (
|
2019-02-06 19:06:48 -08:00
|
|
|
<Flex {...props}>{React.Children.map(children, (ch: Node) => ch)}</Flex>
|
2018-12-10 09:05:59 -08:00
|
|
|
);
|
|
|
|
|
|
|
|
RowComponent.defaultProps = {
|
|
|
|
alignItems: 'flex-start',
|
|
|
|
justifyContent: 'flex-start',
|
2018-12-12 13:14:12 -08:00
|
|
|
className: '',
|
2018-12-10 09:05:59 -08:00
|
|
|
};
|