Files
authentik/packages/docusaurus-config/lib/navbar.js
Teffen Ellis a8e765257e web: Update Deprecated NPM Packages (#18335)
* core: Bump packages.

* Bump Live Reload dependencies.

* Bump tsconfig.

* Bum ESLint config deps. Fix formatting.

* Bump Prettier deps. Fix ESlint config.

* Bump live reload deps. Fix linter.

* Bump website deps.

* web: Update dependencies. Fix Playwright issues.

* Fix deprecations.

* Fix linter warnings.

* Fix override, run audit.

* Fix import path.

* Tidy types.

* Format.

* Update ignore patterns.

* Fix import path.

* Update deps. Clean up workspace linting.

* Update deps, options.

* Hide icons in navbar.

* Format.

* Remove deprecated option.

* Use relative packages.

* Add scripts. Tidy.

* Bump engines.

* Clarify order.

* Clarify order. Install base deps.

* Format.

* Fix stale user during tests.

* Fix runtime errors.

* Fix redirect during tests, UI change.

* web: Fix danger button hover background color.

* web: Adjust colors, padding.

* web: Fix sidebar colors, padding.

* Fix alignment.

* Fix background contrast.
2025-11-24 13:31:42 -05:00

112 lines
2.5 KiB
JavaScript

/**
* @file Docusaurus navbar configuration for the authentik website.
*
* @import { NavbarItem } from "@docusaurus/theme-common";
*/
import { DocusaurusURL, SocialURL } from "./routing.js";
/**
* The navbar items for the authentik website.
*
* @type {NavbarItem[]}
*/
export const SocialNavbarItems = /** @type {const} */ ([
{
"href": SocialURL.GitHub,
"data-icon": "github",
"aria-label": "GitHub",
"position": "right",
},
{
"href": SocialURL.Discord,
"data-icon": "discord",
"aria-label": "Discord",
"position": "right",
},
]);
/**
* The navbar items for the authentik website.
*
* @satisfies {NavbarItem[]}
*/
export const NavbarItemsTemplate = /** @type {const} */ ([
{
to: "{{WWW_URL}}/features",
label: "Features",
position: "left",
target: "_self",
},
{
to: "{{INTEGRATIONS_URL}}",
label: "Integrations",
target: "_self",
position: "left",
},
{
to: "{{DOCS_URL}}",
label: "Documentation",
position: "left",
target: "_self",
},
{
to: "{{WWW_URL}}/pricing/",
label: "Pricing",
position: "left",
target: "_self",
},
{
to: "{{WWW_URL}}/blog",
label: "Blog",
position: "left",
target: "_self",
},
...SocialNavbarItems,
]);
/**
* @typedef {Object} NavbarItemOverrides
*
* @prop {string} WWW_URL The URL for the WWW environment.
* @prop {string} DOCS_URL The URL for the documentation.
* @prop {string} INTEGRATIONS_URL The URL for the integrations.
*/
const DEFAULT_NAVBAR_REPLACEMENTS = /** @type {const} */ ({
DOCS_URL: DocusaurusURL.Docs,
INTEGRATIONS_URL: DocusaurusURL.Integrations,
WWW_URL: DocusaurusURL.WWW,
});
/**
* Creates a navbar item array, replacing placeholders with the given replacements.
*
* @param {Partial<NavbarItemOverrides>} [overrides]
* @returns {NavbarItem[]}
*/
export function createNavbarItems(overrides) {
const replacements = {
...DEFAULT_NAVBAR_REPLACEMENTS,
...overrides,
};
return NavbarItemsTemplate.map((item) => {
if (typeof item.to !== "string") return item;
return {
...item,
to: item.to.replace(
/{{([^}]+)}}/g,
/**
* @param {keyof NavbarItemOverrides} key
*/
(_, key) => {
return replacements[key];
},
),
};
});
}