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

import { colors, media } from 'ts/variables';

import { Breakout } from './Breakout';
import { Container } from './Container';
import { Alpha, Lead } from './Typography';

const Main = styled.div`
    background-color: ${colors.lightGray};
    padding: 6.25rem;
    display: flex;
    justify-content: space-between;

    ${media.large`
        padding: 2.5rem;
    `};
    ${media.medium`
        display: block;
    `};
`;

const Title = styled(Alpha)`
    margin-bottom: 2.5rem;

    ${media.medium`margin-bottom: 2.25rem;`};
`;

const StyledIntroLead = styled(Lead)`
    max-width: 25.9375rem;
    margin-right: 2rem;
    ${media.medium`
        max-width: 100%;
        margin-bottom: 1.5625rem;
    `};
`;

const StyledIntroAside = styled.div`
    max-width: 32.5rem;
    position: relative;
    ${media.medium`
        max-width: 100%;
    `};
`;

interface IntroProps {
    children?: React.ReactNode;
}

interface IntroLeadProps {
    title: string;
    children?: React.ReactNode;
}

const IntroLead: React.StatelessComponent<IntroLeadProps> = props => (
    <StyledIntroLead as="div">
        <Title>{props.title}</Title>
        {props.children}
    </StyledIntroLead>
);

const IntroAside: React.StatelessComponent<IntroProps> = props => (
    <Breakout>
        <StyledIntroAside>{props.children}</StyledIntroAside>
    </Breakout>
);

const Intro: React.StatelessComponent<IntroProps> = props => (
    <Container wide={true}>
        <Main>{props.children}</Main>
    </Container>
);

export { IntroLead, IntroAside, Intro };