aboutsummaryrefslogblamecommitdiffstats
path: root/packages/website/ts/@next/components/button.tsx
blob: f695893730292b6c23025b486ce8b39214594d18 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11


                                       

                                         
 
                           



                            
                         

 





                                                                               
                                                    

                     


                                                                          
                           
                       

                          
  
import * as React from 'react';
import styled from 'styled-components';

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


interface ButtonInterface {
    children: Node | string;
    transparent?: any;
    inline?: any;
    href?: string,
    onClick?: () => void;
}

export const Button: React.StatelessComponent<ButtonInterface> = props => {
    const { onClick } = props;
    const Component = onClick ? StyledButton : StyledButton.withComponent('a');
    return <Component {...props}>{ props.children }</Component>;
};

const StyledButton = styled.button<ButtonInterface>`
    appearance: none;
    border: 0;
    display: ${props => props.inline && 'inline-block'};
    background-color: ${props => !props.transparent && colors.brandLight};
    border: ${props => props.transparent && '1px solid #6a6a6a'};
    color: ${colors.white};
    text-align: center;
    padding: 14px 22px;
    text-decoration: none;
`;