Commit 2d007e6b authored by David Haynes's avatar David Haynes 🙆

Stateless components ftw

parent 4864dbff
Pipeline #3463 passed with stage
in 52 seconds
import React from "react";
import ReactDOM from "react-dom";
import { HashRouter, Route, Link } from "react-router-dom";
import { HashRouter } from "react-router-dom";
import { Routes } from "Utils";
......
import React from "react";
import { Navbar, NavbarBrand, Nav, NavItem, NavLink } from "reactstrap";
export default class NavBar extends React.Component {
render() {
return (
<div>
<Navbar color="dark" dark expand="md">
<NavbarBrand href="#">Go</NavbarBrand>
const NavBar = props => (
<div>
<Navbar color="dark" dark expand="md">
<NavbarBrand href="#">Go</NavbarBrand>
<Nav className="ml-auto" navbar>
<NavItem>
<NavLink href="#/dhaynes" active={this.props.page == "dhaynes"}>
Dhaynes
</NavLink>
</NavItem>
<NavItem>
<NavLink href="#/about" active={this.props.page == "about"}>
About
</NavLink>
</NavItem>
</Nav>
</Navbar>
</div>
);
}
}
<Nav className="ml-auto" navbar>
<NavItem>
<NavLink href="#/dhaynes" active={props.page == "dhaynes"}>
Dhaynes
</NavLink>
</NavItem>
<NavItem>
<NavLink href="#/about" active={props.page == "about"}>
About
</NavLink>
</NavItem>
</Nav>
</Navbar>
</div>
);
export default NavBar;
import React from 'react';
import React from "react";
import { PageTemplate } from 'Components';
import { PageTemplate } from "Components";
export default class DhaynesPage extends React.Component {
render() {
return (
<PageTemplate page={'dhaynes'}>
<h2>DAVID HAYNES</h2>
</PageTemplate>
);
}
}
const DhaynesPage = () => (
<PageTemplate page={"dhaynes"}>
<h2>DAVID HAYNES</h2>
</PageTemplate>
);
export default DhaynesPage;
import React from 'react';
import React from "react";
import { PageTemplate, AuthButton } from 'Components';
import { PageTemplate, AuthButton } from "Components";
export default class HomePage extends React.Component {
render() {
return (
<PageTemplate page={'home'}>
<p>Hello World! 1</p>
<AuthButton />
</PageTemplate>
);
}
}
const HomePage = () => (
<PageTemplate page={"home"}>
<p>Hello World! 1</p>
<AuthButton />
</PageTemplate>
);
export default HomePage;
import HomePage from './HomePage';
import AboutPage from './AboutPage';
import DhaynesPage from './DhaynesPage';
import HomePage from "./HomePage";
import AboutPage from "./AboutPage";
import DhaynesPage from "./DhaynesPage";
export { HomePage, AboutPage, DhaynesPage };
import React from 'react';
import React from "react";
import { NavBar } from 'Components';
import { NavBar } from "Components";
export default class PageTemplate extends React.Component {
render() {
return (
<div>
<NavBar page={this.props.page} />
<div>{this.props.children}</div>
</div>
);
}
}
const PageTemplate = props => (
<div>
<NavBar page={props.page} />
<div>{props.children}</div>
</div>
);
export default PageTemplate;
import PageTemplate from './PageTemplate';
import PageTemplate from "./PageTemplate";
export { PageTemplate };
......@@ -4,7 +4,7 @@ import { NavBar } from "./Organisms";
import { AuthButton } from "./Molecules";
export {
//Tempaltes
//Templates
PageTemplate,
//Pages
HomePage,
......
import Routes from './Routes';
import Routes from "./Routes";
export { Routes };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment