Skip to content

Commit

Permalink
hot
Browse files Browse the repository at this point in the history
  • Loading branch information
tajbowness committed Jul 22, 2024
1 parent b1d978a commit b458f6d
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 24 deletions.
5 changes: 2 additions & 3 deletions app/comps/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import NavItem from "./nav/NavItem"
export default function NavBar(props) {
return (
<div className="navbar-cont">
<NavItem text="Home" route={props.route}/>
{/* <NavItem text="About" route={props.route}/> */}
<NavItem text="Privacy" route={props.route}/>
<NavItem text="Home" route={props.route} setPage={props.setPage}/>
<NavItem text="Privacy" route={props.route} setPage={props.setPage}/>
</div>
)
}
18 changes: 5 additions & 13 deletions app/comps/nav/NavItem.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
import { useNavigate, useRevalidator } from "@remix-run/react";

export default function NavItem(props) {
const navigate = useNavigate();
const revalidator = useRevalidator();

return(
<p
className={`
navbar-item
${props.text.toLowerCase() === props.route && "nav-sel"}
`}
onClick={() => {
navigate("/" + props.text.toLowerCase())
revalidator.revalidate();
}}
>
className={`navbar-item ${props.text.toLowerCase() === props.route && "nav-sel"}`}
onClick={() => {
props.setPage(props.text.toLowerCase())
}}
>
{props.text}
</p>
)
Expand Down
2 changes: 1 addition & 1 deletion app/entry.client.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ startTransition(() => {
hydrateRoot(
document,
<StrictMode>
<RemixBrowser basename="/fontaine/" />
<RemixBrowser/>
</StrictMode>
);
});
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions app/root.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import {
Scripts,
ScrollRestoration
} from "@remix-run/react"
import NavBar from "./comps/Navbar"
import "../styles.scss"
import { useLoaderData } from "@remix-run/react"

export const clientLoader = async ({ request }) => {
return request.url.split('fontaine/')[1]
Expand Down Expand Up @@ -37,7 +35,6 @@ export default function App() {
return (
<div className="main">
<div className="main-content">
<NavBar route={useLoaderData()} />
<Outlet />
</div>
</div>
Expand Down
19 changes: 18 additions & 1 deletion app/routes/_index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import React, {useState} from "react"
import NavBar from "../comps/Navbar"
import "../../styles.scss"
import { useLoaderData } from "@remix-run/react"
import Home from "../pages/home"
import Privacy from "../pages/privacy"

export const meta = () => {
return [
Expand All @@ -7,8 +12,20 @@ export const meta = () => {
]
}

export const clientLoader = async ({ request }) => {
return new URL(request.url).searchParams.get("param");
}

export default function Index() {
const [page, setPage] = useState(useLoaderData() ?? "home")
return (
<></>
<>
<NavBar route={page} setPage={setPage} />
{page === "home" ? (
<Home />
) : (
<Privacy />
)}
</>
)
}
3 changes: 0 additions & 3 deletions app/routes/about.jsx

This file was deleted.

0 comments on commit b458f6d

Please sign in to comment.