aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/@next/components/button.tsx
blob: df784b8efe44cb126df6bdcdea60a26080c06596 (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
import * as React from 'react';
import styled from 'styled-components';

import { colors } from 'ts/style/colors';

export interface Props extends ButtonInterface {
    text: string;
    transparent?: boolean;
    inline?: boolean;
}

const StyledButton = styled.button<Props>`
    appearance: none;
    border: 0;
    background-color: ${colors.brandLight};
    color: ${colors.white};
    text-align: center;
    padding: 13px 22px 14px;

    ${props => props.transparent && `
        background-color: transparent;
        border: 1px solid #6A6A6A;
    `}

    ${props => props.inline && `
        display: inline-block;
        & + & {
            margin-left: 10px;
        }
    `}
`;

const Text = styled.span`
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.375rem;
`;

export const Button: React.StatelessComponent<Props> = ({ ...props }) => (
    <StyledButton {...props}>
        <Text>{props.text}</Text>
    </StyledButton>
);

export const ButtonTransparent: React.StatelessComponent<Props> = ({ ...props }) => (
    <StyledButton transparent={true} {...props}>
        <Text>{props.text}</Text>
    </StyledButton>
);

Button.defaultProps = {
    transparent: false,
};