blob: c54930902385f2cacbd2dc55d4c81ccea90964e6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
import * as React from 'react';
import styled from 'styled-components';
import { withContext, Props } from './withContext';
import { Beta, Alpha } from './Typography';
import { media } from 'ts/variables';
const Base = styled.div`
display: flex;
align-items: flex-start;
justify-content: space-between;
:not(:last-of-type) {
margin-bottom: 6.25rem;
}
${Beta} {
margin-bottom: 2.5rem;
}
${media.small`
display: block;
:not(:last-of-type) {
margin-bottom: 3.125rem;
}
`};
`;
const Content = styled.div`
width: 66.693548387%;
${media.small`
width: 100%;
`};
`;
const Item = styled.div`
p {
max-width: 31.25rem;
}
&:not(:last-of-type) {
margin-bottom: 2.5rem;
${media.small`
margin-bottom: 1.875rem;
`};
}
`;
const StyledTitle = styled(Alpha)`
color: ${props => props.color};
${media.small`
& + div {
margin-top: 1.5rem;
}
`};
`;
interface ContentBlockProps extends Props {
title: string;
main?: boolean;
children?: React.ReactNode;
}
function ContentBlock(props: ContentBlockProps) {
const children = React.Children.map(props.children, child => {
return <Item>{child}</Item>;
});
const Title = props.main ? StyledTitle : Beta;
return (
<Base>
<Title color={props.colors.type}>{props.title}</Title>
{children ? <Content>{children}</Content> : null}
</Base>
);
}
export default withContext(ContentBlock);
|