Merge pull request 'Added a custom link to the button' (#14) from feature/ButtonCustomLink into main

Reviewed-on: #14
This commit is contained in:
cami 2021-06-21 00:12:28 +00:00
commit 86f3320134
2 changed files with 10 additions and 3 deletions

View file

@ -2,6 +2,8 @@ import React from "react";
import "./Button.css";
import { Link } from "react-router-dom";
const newTo = (props) => '#';
const STYLES = ["btn--primary", "btn--outline"];
const SIZES = ["btn--medium", "btn--large"];
@ -11,6 +13,7 @@ export const Button = ({
onClick,
buttonStyle,
buttonSize,
newTo,
}) => {
const checkButtonStyle = STYLES.includes(buttonStyle)
? buttonStyle
@ -18,8 +21,9 @@ export const Button = ({
const checkButtonSize = SIZES.includes(buttonSize) ? buttonSize : SIZES[0];
return (
<Link to="sign-up" className="btn-mobile">
<Link to={newTo || '/'} className="btn-mobile">
<button
className={`btn ${checkButtonStyle} ${checkButtonSize}`}
onClick={onClick}

View file

@ -13,20 +13,23 @@ function HeroSection() {
className="btns"
buttonStyle="btn--primary"
buttonSize="btn--large"
newTo="login"
>
Einloggen (wenn du schon einmal mitgemacht hast)
Einloggen (wenn du schon einmal mitgemacht hast)
</Button>
<Button
className="btns"
buttonStyle="btn--primary"
buttonSize="btn--large"
newTo="register"
>
Registrieren (falls du das erste Mal hier bist)
Registrieren (falls du das erste Mal hier bist)
</Button>
<Button
className="btns"
buttonStyle="btn--primary"
buttonSize="btn--large"
newTo="manual"
>
Anleitung
</Button>