blob: 2c153788a1905115bef19be6005ed9244ce2ec72 (
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
|
import { History } from 'history';
import * as React from 'react';
import { withRouter } from 'react-router-dom';
import styled from 'styled-components';
import { colors } from 'ts/style/colors';
interface ButtonInterface {
color?: string;
children?: Node | string;
isTransparent?: boolean;
isNoBorder?: boolean;
isNoPadding?: boolean;
hasIcon?: boolean | string;
isInline?: boolean;
href?: string;
onClick?: () => any;
history?: History;
theme?: {
textColor: string;
};
}
export const Button = styled.button<ButtonInterface>`
appearance: none;
border: 1px solid transparent;
display: ${props => props.isInline && 'inline-block'};
background-color: ${props => !props.isTransparent ? colors.brandLight : 'transparent'};
border-color: ${props => (props.isTransparent && !props.isNoBorder) && '#6a6a6a'};
color: ${props => props.color || props.theme.textColor};
padding: ${props => !props.isNoPadding && '14px 22px'};
text-align: center;
font-size: 18px;
text-decoration: none;
`;
export const Link = withRouter((props: ButtonInterface) => {
const {
children,
history,
href,
} = props;
const Component = Button.withComponent('a');
const handleClick = () => history.push(href);
return (
<Component onClick={handleClick} {...props}>
{children}
</Component>
);
});
// Added this, & + & doesnt really work since we switch with element types...
export const ButtonWrap = styled.div`
button + button,
a + a,
a + button,
button + a {
margin-left: 10px;
}
`;
|