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)
function Header.make(title, image, imagedark)
local title = mw.html.create('div')
local title = mw.html.create('div')
:addClass('ib-title')
:addClass('ib-title')
:wikitext(title)
:wikitext(title)
local imageDiv = mw.html.create('div')
local imageDiv = mw.html.create('div')
:addClass('ib-image')
:addClass('ib-image')
:wikitext('[[File:'.. image .. '|250px]]')
:wikitext('[[File:'.. image .. '|250px]]')
local imageDivDark = nil
if imagedark then
imageDiv:addClass('light')
imageDivDark = mw.html.create('div')
:addClass('ib-image dark')
:wikitext('[[File:'.. imagedark .. '|250px]]')
end
return mw.html.create('div'):node(title):node(imageDiv)
return mw.html.create('div'):node(title):node(imageDiv):node(imageDivDark)
end
end


return Header
return Header

Revision as of 19:19, 7 September 2022

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

local Header = {}

function Header.make(title, image, imagedark)
	local title = mw.html.create('div')
			:addClass('ib-title')
			:wikitext(title)
	
	local imageDiv = mw.html.create('div')
			:addClass('ib-image')
			:wikitext('[[File:'.. image .. '|250px]]')
	local imageDivDark = nil
	if imagedark then
		imageDiv:addClass('light')
		imageDivDark = mw.html.create('div')
			:addClass('ib-image dark')
			:wikitext('[[File:'.. imagedark .. '|250px]]')
	end
	
	return mw.html.create('div'):node(title):node(imageDiv):node(imageDivDark)
end

return Header