Skip to content

Commit 310656b

Browse files
Button component is created
1 parent b3b26b6 commit 310656b

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

src/components/Button/Button.jsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import PropTypes from 'prop-types';
2+
import { Btn } from "./Button.styled"
3+
4+
function Button({ text, onClick, background, color, border, hoverBackground, hoverColor }) {
5+
return (
6+
<Btn onClick={onClick} style={{ background, color, border }} hoverBackground={hoverBackground} hoverColor={hoverColor}>
7+
{text}
8+
</Btn>
9+
);
10+
}
11+
12+
Button.propTypes = {
13+
text: PropTypes.string.isRequired,
14+
onClick: PropTypes.func.isRequired,
15+
background: PropTypes.string,
16+
color: PropTypes.string,
17+
border: PropTypes.string,
18+
hoverBackground: PropTypes.string,
19+
hoverColor: PropTypes.string,
20+
}
21+
22+
export default Button;
23+
24+
25+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import styled from 'styled-components';
2+
3+
export const Btn = styled.button`
4+
background: ${(props) => props.background};
5+
color: ${(props) => props.color};
6+
border: ${(props) => props.border};
7+
padding: 16px 60px;
8+
justify-content: center;
9+
align-items: center;
10+
border-radius: 12px;
11+
12+
&:hover {
13+
background: ${(props) => props.hoverBackground};
14+
color: ${(props) => props.hoverColor};
15+
}
16+
`;

0 commit comments

Comments
 (0)