Module:InfoboxNeue/example

From IxWiki
Revision as of 18:21, 19 June 2023 by sc>Alistair3149
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation for this module may be created at Module:InfoboxNeue/example/doc

local p = {}
local infobox = require( 'Module:InfoboxNeue' ):new()

function p.makeComponentsExample()
	local sectionTable = {}

	infobox:renderImage( 'Pico at New Babbage 1 1.jpg' )
	infobox:renderIndicator( {
		data = 'Indicator',
		desc = 'Indicator message',
	} )
	infobox:renderHeader( {
		title = 'Title',
		subtitle = 'Subtitle'
	} )

	sectionTable = {
		infobox:renderItem( {
			label = 'Item label',
			data = 'Item data'
		} ),
		infobox:renderItem( {
			label = 'Item label',
			data = 'Item data'
		} ),
		infobox:renderItem( {
			label = 'Item label',
			data = 'Item data'
		} )
	}
	
	infobox:renderSection( {
		content = table.concat( sectionTable ),
		col = 2
	} )
	
	infobox:renderSection( {
		title = 'Section title',
		content = table.concat( sectionTable ),
		col = 3
	} )

	return infobox:renderInfobox()
end

function p.makeRowSection()
	local sectionTable = {}

	sectionTable = {
		infobox:renderItem( {
			label = 'Bacon',
			data = 'Good',
			row = true,
			spacebetween = true
		} ),
		infobox:renderItem( {
			label = 'Pancetta',
			data = 'Great',
			row = true,
			spacebetween = true
		} ),
		infobox:renderItem( {
			label = 'Prosciutto',
			data = 'Wonderful',
			row = true,
			spacebetween = true
		} )
	}
	
	infobox:renderSection( {
		title = 'Row layout',
		subtitle = 'This is an example of the row layout.',
		content = table.concat( sectionTable )
	} )

	return infobox:renderInfobox()
end

function p.makeListSection()
	local sectionTable = {}

	sectionTable = {
		infobox:renderItem( {
			data = 'Bacon is good',
			desc = 'Bacon ipsum dolor amet burgdoggen boudin spare ribs pork pork chop drumstick beef. Jowl turkey pork, kevin shankle shank shoulder. ',
		} ),
		infobox:renderItem( {
			data = 'Pancetta is great',
			desc = 'Kevin pig fatback, alcatra pancetta sirloin venison tri-tip shankle kielbasa meatloaf spare ribs beef. Corned beef salami kielbasa tenderloin swine spare ribs andouille.',
		} ),
		infobox:renderItem( {
			data = 'Prosciutto is wonderful',
			desc = 'Venison chicken meatloaf, ground round swine short ribs shankle short loin tenderloin jerky capicola. Prosciutto venison sirloin beef brisket pancetta.',
		} )
	}
	
	infobox:renderSection( {
		title = 'List layout',
		subtitle = 'This is an example of the list layout.',
		content = table.concat( sectionTable )
	} )

	return infobox:renderInfobox()
end

function p.makeGridSection()
	local sectionTable = {}

	sectionTable = {
		infobox:renderItem( {
			label = 'Bacon',
			data = 'Good'
		} ),
		infobox:renderItem( {
			label = 'Pancetta',
			data = 'Great'
		} ),
		infobox:renderItem( {
			label = 'Prosciutto',
			data = 'Wonderful'
		} ),
		infobox:renderItem( {
			label = 'Capicola',
			data = 'Delightful'
		} )
	}
	
	infobox:renderSection( {
		title = '2 col grid layout',
		subtitle = 'This is an example of the two column grid layout.',
		content = table.concat( sectionTable ),
		col = 2
	} )
	
	infobox:renderSection( {
		title = '3 col grid layout',
		subtitle = 'This is an example of the three column grid layout.',
		content = table.concat( sectionTable ),
		col = 3
	} )
	
	infobox:renderSection( {
		title = '4 col grid layout',
		subtitle = 'This is an example of the four column grid layout.',
		content = table.concat( sectionTable ),
		col = 4
	} )

	return infobox:renderInfobox()
end
	
return p