UNPKG

917 BJavaScriptView Raw
1import React from 'react'
2import styled from 'styled-components'
3import PropTypes from 'prop-types'
4import { FlexRow, FlexCol } from 'SRC'
5
6const BaseDuet = ({
7 children,
8 className,
9 constrained,
10 padding
11}) => {
12 return (
13 <FlexRow
14 padding={padding}
15 constrained={constrained}
16 className={className}>
17 {children.map((child, index) => {
18 return (
19 <FlexCol
20 key={index}
21 mobile={{width: 2}}
22 tablet={{width: 6}}
23 desktop={{width: 6}}>
24 {child}
25 </FlexCol>
26 )
27 })}
28 </FlexRow>
29 )
30}
31
32const Duet = styled(BaseDuet)`
33 ${FlexCol} {
34 margin-bottom: 2rem;
35 }
36`
37
38Duet.propTypes = {
39 children: PropTypes.array,
40 className: PropTypes.string,
41 constrained: PropTypes.bool,
42 padding: PropTypes.bool
43}
44
45Duet.defaultProps = {
46 constrained: false,
47 padding: false
48}
49
50export default Duet