Restructure
This commit is contained in:
parent
da48f005a3
commit
22a3ca1769
16 changed files with 44 additions and 34 deletions
55
client-solid/src/Containers/Footer.tsx
Normal file
55
client-solid/src/Containers/Footer.tsx
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
import { JSXElement } from "solid-js";
|
||||
|
||||
export function Footer(): JSXElement {
|
||||
return (
|
||||
<footer class="footer footer-center bottom-0 rounded bg-base-200 p-10 text-base-content">
|
||||
<nav class="grid grid-flow-col gap-4">
|
||||
<a class="link-hover link">About us</a>
|
||||
<a class="link-hover link">Contact</a>
|
||||
</nav>
|
||||
<nav>
|
||||
<div class="grid grid-flow-col gap-4">
|
||||
<a>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
class="fill-current"
|
||||
>
|
||||
<path d="M24 4.557c-.883.392-1.832.656-2.828.775 1.017-.609 1.798-1.574 2.165-2.724-.951.564-2.005.974-3.127 1.195-.897-.957-2.178-1.555-3.594-1.555-3.179 0-5.515 2.966-4.797 6.045-4.091-.205-7.719-2.165-10.148-5.144-1.29 2.213-.669 5.108 1.523 6.574-.806-.026-1.566-.247-2.229-.616-.054 2.281 1.581 4.415 3.949 4.89-.693.188-1.452.232-2.224.084.626 1.956 2.444 3.379 4.6 3.419-2.07 1.623-4.678 2.348-7.29 2.04 2.179 1.397 4.768 2.212 7.548 2.212 9.142 0 14.307-7.721 13.995-14.646.962-.695 1.797-1.562 2.457-2.549z" />
|
||||
</svg>
|
||||
</a>
|
||||
<a>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
class="fill-current"
|
||||
>
|
||||
<path d="M19.615 3.184c-3.604-.246-11.631-.245-15.23 0-3.897.266-4.356 2.62-4.385 8.816.029 6.185.484 8.549 4.385 8.816 3.6.245 11.626.246 15.23 0 3.897-.266 4.356-2.62 4.385-8.816-.029-6.185-.484-8.549-4.385-8.816zm-10.615 12.816v-8l8 3.993-8 4.007z" />
|
||||
</svg>
|
||||
</a>
|
||||
<a>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
class="fill-current"
|
||||
>
|
||||
<path d="M9 8h-3v4h3v12h5v-12h3.642l.358-4h-4v-1.667c0-.955.192-1.333 1.115-1.333h2.885v-5h-3.808c-3.596 0-5.192 1.583-5.192 4.615v3.385z" />
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
<aside>
|
||||
<p>
|
||||
Copyright © {new Date().getFullYear()} - All right reserved by Swarm
|
||||
Industries Ltd
|
||||
</p>
|
||||
</aside>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
61
client-solid/src/Containers/LoginModal.tsx
Normal file
61
client-solid/src/Containers/LoginModal.tsx
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import { JSXElement, Show, onCleanup, useContext } from "solid-js";
|
||||
|
||||
import { LoginForm } from "../Components/Login";
|
||||
import { RegisterForm } from "../Components/Register";
|
||||
import { ModalContext } from "../Context/GlobalState";
|
||||
|
||||
export function LoginModal(): JSXElement {
|
||||
const modal_ctx = useContext(ModalContext)!;
|
||||
|
||||
const closeModal = (): void => {
|
||||
modal_ctx.setOpen(false);
|
||||
};
|
||||
|
||||
// Close the modal when the component is unmounted
|
||||
onCleanup(() => {
|
||||
modal_ctx.setOpen(false);
|
||||
});
|
||||
|
||||
return (
|
||||
<Show when={modal_ctx.isOpen()}>
|
||||
<dialog class="modal modal-open">
|
||||
<div class="modal-box">
|
||||
<form method="dialog">
|
||||
<button
|
||||
onClick={closeModal}
|
||||
class="btn btn-circle btn-ghost btn-sm absolute right-2 top-2"
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
</form>
|
||||
<h3 class="mb-2 text-lg font-bold">Welcome!</h3>
|
||||
<div class="tabs tabs-lifted">
|
||||
<input
|
||||
type="radio"
|
||||
name="login_tabs"
|
||||
class="tab"
|
||||
aria-label="Login"
|
||||
checked
|
||||
/>
|
||||
<div class="tab-content rounded-box border-base-300 bg-base-100 p-10">
|
||||
<LoginForm />
|
||||
</div>
|
||||
|
||||
<input
|
||||
type="radio"
|
||||
name="login_tabs"
|
||||
class="tab"
|
||||
aria-label="Register"
|
||||
/>
|
||||
<div class="tab-content rounded-box border-base-300 bg-base-100 p-10">
|
||||
<RegisterForm />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button onClick={closeModal}>close</button>
|
||||
</form>
|
||||
</dialog>
|
||||
</Show>
|
||||
);
|
||||
}
|
||||
25
client-solid/src/Containers/Navbar.tsx
Normal file
25
client-solid/src/Containers/Navbar.tsx
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { A } from "@solidjs/router";
|
||||
import { JSXElement } from "solid-js";
|
||||
|
||||
import { LoginButton } from "../Components/LoginButton";
|
||||
import { Menu } from "../Components/Menu";
|
||||
import { Flake } from "../Util/Icons";
|
||||
|
||||
export function Navbar(): JSXElement {
|
||||
return (
|
||||
<div class="max-w navbar max-w-3xl rounded-box text-neutral-content md:my-4">
|
||||
<div class="flex-1">
|
||||
<A href={"/"} class="btn btn-ghost text-xl normal-case">
|
||||
<Flake />
|
||||
FrostByte
|
||||
</A>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<Menu />
|
||||
</div>
|
||||
<div class="flex flex-1 justify-end">
|
||||
<LoginButton />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
18
client-solid/src/Containers/Primary.tsx
Normal file
18
client-solid/src/Containers/Primary.tsx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { Route, Routes } from "@solidjs/router";
|
||||
import { JSXElement } from "solid-js";
|
||||
|
||||
import { NewPostInputArea } from "../Components/NewPost";
|
||||
import { Posts } from "../Components/Posts";
|
||||
import { SinglePost } from "../Components/SinglePost";
|
||||
|
||||
// Primary is the section of the page that holds the main content
|
||||
export function Primary(): JSXElement {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path="/" element={<Posts />} />
|
||||
<Route path="/post/:postid" element={<SinglePost />} />
|
||||
<Route path="/new" element={<NewPostInputArea />} />
|
||||
<Route path="*" element={<h1>404</h1>} />
|
||||
</Routes>
|
||||
);
|
||||
}
|
||||
35
client-solid/src/Containers/Root.tsx
Normal file
35
client-solid/src/Containers/Root.tsx
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import { JSXElement } from "solid-js";
|
||||
|
||||
import { GlobalStateProvider } from "../Context/GlobalState";
|
||||
import { Footer } from "./Footer";
|
||||
import { LoginModal } from "./LoginModal";
|
||||
import { Navbar } from "./Navbar";
|
||||
import { Primary } from "./Primary";
|
||||
|
||||
function Root(): JSXElement {
|
||||
return (
|
||||
<>
|
||||
<GlobalStateProvider>
|
||||
<FancyBackground />
|
||||
<div class="flex flex-col items-center">
|
||||
<Navbar />
|
||||
<LoginModal />
|
||||
<div class="mb-8 flex min-h-[65vh] w-full flex-col items-center space-y-2 px-2 md:max-w-3xl">
|
||||
<Primary />
|
||||
</div>
|
||||
<Footer />
|
||||
</div>
|
||||
</GlobalStateProvider>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function FancyBackground(): JSXElement {
|
||||
return (
|
||||
<div class="bg-container">
|
||||
<div class="bg-fancy bg-cover bg-center" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Root;
|
||||
Loading…
Add table
Add a link
Reference in a new issue