Skip to content

Commit

Permalink
Merge pull request #2 from ViktorSvertoka/components-button
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorSvertoka authored Sep 15, 2023
2 parents 640be39 + 310656b commit 77e116a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/components/Button/Button.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import PropTypes from 'prop-types';
import { Btn } from "./Button.styled"

function Button({ text, onClick, background, color, border, hoverBackground, hoverColor }) {
return (
<Btn onClick={onClick} style={{ background, color, border }} hoverBackground={hoverBackground} hoverColor={hoverColor}>
{text}
</Btn>
);
}

Button.propTypes = {
text: PropTypes.string.isRequired,
onClick: PropTypes.func.isRequired,
background: PropTypes.string,
color: PropTypes.string,
border: PropTypes.string,
hoverBackground: PropTypes.string,
hoverColor: PropTypes.string,
}

export default Button;



16 changes: 16 additions & 0 deletions src/components/Button/Button.styled.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import styled from 'styled-components';

export const Btn = styled.button`
background: ${(props) => props.background};
color: ${(props) => props.color};
border: ${(props) => props.border};
padding: 16px 60px;
justify-content: center;
align-items: center;
border-radius: 12px;
&:hover {
background: ${(props) => props.hoverBackground};
color: ${(props) => props.hoverColor};
}
`;

0 comments on commit 77e116a

Please sign in to comment.