aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-tools-pages/ts/components/ContentBlock.tsx
blob: 56d52a150ab2c28f8f66f02ba977924314745c47 (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
import * as React from 'react';
import styled from 'styled-components';

import { Beta } from './Typography';

const Base = styled.div`
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    &:not(:last-of-type) {
        margin-bottom: 6.25rem;
    }
`;

const Content = styled.div`
    width: 66.693548387%;
`;

const Item = styled.div`
    p {
        max-width: 31.25rem;
    }

    &:not(:last-of-type) {
        margin-bottom: 2.5rem;
    }
`;

interface ContentBlockProps {
    title: string;
    children: React.ReactNode;
}

function ContentBlock(props: ContentBlockProps) {
    const children = React.Children.map(props.children, child => {
        return <Item>{child}</Item>;
    });

    return (
        <Base>
            <Beta>{props.title}</Beta>
            <Content>{children}</Content>
        </Base>
    );
}

export default ContentBlock;