-
-
Notifications
You must be signed in to change notification settings - Fork 991
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
web/legible/disambiguate-footer-links
# What - Replaces the "brand links" box at the bottom of FlowExecutor with a component for showing brand links. # Why - Confusion arose about what "footer links" mean in any given context, and breaking this out, labeling it "brand-links," reduces that confusion. It also isolates and reduces the testable surface area of the Executor.
- Loading branch information
1 parent
9809b94
commit c3b33fd
Showing
2 changed files
with
55 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { purify } from "@goauthentik/common/purify"; | ||
import { AKElement } from "@goauthentik/elements/Base.js"; | ||
|
||
import { msg } from "@lit/localize"; | ||
import { css, html } from "lit"; | ||
import { customElement, property } from "lit/decorators.js"; | ||
import { map } from "lit/directives/map.js"; | ||
|
||
import PFList from "@patternfly/patternfly/components/List/list.css"; | ||
import PFBase from "@patternfly/patternfly/patternfly-base.css"; | ||
|
||
import { FooterLink } from "@goauthentik/api"; | ||
|
||
const styles = css` | ||
.pf-c-list a { | ||
color: unset; | ||
} | ||
ul.pf-c-list.pf-m-inline { | ||
justify-content: center; | ||
padding: calc(var(--pf-global--spacer--xs) / 2) 0px; | ||
} | ||
`; | ||
|
||
const salesMark: FooterLink = { name: msg("Powered by authentik"), href: "" }; | ||
|
||
@customElement("ak-brand-links") | ||
export class BrandLinks extends AKElement { | ||
static get styles() { | ||
return [PFBase, PFList, styles]; | ||
} | ||
|
||
@property({ type: Array, attribute: false }) | ||
links: FooterLink[] = []; | ||
|
||
render() { | ||
const links = [...(this.links ?? []), salesMark]; | ||
return html` <ul class="pf-c-list pf-m-inline"> | ||
${map(links, (link) => | ||
link.href | ||
? purify(html`<li><a href="${link.href}">${link.name}</a></li>`) | ||
: html`<li><span>${link.name}</span></li>`, | ||
)} | ||
</ul>`; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"ak-brand-links": BrandLinks; | ||
} | ||
} |