forked from zoltantothcom/Design-Patterns-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButton.jsx
More file actions
47 lines (39 loc) · 1.05 KB
/
Button.jsx
File metadata and controls
47 lines (39 loc) · 1.05 KB
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 React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
const StyledButton = styled.button`
background-color: ${props => props.theme.buttonBackground};
border: 1px solid ${props => props.theme.buttonBorder};
border-radius: 4px;
cursor: pointer;
font: 400 1rem 'Karla', 'sans-serif';
height: 48px;
max-width: 240px;
outline: none;
padding: 0 1.5rem;
width: 37.5%;
& span {
color: ${props => props.theme.buttonColor};
}
&:hover {
background-color: ${props => props.theme.buttonBackgroundHover};
border-color: ${props => props.theme.buttonBorderHover};
& span {
color: ${props => props.theme.buttonColorHover};
}
}
`;
export const Button = props => {
const { id, label, onClick } = props;
return (
<StyledButton id={id} onClick={onClick}>
{label && <span>{label}</span>}
</StyledButton>
);
};
Button.propTypes = {
label: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
onClick: PropTypes.func.isRequired
};
export default Button;