Bachelorthesis_Code/frontend/src/components/Button.jsx
cami 85e484bf0b
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
Renaming and autoformatting
- renamed the react files to jsx
- autoformat with vscode
2021-07-22 20:18:01 +02:00

34 lines
724 B
JavaScript

import React from "react";
import "./Button.css";
import { Link } from "react-router-dom";
const STYLES = ["btn--primary", "btn--outline"];
const SIZES = ["btn--medium", "btn--large", "btn--full"];
export const Button = ({
children,
type,
onClick,
buttonStyle,
buttonSize,
newTo,
}) => {
const checkButtonStyle = STYLES.includes(buttonStyle)
? buttonStyle
: STYLES[0];
const checkButtonSize = SIZES.includes(buttonSize) ? buttonSize : SIZES[0];
return (
<Link to={newTo || "/"} className="btn-mobile">
<button
className={`btn ${checkButtonStyle} ${checkButtonSize}`}
onClick={onClick}
type={type}
>
{children}
</button>
</Link>
);
};