-
Notifications
You must be signed in to change notification settings - Fork 20
/
Button.tsx
58 lines (55 loc) · 1.29 KB
/
Button.tsx
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
import React from "react";
import styled from "styled-components";
import { ButtonProps } from "./Button.types";
const StyledButton = styled.button<ButtonProps>`
border: 0;
line-height: 1;
font-size: 15px;
cursor: pointer;
font-weight: 700;
font-weight: bold;
border-radius: 3px;
display: inline-block;
padding: ${(props) =>
props.size === "small"
? "7px 25px 8px"
: props.size === "medium"
? "9px 30px 11px"
: "14px 30px 16px"};
color: ${(props) => (props.primary ? "#1b116e" : "#ffffff")};
background-color: ${(props) => (props.primary ? "#6bedb5" : "#1b116e")};
opacity: ${(props) => (props.disabled ? 0.5 : 1)};
&:hover {
background-color: ${(props) => (props.primary ? "#55bd90" : "#6bedb5")};
}
&:active {
border: solid 2px #1b116e;
padding: ${(props) =>
props.size === "small"
? "5px 23px 6px"
: props.size === "medium"
? "7px 28px 9px"
: "12px 28px 14px"};
}
`;
const Button: React.FC<ButtonProps> = ({
size,
primary,
disabled,
text,
onClick,
...props
}) => {
return (
<StyledButton
type="button"
onClick={onClick}
primary={primary}
disabled={disabled}
size={size}
{...props}>
{text}
</StyledButton>
);
};
export default Button;