mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2025-12-24 01:24:28 +01:00
add feedback form
This commit is contained in:
23
src/components/layout/BackPop.tsx
Normal file
23
src/components/layout/BackPop.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import { useLocation, useNavigate } from "solid-start";
|
||||
import { BackButton } from "./BackButton";
|
||||
|
||||
type StateWithPrevious = {
|
||||
previous?: string;
|
||||
};
|
||||
|
||||
export function BackPop() {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
const state = location.state as StateWithPrevious;
|
||||
|
||||
const backPath = () => (state?.previous ? state?.previous : "/");
|
||||
|
||||
return (
|
||||
<BackButton
|
||||
title="Back"
|
||||
onClick={() => navigate(backPath())}
|
||||
showOnDesktop
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user