Module:Infobox/Widget/Header: Difference between revisions

From TwogPedia
No edit summary
No edit summary
Line 1: Line 1:
local Header = {}
local Header = {}


function Header.make(title, image, imagedark, imageAll)
function Header.make(title, logoLight, logoDark, logoAll)
local container = mw.html.create('div')
local container = mw.html.create('div')
local title = mw.html.create('div')
local title = mw.html.create('div')
:addClass('ib-title')
:addClass('ib-title')
:wikitext(title)
:wikitext(title)
local imageURL = imageAll or image or imagedark or 'Team placeholder light.png'
local imageURL = logoAll or logoLight or logoDark or 'Team placeholder light.png'
local imageDiv = mw.html.create('div')
local imageDiv = mw.html.create('div')
:addClass('ib-image')
:addClass('ib-image')
Line 13: Line 13:
container:node(title):node(imageDiv)
container:node(title):node(imageDiv)
if imagedark and imageAll == nil then
if logoDark and logoAll == nil then
imageDiv:addClass('light')
imageDiv:addClass('light')
local imageDivDark = mw.html.create('div')
local imageDivDark = mw.html.create('div')
:addClass('ib-image dark')
:addClass('ib-image dark')
:wikitext('[[File:'.. imagedark .. '|250px]]')
:wikitext('[[File:'.. logoDark .. '|250px]]')
container:node(imageDivDark)
container:node(imageDivDark)
end
end

Revision as of 19:16, 5 May 2023

Documentation for this module may be created at Module:Infobox/Widget/Header/doc

local Header = {}

function Header.make(title, logoLight, logoDark, logoAll)
	local container = mw.html.create('div')
	local title = mw.html.create('div')
			:addClass('ib-title')
			:wikitext(title)
	local imageURL = logoAll or logoLight or logoDark or 'Team placeholder light.png'
	local imageDiv = mw.html.create('div')
			:addClass('ib-image')
			:wikitext('[[File:'.. imageURL .. '|250px]]')
			
	container:node(title):node(imageDiv)
	
	if logoDark and logoAll == nil then
		imageDiv:addClass('light')
		local imageDivDark = mw.html.create('div')
			:addClass('ib-image dark')
			:wikitext('[[File:'.. logoDark .. '|250px]]')
		container:node(imageDivDark)
	end
	
	return container
end

return Header