mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-27 12:54:42 -05:00
30 lines
839 B
TypeScript
30 lines
839 B
TypeScript
import { useTranslation } from "react-i18next";
|
|
import { useMatches } from "react-router";
|
|
import { LinkButton } from "~/components/elements/Button";
|
|
import { ArrowLeftIcon } from "~/components/icons/ArrowLeft";
|
|
import type { TeamLoaderData } from "~/features/team/loaders/t.$customUrl.server";
|
|
import invariant from "~/utils/invariant";
|
|
import { teamPage } from "~/utils/urls";
|
|
|
|
export function TeamGoBackButton() {
|
|
const { t } = useTranslation(["common"]);
|
|
|
|
const [, parentRoute] = useMatches();
|
|
invariant(parentRoute);
|
|
const layoutData = parentRoute.data as TeamLoaderData;
|
|
|
|
return (
|
|
<div className="stack">
|
|
<LinkButton
|
|
to={teamPage(layoutData.team.customUrl)}
|
|
icon={<ArrowLeftIcon />}
|
|
variant="outlined"
|
|
size="small"
|
|
className="mr-auto"
|
|
>
|
|
{t("common:actions.back")}
|
|
</LinkButton>
|
|
</div>
|
|
);
|
|
}
|