Bachelorthesis_Code/frontend/src/components/Button.js

34 lines
711 B
JavaScript
Raw Normal View History

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"];
export const Button = ({
children,
type,
onClick,
buttonStyle,
buttonSize,
2021-06-21 00:11:44 +00:00
newTo,
}) => {
const checkButtonStyle = STYLES.includes(buttonStyle)
? buttonStyle
: STYLES[0];
const checkButtonSize = SIZES.includes(buttonSize) ? buttonSize : SIZES[0];
return (
2021-06-21 01:45:22 +00:00
<Link to={newTo || "/"} className="btn-mobile">
<button
className={`btn ${checkButtonStyle} ${checkButtonSize}`}
onClick={onClick}
type={type}
>
{children}
</button>
</Link>
);
};