Commit 20bd3bab authored by David Haynes's avatar David Haynes 🙆

Finish merge

- Also Prettier things up
parent 70fcd31c
Pipeline #3458 passed with stage
in 53 seconds
import React from 'react';
import ReactDOM from 'react-dom';
import { HashRouter, Route, Link } from 'react-router-dom';
import React from "react";
import ReactDOM from "react-dom";
import { HashRouter, Route, Link } from "react-router-dom";
import { Routes } from 'Utils';
import { Routes } from "Utils";
// Apply Global Masonstrap styling
import 'masonstrap/build/css/masonstrap.min.css';
import 'masonstrap/build/js/masonstrap.min.js';
import "masonstrap/build/css/masonstrap.min.css";
import "masonstrap/build/js/masonstrap.min.js";
ReactDOM.render(
<HashRouter>
<Routes />
</HashRouter>,
document.getElementById('root')
<HashRouter>
<Routes />
</HashRouter>,
document.getElementById("root")
);
import React from "react";
import { Button } from "reactstrap";
class AuthButton extends React.Component {
constructor(props) {
super(props);
this.state = { error: null, is_auth: false };
}
componentDidMount() {
fetch("/auth/status")
.then(res => res.json())
.then(
result => {
this.setState({
is_auth: result.is_authenticated
});
},
error => {
this.setState({
error
});
}
);
}
render() {
const { is_auth, error } = this.state;
if (error) {
return <div>Error: {error.message}</div>;
} else {
return (
<div>
{is_auth ? (
<Button color="info" href="/auth/logout">
Logout
</Button>
) : (
<Button color="info" href="/auth/login">
Login
</Button>
)}
</div>
);
}
}
}
export default AuthButton;
import React from 'react';
import { Button } from 'reactstrap';
import React from "react";
import { Button } from "reactstrap";
export default class AuthButton extends React.Component {
constructor(props) {
super(props);
this.state = { is_auth: false };
}
class AuthButton extends React.Component {
constructor(props) {
super(props);
this.state = { error: null, is_auth: false };
}
componentDidMount() {
this.setState(() => {
return { is_auth: window.django.user.is_authenticated == 'True' };
});
}
componentDidMount() {
fetch("/auth/status")
.then(res => res.json())
.then(
result => {
this.setState({
is_auth: result.is_authenticated
});
},
error => {
this.setState({
error
});
}
);
}
render() {
return (
<div>
{this.state.is_auth ? (
<Button color="info" href="/auth/logout">
Logout
</Button>
) : (
<Button color="info" href="/auth/login">
Login
</Button>
)}
</div>
);
render() {
const { is_auth, error } = this.state;
if (error) {
return <div>Error: {error.message}</div>;
} else {
return (
<div>
{is_auth ? (
<Button color="info" href="/auth/logout">
Logout
</Button>
) : (
<Button color="info" href="/auth/login">
Login
</Button>
)}
</div>
);
}
}
}
export default AuthButton;
import AuthButton from './AuthButton';
import AuthButton from "./AuthButton";
export { AuthButton };
import React from 'react';
import { Navbar, NavbarBrand, Nav, NavItem, NavLink } from 'reactstrap';
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>
render() {
return (
<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={this.props.page == "dhaynes"}>
Dhaynes
</NavLink>
</NavItem>
<NavItem>
<NavLink href="#/about" active={this.props.page == "about"}>
About
</NavLink>
</NavItem>
</Nav>
</Navbar>
</div>
);
}
}
import NavBar from './NavBar';
import NavBar from "./NavBar";
export { NavBar };
import { PageTemplate } from './Templates';
import { HomePage, AboutPage, DhaynesPage } from './Pages';
import { NavBar } from './Organisms';
import { AuthButton } from './Molecules';
import { PageTemplate } from "./Templates";
import { HomePage, AboutPage, DhaynesPage } from "./Pages";
import { NavBar } from "./Organisms";
import { AuthButton } from "./Molecules";
export {
//Tempaltes
PageTemplate,
//Pages
HomePage,
AboutPage,
DhaynesPage,
//Organisms
NavBar,
//Molecules
AuthButton,
//Tempaltes
PageTemplate,
//Pages
HomePage,
AboutPage,
DhaynesPage,
//Organisms
NavBar,
//Molecules
AuthButton
};
import React from 'react';
import { Route } from 'react-router-dom';
import React from "react";
import { Route } from "react-router-dom";
import { HomePage, AboutPage, DhaynesPage } from 'Components';
import { HomePage, AboutPage, DhaynesPage } from "Components";
const Routes = () => (
<div>
<Route path="/" exact component={HomePage} />
<Route path="/dhaynes" component={DhaynesPage} />
<Route path="/about" component={AboutPage} />
</div>
<div>
<Route path="/" exact component={HomePage} />
<Route path="/dhaynes" component={DhaynesPage} />
<Route path="/about" component={AboutPage} />
</div>
);
export default 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