fix: templates page back button (#6088)

Co-authored-by: Piyush Gupta <56182734+gupta-piyush19@users.noreply.github.com>
Co-authored-by: Anshuman Pandey <54475686+pandeymangg@users.noreply.github.com>
Co-authored-by: Matti Nannt <mail@matthiasnannt.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Victor Santos <victor@formbricks.com>
This commit is contained in:
Dhruwang Jariwala
2025-06-26 16:08:45 +05:30
committed by GitHub
parent ce47b4c2d8
commit 882ad99ed7
2 changed files with 11 additions and 3 deletions

View File

@@ -5,7 +5,11 @@ import { useTranslate } from "@tolgee/react";
import { ArrowLeftIcon } from "lucide-react";
import { useRouter } from "next/navigation";
export const BackButton = () => {
interface BackButtonProps {
path?: string;
}
export const BackButton = ({ path }: BackButtonProps) => {
const router = useRouter();
const { t } = useTranslate();
return (
@@ -13,7 +17,11 @@ export const BackButton = () => {
variant="secondary"
size="sm"
onClick={() => {
router.back();
if (path) {
router.push(path);
} else {
router.back();
}
}}>
<ArrowLeftIcon />
{t("common.back")}

View File

@@ -7,7 +7,7 @@ export const MenuBar = () => {
<>
<div className="border-b border-slate-200 bg-white px-5 py-2.5 sm:flex sm:items-center sm:justify-between">
<div className="flex items-center space-x-2 whitespace-nowrap">
<BackButton />
<BackButton path="/" />
</div>
</div>
</>