UNPKG

@keycloakify/keycloak-account-ui

Version:

<p align="center"> <img src="https://github.com/user-attachments/assets/e31c4910-7205-441c-9a35-e134b806b3a8"> </p> <p align="center"> <i>Repackaged Keycloak Account UI</i> <br> <br> <a href="https://github.com/keycloakify/keycloak-a

31 lines 1.81 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { KeycloakMasthead, label, useEnvironment, } from "../ui-shared"; import { Button } from "@patternfly/react-core"; import { ExternalLinkSquareAltIcon } from "@patternfly/react-icons"; import { useTranslation } from "react-i18next"; import { useHref } from "react-router-dom"; import { environment } from "../environment"; import { joinPath } from "../utils/joinPath"; import style from "@keycloakify/keycloak-account-ui/root/header.module.css"; const ReferrerLink = () => { const { t } = useTranslation(); return environment.referrerUrl ? (_jsx(Button, { "data-testid": "referrer-link", component: "a", href: environment.referrerUrl.replace("_hash_", "#"), variant: "link", icon: _jsx(ExternalLinkSquareAltIcon, {}), iconPosition: "right", isInline: true, children: t("backTo", { app: label(t, environment.referrerName, environment.referrerUrl), }) })) : null; }; export const Header = () => { const { environment, keycloak } = useEnvironment(); const { t } = useTranslation(); const brandImage = environment.logo || "logo.svg"; const logoUrl = environment.logoUrl ? environment.logoUrl : "/"; const internalLogoHref = useHref(logoUrl); // User can indicate that he wants an internal URL by starting it with "/" const indexHref = logoUrl.startsWith("/") ? internalLogoHref : logoUrl; return (_jsx(KeycloakMasthead, { "data-testid": "page-header", keycloak: keycloak, features: { hasManageAccount: false }, showNavToggle: true, brand: { href: indexHref, src: joinPath(environment.resourceUrl, brandImage), alt: t("logo"), className: style.brand, }, toolbarItems: [_jsx(ReferrerLink, {}, "link")] })); }; //# sourceMappingURL=Header.js.map