import type {HTML} from "../../../../common/html"; import {html} from "../../../../common/html"; import * as t from "../../../../common/translation-util"; import type {NavItem} from "../../../../common/types"; import {generateNodeFromHTML} from "../../components/base"; interface PreferenceNavProps { $root: Element; onItemSelected: (navItem: NavItem) => void; } export default class PreferenceNav { props: PreferenceNavProps; navItems: NavItem[]; $el: Element; constructor(props: PreferenceNavProps) { this.props = props; this.navItems = [ "General", "Network", "AddServer", "Organizations", "Shortcuts", ]; this.$el = generateNodeFromHTML(this.templateHTML()); this.props.$root.append(this.$el); this.registerListeners(); } templateHTML(): HTML { const navItemsHTML = html``.join( this.navItems.map( (navItem) => html`
`, ), ); return html`