Module:Infobox/Widget/Header: Difference between revisions

From TwogPedia
No edit summary
mNo edit summary
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
local Header = {}
local Header = {}


function Header.make(title, image)
function Header.make(title, logoLight, logoDark, logoAll)
local container = mw.html.create('div')
local title = mw.html.create('div')
local title = mw.html.create('div')
:addClass('infobox-title')
:addClass('ib-title')
:wikitext(title)
:wikitext(title)
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('infobox-image')
:addClass('ib-image')
:wikitext('[[File:'.. image .. '|250px]]')
:wikitext('[[File:'.. imageURL .. '|250px|link=]]')
-- local image = mw.html.create('img')
-- :attr('src', image)
container:node(title):node(imageDiv)
-- :attr()
return {
if logoDark and logoAll == nil then
mw.html.create('div'):node(title):node(imageDiv)
imageDiv:addClass('light')
}
local imageDivDark = mw.html.create('div')
:addClass('ib-image dark')
:wikitext('[[File:'.. logoDark .. '|250px|link=]]')
container:node(imageDivDark)
end
return container
end
end


return Header
return Header

Latest revision as of 08:40, 11 March 2024

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|link=]]')
			
	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|link=]]')
		container:node(imageDivDark)
	end
	
	return container
end

return Header