diff --git a/web/components.lock.json b/web/components.lock.json index fe51488..0d4f101 100644 --- a/web/components.lock.json +++ b/web/components.lock.json @@ -1 +1,2 @@ -[] +[ +] diff --git a/web/components.yml b/web/components.yml index 8a885fb..0b2e70b 100644 --- a/web/components.yml +++ b/web/components.yml @@ -12,7 +12,6 @@ local_components: - login-gate - api-client - - side-nav - logout-button - side-panel - date-display @@ -25,7 +24,10 @@ local_components: # - name: vpc-panel # → components/vpc-panel/ # repo: https://git.g3e.fr/team-reseau/vpc-panel # ref: v1.2.0 # tag, branch or commit (default: main) -components: [] +components: + - name: side-nav + repo: https://git.g3e.fr/syonad/syn-side-nav + ref: main # Vendor libraries — downloaded into web/vendor/ at build time (gitignored). # Components import them via relative paths, never via components.json. diff --git a/web/components/side-nav/side-nav.js b/web/components/side-nav/side-nav.js index ac49d79..7ccfadf 100644 --- a/web/components/side-nav/side-nav.js +++ b/web/components/side-nav/side-nav.js @@ -16,19 +16,17 @@ const CHEVRON_ICON = ` ` -const ICONS = { - dashboard: ``, - vpc: ``, - subnet: ``, - vm: ``, -} +const CSS = new URL('./side-nav.css', import.meta.url).href +const MQ = window.matchMedia('(max-width: 768px)') +const NAV_W = 220 // px -const CSS = new URL('./side-nav.css', import.meta.url).href -const MQ = window.matchMedia('(max-width: 768px)') -const NAV_W = 220 // px +const ICON_FALLBACK = `` + +const iconsRes = await fetch('./icons.json') +const ICONS = iconsRes.ok ? await iconsRes.json() : {} function resolveIcon(name) { - return ICONS[name] ?? `` + return ICONS[name] ?? ICON_FALLBACK } class SideNav extends HTMLElement { diff --git a/web/icons.json b/web/icons.json new file mode 100644 index 0000000..a9777cc --- /dev/null +++ b/web/icons.json @@ -0,0 +1,7 @@ +{ + "dashboard": "", + "vpc": "", + "subnet": "", + "vm": "", + "account": "" +}