Wiki

Template:Infocard: Difference between revisions

From 2D Tower Wiki
This page was last edited on 6 October 2026, at 09:20.
Fix Infocard list rendering and document HTML list content
Gary (talk | contribs)
Add compact Infocard option for the wiki category directory; preserve default cards.
 
Line 1: Line 1:
<noinclude>
<noinclude>Reusable tower information cards. Existing calls using name, icon and text retain their default appearance. Use class=compact for the category directory. Optional id must be unique; basis controls the card's flex width. iconalt accepts existing wiki image or icon markup. Styling is contained in this template; no extension stylesheet is required.</noinclude>
This template creates a tower information card.
<includeonly><div class="tower-infocard {{{class|}}}" id="{{{id|}}}" style="flex:1 1 {{{basis|320px}}};{{#ifeq:{{{class|}}}|compact|min-width:0;box-sizing:border-box;overflow:hidden;padding:0;border:1px solid #e2aa4e;border-radius:8px;background:#f8fbff;|padding:1.25rem;border:1px solid #c8ccd1;border-radius:8px;background:#f8f9fa;box-sizing:border-box;}}">
 
<div class="tower-infocard-heading" style="{{#ifeq:{{{class|}}}|compact|display:flex;gap:0.8rem;align-items:center;justify-content:space-between;padding:0.8rem 1rem;background:#ffb12b;color:#14364b;|display:flex;gap:1rem;align-items:flex-start;justify-content:space-between;}}">
Parameters:
<div style="flex:1 1 auto;min-width:0;"><h2 style="{{#ifeq:{{{class|}}}|compact|margin:0;padding:0;border:0;font-size:1.3rem;line-height:1.25;font-weight:900;|}}">{{{name|}}}</h2></div>
* <code>name</code> - card title.
{{#if:{{{iconalt|}}}{{{icon|}}}|<div style="flex:0 0 auto;">{{{iconalt|[[File:{{{icon|}}}|64px|alt={{{name|}}} icon|link=]]}}}</div>}}
* <code>icon</code> - optional image filename, displayed on the right. For example: <code>Example.png</code>.
* <code>text</code> - card content. Use normal text or HTML/wiki markup such as <code>&lt;ul&gt;</code> and <code>&lt;li&gt;</code> for lists.
 
Example:
<pre>{{Infocard
|name=Mechanics
|icon=Example.png
|text=&lt;ul&gt;
&lt;li&gt;[[Maps]]&lt;/li&gt;
&lt;li&gt;[[Tenants]]&lt;/li&gt;
&lt;/ul&gt;
}}</pre>
</noinclude>
<includeonly>
<div class="tower-infocard" style="flex:1 1 320px; padding:1.25rem; border:1px solid #c8ccd1; border-radius:8px; background:#f8f9fa; box-sizing:border-box;">
<div style="display:flex; gap:1rem; align-items:flex-start; justify-content:space-between;">
<div style="flex:1 1 auto;"><h2>{{{name|}}}</h2></div>
{{#if:{{{icon|}}}|<div style="flex:0 0 auto;">[[File:{{{icon}}}|64px|alt={{{name|}}} icon|link=]]</div>}}
</div>
</div>
<div class="tower-infocard-content">{{{text|}}}</div>
<div class="tower-infocard-content" style="{{#ifeq:{{{class|}}}|compact|padding:1rem;|}}">
{{{text|}}}
</div>
</div>
</includeonly>
</div></includeonly>

Latest revision as of 09:20, 6 October 2026

Reusable tower information cards. Existing calls using name, icon and text retain their default appearance. Use class=compact for the category directory. Optional id must be unique; basis controls the card's flex width. iconalt accepts existing wiki image or icon markup. Styling is contained in this template; no extension stylesheet is required.