74 lines
2.4 KiB
TypeScript
74 lines
2.4 KiB
TypeScript
import { useTranslation } from "react-i18next";
|
|
import ButtonEvent from "~/components/ui/buttons/ButtonEvent";
|
|
import LocaleSelector from "~/components/ui/selectors/LocaleSelector";
|
|
import ThemeSelector from "~/components/ui/selectors/ThemeSelector";
|
|
import DarkModeToggle from "~/components/ui/toggles/DarkModeToggle";
|
|
|
|
type PublicFooterLink = {
|
|
name: string;
|
|
href: string;
|
|
target?: "_blank";
|
|
};
|
|
|
|
type PublicFooterSection = {
|
|
name: string;
|
|
items: PublicFooterLink[];
|
|
};
|
|
|
|
type Props = {
|
|
sections?: PublicFooterSection[];
|
|
withDarkModeToggle?: boolean;
|
|
withLanguageSelector?: boolean;
|
|
withThemeSelector?: boolean;
|
|
};
|
|
|
|
export default function PublicFooter({ sections, withDarkModeToggle = true, withLanguageSelector = true, withThemeSelector = true }: Props) {
|
|
const { t } = useTranslation();
|
|
const footerSections =
|
|
sections ??
|
|
[
|
|
{
|
|
name: t("front.footer.application"),
|
|
items: [
|
|
{ name: t("front.footer.signIn"), href: "/login" },
|
|
{ name: t("front.footer.signUp"), href: "/register" },
|
|
],
|
|
},
|
|
{
|
|
name: t("front.footer.product"),
|
|
items: [
|
|
{ name: t("front.footer.termsAndConditions"), href: "/terms-and-conditions" },
|
|
{ name: t("front.footer.privacyPolicy"), href: "/privacy-policy" },
|
|
],
|
|
},
|
|
];
|
|
|
|
return (
|
|
<footer>
|
|
<div className="mx-auto max-w-7xl overflow-hidden px-4 py-12 sm:px-6 lg:px-8">
|
|
{footerSections.map((section) => (
|
|
<nav key={section.name} className="-mx-5 -my-2 flex flex-wrap justify-center" aria-label={section.name}>
|
|
{section.items.map((link) => (
|
|
<div key={link.href} className="px-5 py-2">
|
|
<ButtonEvent
|
|
to={link.href}
|
|
target={link.target}
|
|
className="hover:text-foreground text-muted-foreground text-base dark:hover:text-white"
|
|
event={{ action: "click", category: "footer", label: link.name, value: link.href }}
|
|
>
|
|
{link.name}
|
|
</ButtonEvent>
|
|
</div>
|
|
))}
|
|
</nav>
|
|
))}
|
|
<div className="mt-4 flex items-center justify-center gap-2">
|
|
{withDarkModeToggle && <DarkModeToggle />}
|
|
{withLanguageSelector && <LocaleSelector />}
|
|
{withThemeSelector && <ThemeSelector />}
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
);
|
|
}
|