Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/components/navigation/breadcrumbs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { MdHome } from "react-icons/md";
import { VscChevronRight } from "react-icons/vsc";
import Link from "./link";

const BASE_URL = import.meta.env.BASE_URL;

function BreadcrumbItem({ className, href, text }) {
const breadcrumbItemClass = useMemo(() => {
return gwMerge(
Expand Down Expand Up @@ -44,7 +42,7 @@ function Breadcrumbs({ className, children, baseUrl }) {
<li>
<div>
<Link
href={`${(baseUrl || "").replace(/\/+$/, "")}/`} // Avoid double slashes
href={baseUrl}
className="gw-text-gray-300 gw-hover:gw-text-gray-500"
>
<MdHome size={22} />
Expand Down
10 changes: 4 additions & 6 deletions lib/composite/header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { useState } from "react";
import gwMerge from "../../gw-merge";
import Link from "../../components/navigation/link";

const BASE_URL = import.meta.env.BASE_URL;

function Title({ title = "", subtitle = "" }) {
return (
<div
Expand All @@ -25,10 +23,10 @@ function Title({ title = "", subtitle = "" }) {
);
}

function Logo() {
function Logo({ homeUrl }) {
return (
<div className="gw-relative gw-w-[70px] sm:gw-w-[82px] gw-shrink-0 sm:gw-top-3">
<Link href={BASE_URL + "/"}>
<Link href={homeUrl}>
<img
className="gw-w-[50px] sm:gw-w-[60px] gw-h-auto"
src={usaceLogo}
Expand All @@ -43,7 +41,7 @@ function Logo() {
);
}

function Header({ links, title, subtitle, navRight, fluidNav }) {
function Header({ links, title, subtitle, navRight, fluidNav, homeUrl }) {
const [showOverlayLinks, setShowOverlayLinks] = useState(false);
const navContainerClass = gwMerge(
"gw-w-full gw-mx-auto gw-px-4 gw-box-border",
Expand All @@ -56,7 +54,7 @@ function Header({ links, title, subtitle, navRight, fluidNav }) {
<div className="gw-min-h-12 gw-bg-nav-black gw-text-white">
<div className={navContainerClass}>
<div className="gw-flex gw-justify-between gw-items-center">
<Logo />
<Logo homeUrl={homeUrl} />
<NavbarLinks links={links} />
<span className="gw-flex gw-flex-row-reverse gw-justify-end gw-items-center gw-w-full md:gw-max-w-[300px] gw-mr-2">
{navRight ? navRight : null}
Expand Down
2 changes: 2 additions & 0 deletions lib/composite/site-wrapper/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function SiteWrapper({
msgBanner = undefined,
msgBannerPosition = "top",
title = "US Army Corps of Engineers",
homeUrl = "#",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this default to #?

I would think / or nothing by default not an empty anchor tag. I realize the hash router might require it though.

fluidNav = false,
subtitle = "",
missionText = "",
Expand Down Expand Up @@ -51,6 +52,7 @@ function SiteWrapper({
subtitle={subtitle}
navRight={navRight}
fluidNav={fluidNav}
homeUrl={homeUrl}
/>

{msgBanner && msgBannerPosition === "bottom" ? msgBanner : null}
Expand Down
3 changes: 2 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ function App() {
<div
onClick={getNavHelper((url) => {
// Remove BASE_URL# before it is added again by the navhelper so it can be included in the hrefs for copy url purposes
if (url.includes(`${BASE_URL}#`)) url = url.replace(`${BASE_URL}#`, "");
url = url.replace(`${BASE_URL}#`, "");
doUpdateHash(url);
})}
>
<SiteWrapper
fluidNav={true}
links={links}
homeUrl={`${BASE_URL}#/`}
usaBanner={true}
subtitle={`Groundwork React Components v${version}`}
missionText="We strive to provide the best React components for the USACE."
Expand Down
4 changes: 2 additions & 2 deletions src/app-pages/documentation/_docs-page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ function DocsPage({ breadcrumbs = [], children }) {
const { hash } = useConnect("selectHash");
return (
<Container fluid>
<Breadcrumbs baseUrl={BASE_URL}>
<Breadcrumbs baseUrl={`${BASE_URL}#/`}>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I thought the base had the # in it for the hash router stuff

{breadcrumbs.map((breadcrumb) => (
<BreadcrumbItem
key={breadcrumb.text}
href={BASE_URL + breadcrumb.href}
href={breadcrumb.href}
text={breadcrumb.text}
/>
))}
Expand Down
6 changes: 6 additions & 0 deletions src/app-pages/documentation/app-shell/site-wrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ const siteWrapperProps = [
default: "true",
desc: "If true, the footer will be displayed at the bottom of the page. Set to false to hide the footer in case you need the screen space for something like a map viewer.",
},
{
name: "homeUrl",
type: "string",
default: "#",
desc: "Sets the href on the Corps Castle in the header.",
},
{
name: "title",
type: "string",
Expand Down
2 changes: 1 addition & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default defineConfig(({ mode }) => {
const base =
mode === "production"
? "https://usace.github.io/groundwork/"
: "http://localhost:5173/";
: "http://localhost:5173/groundwork/";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Avoids the awkward chance of missing path related issues on localhost

return {
plugins: [react()],
base: base,
Expand Down
Loading