Skip to content

Commit

Permalink
fix: back button on about page
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Jan 7, 2024
1 parent da844a2 commit 778e5bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/components/Backbar.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { PopiconsArrowLeftDuotone } from "@popicons/react";
import { useNavigate } from "react-router-dom";
import { To, useNavigate } from "react-router-dom";

export function Backbar() {
type BackbarProps = {
navigateTo?: string | -1;
};

export function Backbar({ navigateTo }: BackbarProps) {
const navigate = useNavigate();
return (
<div className="navbar bg-base-100">
<div className="flex-none">
<button
className="btn btn-ghost m-1"
onClick={() => navigate("../new")}
onClick={() => navigate((navigateTo as To) || "../new")}
>
<PopiconsArrowLeftDuotone className="w-6 h-6" />
</button>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Footer } from "../components/Footer";
export function About() {
return (
<>
<Backbar />
<Backbar navigateTo={-1} />
<div className="flex grow gap-5 flex-col justify-start items-center max-w-lg">
<h1 className="text-xl">About</h1>
<p>
Expand Down

0 comments on commit 778e5bc

Please sign in to comment.