Create page depency components

This commit is contained in:
2021-09-01 17:29:45 +01:00
parent f07ab92cfc
commit 93efa42f91
3 changed files with 88 additions and 0 deletions

34
src/NavBar.js Normal file
View File

@@ -0,0 +1,34 @@
import React from 'react';
import { Link } from "react-router-dom";
import BannerLogo from "./images/banner.png";
import SmallLogo from "./images/logo.png";
import "./css/NavBar.css";
import Button from "./Button";
import LinkButton from "./LinkButton";
export default function Navbar(props) {
const navbarItems = props.items;
return (
<nav>
<Link to="/">
<img className="navbar-logo" id="banner-logo" src={BannerLogo} alt="Parandum Logo" />
<img className="navbar-logo" id="small-logo" src={SmallLogo} alt="Parandum Logo" />
</Link>
{ navbarItems ?
<div className="navbar-items">
{navbarItems.map((item, index) => {
if (item.type === "link") {
return <LinkButton className={`${item.hideTextMobile ? "button--hide-text-mobile" : ""} ${item.icon && !item.name ? "button--round" : ""}`} key={index} to={item.link} icon={item.icon}>{item.name}</LinkButton>
} else if (item.type === "button") {
return <Button className={`${item.hideTextMobile ? "button--hide-text-mobile" : ""} ${item.icon && !item.name ? "button--round" : ""}`} key={index} onClick={item.onClick} icon={item.icon}>{item.name}</Button>
}
return false;
})}
</div>
:
""
}
</nav>
)
}