mirror of
https://github.com/freedbygrace/DynamoDNS.git
synced 2026-08-06 00:07:41 +00:00
8bddf00ef4
Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9111ef36-26c8-4085-84ca-a35dc1fec1b5 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7083d608-d6d3-4a6a-9a27-6286c5109627/e33594f7-ad24-43f5-a4e1-0d9d2f261947.jpg
35 lines
801 B
TypeScript
35 lines
801 B
TypeScript
import { Button } from "@/components/ui/button";
|
|
import { ChevronLeft } from "lucide-react";
|
|
import { useLocation } from "wouter";
|
|
|
|
interface BackButtonProps {
|
|
to?: string;
|
|
fallbackPath?: string;
|
|
className?: string;
|
|
}
|
|
|
|
export function BackButton({ to, fallbackPath = "/", className = "" }: BackButtonProps) {
|
|
const [_, setLocation] = useLocation();
|
|
|
|
const handleBack = () => {
|
|
if (to) {
|
|
setLocation(to);
|
|
} else if (window.history.length > 2) {
|
|
window.history.back();
|
|
} else {
|
|
setLocation(fallbackPath);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<Button
|
|
variant="ghost"
|
|
size="sm"
|
|
onClick={handleBack}
|
|
className={`flex items-center gap-1 px-2 ${className}`}
|
|
>
|
|
<ChevronLeft className="h-4 w-4" />
|
|
<span>Back</span>
|
|
</Button>
|
|
);
|
|
} |