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

9
src/Footer.js Normal file
View File

@@ -0,0 +1,9 @@
import React from 'react';
export default function Footer() {
return (
<footer>
&copy; Matthew Grove {new Date().getFullYear()}
</footer>
)
}

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>
)
}

45
src/SettingsContent.js Normal file
View File

@@ -0,0 +1,45 @@
import React, { Component } from 'react';
import Checkbox from '@material-ui/core/Checkbox';
import { CheckRounded as CheckRoundedIcon } from "@material-ui/icons";
import Button from "./Button";
import "./css/SettingsContent.css";
export default class SettingsContent extends Component {
render() {
return (
<>
<h1 className="settings-header">Settings</h1>
<label className="settings-sound-container">
<Checkbox
checked={this.props.soundInput}
onChange={this.props.handleSoundInputChange}
inputProps={{ 'aria-label': 'checkbox' }}
/>
<span>Sound</span>
</label>
<h2 className="settings-theme-header">Theme</h2>
<div className="settings-themes-container">
{
this.props.themes.map((theme) =>
<Button
onClick={() => this.props.handleThemeInputChange(theme)}
icon={this.props.themeInput === theme && <CheckRoundedIcon />}
className={`background--${theme}`}
key={theme}
>
{
theme.split("-")
.map((word) =>
word[0].toUpperCase() + word.substring(1)
).join(" ")
}
</Button>
)
}
</div>
</>
)
}
}