Commit 17a510da authored by David Haynes's avatar David Haynes 🙆

Scaffolding for "New Link"

- imitation is the sincerest form of flattery
parent 32312625
Pipeline #3877 failed with stage
in 1 minute and 23 seconds
import * as Yup from "yup";
const NewGoLinkValidator = Yup.object().shape({
destination: Yup.string()
.url()
.max(1000, "Too Long!"),
short: Yup.string()
.required("Required")
.max(20, "Too Long!"),
expires: Yup.date()
.nullable()
.min(new Date())
});
export default NewGoLinkValidator;
...@@ -34,8 +34,8 @@ const NavBar = props => { ...@@ -34,8 +34,8 @@ const NavBar = props => {
<Collapse isOpen={!collapsed} navbar> <Collapse isOpen={!collapsed} navbar>
<Nav className="mx-auto" navbar> <Nav className="mx-auto" navbar>
<NavItem> <NavItem>
<NavLink href="#/dhaynes" active={pathname == "/dhaynes"}> <NavLink href="#/new" active={pathname == "/new"}>
Dhaynes New Link
</NavLink> </NavLink>
</NavItem> </NavItem>
<NavItem> <NavItem>
......
import React, { useState } from "react";
import NewGoLinkValidator from "../Molecules/NewGoLinkValidator";
import { Formik, Field, Form, ErrorMessage } from "formik";
import { GetCSRFToken } from "../../Utils/GetCSRFToken";
import { SingleDatePicker } from "react-dates";
const NewGoLinkForm = props => {
const [focused, setFocused] = useState(false);
return <div />;
};
export default NewGoLinkForm;
import NavBar from "./NavBar"; import NavBar from "./NavBar";
import NewGoLinkForm from "./NewGoLinkForm";
export { NavBar }; export { NavBar, NewGoLinkForm };
import React from "react";
import { PageTemplate } from "Components";
const DhaynesPage = () => (
<PageTemplate>
<h2>DAVID HAYNES</h2>
</PageTemplate>
);
export default DhaynesPage;
import React from "react";
import AuthedPageTemplate from "../Templates/AuthedPageTemplate";
import NewGolinkForm from "../Organisms/NewGoLinkForm";
const NewGoLinkPage = props => {
return (
<AuthedPageTemplate>
<h2 className="mt-4">Create a new Go link</h2>
<p className="text-muted">
A Go link is composed of the original "target" URL, and the shortcode to
be used in the Go link.
</p>
<legend />
<NewGolinkForm />
</AuthedPageTemplate>
);
};
export default NewGoLinkPage;
import HomePage from "./HomePage"; import HomePage from "./HomePage";
import AboutPage from "./AboutPage"; import AboutPage from "./AboutPage";
import DhaynesPage from "./DhaynesPage";
import DebugCRUD from "./DebugCRUD"; import DebugCRUD from "./DebugCRUD";
import NewGoLinkPage from "./NewGoLinkPage";
export { HomePage, AboutPage, DhaynesPage, DebugCRUD }; export { HomePage, AboutPage, DebugCRUD, NewGoLinkPage };
...@@ -5,8 +5,8 @@ import { ...@@ -5,8 +5,8 @@ import {
DebugDelete, DebugDelete,
DebugUpdate DebugUpdate
} from "./Molecules"; } from "./Molecules";
import { NavBar } from "./Organisms"; import { NavBar, NewGoLinkForm } from "./Organisms";
import { HomePage, AboutPage, DhaynesPage, DebugCRUD } from "./Pages"; import { HomePage, AboutPage, DebugCRUD, NewGoLinkPage } from "./Pages";
import { PageTemplate, AuthedPageTemplate } from "./Templates"; import { PageTemplate, AuthedPageTemplate } from "./Templates";
export { export {
...@@ -18,11 +18,12 @@ export { ...@@ -18,11 +18,12 @@ export {
DebugUpdate, DebugUpdate,
//Organisms //Organisms
NavBar, NavBar,
NewGoLinkForm,
//Pages //Pages
HomePage, HomePage,
AboutPage, AboutPage,
DhaynesPage,
DebugCRUD, DebugCRUD,
NewGoLinkPage,
//Templates //Templates
PageTemplate, PageTemplate,
AuthedPageTemplate AuthedPageTemplate
......
...@@ -3,9 +3,9 @@ import { Route, withRouter, Switch } from "react-router-dom"; ...@@ -3,9 +3,9 @@ import { Route, withRouter, Switch } from "react-router-dom";
import { NavBar } from "Components"; import { NavBar } from "Components";
const Home = lazy(() => import("../Components/Pages/HomePage")); const Home = lazy(() => import("../Components/Pages/HomePage"));
const Dhaynes = lazy(() => import("../Components/Pages/DhaynesPage"));
const About = lazy(() => import("../Components/Pages/AboutPage")); const About = lazy(() => import("../Components/Pages/AboutPage"));
const DebugCRUD = lazy(() => import("../Components/Pages/DebugCRUD")); const DebugCRUD = lazy(() => import("../Components/Pages/DebugCRUD"));
const NewGoLinkPage = lazy(() => import("../Components/Pages/NewGoLinkPage"));
const NavBarWithRouter = withRouter(props => <NavBar {...props} />); const NavBarWithRouter = withRouter(props => <NavBar {...props} />);
...@@ -15,9 +15,9 @@ const Routes = () => ( ...@@ -15,9 +15,9 @@ const Routes = () => (
<Suspense fallback={<div>Loading...</div>}> <Suspense fallback={<div>Loading...</div>}>
<Switch> <Switch>
<Route path="/" exact component={Home} /> <Route path="/" exact component={Home} />
<Route path="/dhaynes" component={Dhaynes} />
<Route path="/about" component={About} /> <Route path="/about" component={About} />
<Route path="/debug" component={DebugCRUD} /> <Route path="/debug" component={DebugCRUD} />
<Route path="/new" component={NewGoLinkPage} />
<Route render={() => <div>404</div>} /> <Route render={() => <div>404</div>} />
</Switch> </Switch>
</Suspense> </Suspense>
......
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