Module:ElementHubNavigation: Difference between revisions
// via Wikitext Extension for VSCode |
// via Wikitext Extension for VSCode |
||
| Line 1: | Line 1: | ||
--[[ | --[[ | ||
* Name: ElementHubNavigation | * Name: ElementHubNavigation | ||
* Version: 2.0 | |||
* Author: Mark W. Datysgeld | * Author: Mark W. Datysgeld | ||
* Description: Hub navigation module for Main Page with responsive design | * Description: Hub navigation module for Main Page with responsive design | ||
* Notes: | * Notes: v2.0 uses CSS background icons (data URIs) instead of File references | ||
* Pattern: MediaWiki table syntax + string concatenation (like ElementNavigation) | * Pattern: MediaWiki table syntax + string concatenation (like ElementNavigation) | ||
* Icon Data: CSS backgrounds defined in Hubs.css - see :root custom properties | |||
]] | ]] | ||
local p = {} | local p = {} | ||
-- Hub configuration with icon | -- Hub configuration with CSS background icon identifiers | ||
-- Icon backgrounds defined in Hubs.css :root custom properties (--icon-*) | |||
local hubs = { | local hubs = { | ||
{ label = 'Nations', url = 'Hub:Nations', icon = ' | { label = 'Nations', url = 'Hub:Nations', icon = 'globe' }, | ||
{ label = 'People', url = 'Hub:People', icon = ' | { label = 'People', url = 'Hub:People', icon = 'user' }, | ||
{ label = 'Organizations', url = 'Hub:Organizations', icon = ' | { label = 'Organizations', url = 'Hub:Organizations', icon = 'building' }, | ||
{ label = 'Events', url = 'Hub:Events', icon = ' | { label = 'Events', url = 'Hub:Events', icon = 'calendar' }, | ||
{ label = 'Topics', url = 'Hub:Topics', icon = ' | { label = 'Topics', url = 'Hub:Topics', icon = 'layers' } | ||
} | } | ||
-- Generate a single hub link item | -- Generate a single hub link item with CSS background icon | ||
local function generateHubLink(hub) | local function generateHubLink(hub) | ||
local iconHtml = string.format(' | -- Icon as CSS background via data-icon attribute | ||
-- CSS: .hub-icon[data-icon="globe"] { background-image: var(--icon-globe); } | |||
local iconHtml = string.format('<span class="hub-icon" data-icon="%s" aria-hidden="true"></span>', hub.icon) | |||
return string.format( | return string.format( | ||