component: add Layout component

This commit is contained in:
oscarzhou 2020-12-09 19:03:54 +13:00
parent 37e0f71d8f
commit 20d14b3fb2
5 changed files with 26 additions and 40 deletions

View File

@ -1,28 +0,0 @@
.App {
text-align: center;
}
.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 80px;
}
.App-header {
background-color: #222;
height: 150px;
padding: 20px;
color: white;
}
.App-title {
font-size: 1.5em;
}
.App-intro {
font-size: large;
}
@keyframes App-logo-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}

View File

@ -1,18 +1,15 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Layout from "./components/Layout/Layout";
class App extends Component {
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h1 className="App-title">Welcome to React</h1>
</header>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
<div>
<Layout>
Test
</Layout>
</div>
);
}

View File

@ -0,0 +1,14 @@
import React from 'react';
import Aux from "../../hoc/Auxiliary";
const layout = (props) => (
<Aux>
<div>Toolbar, SideDrawer, Backdrop</div>
<main>
{props.children}
</main>
</Aux>
)
export default layout;

3
src/hoc/Auxiliary.js Normal file
View File

@ -0,0 +1,3 @@
const aux = (props) => props.children
export default aux;

View File

@ -1,5 +1,5 @@
body {
margin: 0;
padding: 0;
font-family: sans-serif;
}
font-family: "Open Sans", sans-serif;
}