Template:CS/products/card: Difference between revisions
Content deleted Content added
Created page with "<!-- 1) Template:CS/products/card --> <templatestyles src="CS/products/card/styles.css"/> <div class="capsach-card capsach-align-{{#switch:{{lc:{{{align|left}}}}}|center=center|right=right|#default=left}}"> <div class="capsach-card__title" role="heading" aria-level="3" title="{{{title}}}">{{{title}}}</div> <div class="capsach-card__media"> {{#if:{{{link|}}}{{{url|}}}|<a class="capsach-card__media-link" href="{{#if:{{{link|}}}|{{fullurl:{{{link}}}}}|{{{url|}}}}}">|}} {{#i..." |
No edit summary |
||
Line 2:
<templatestyles src="CS/products/card/styles.css"/>
<div class="capsach-card capsach-align-{{#switch:{{lc:{{{align|left}}}}}|center=center|right=right|#default=left}}">
<div class="capsach-
<
{{#if:{{{img|}}}
{{#if:{{{img|}}}|[[File:{{{img}}}|class=capsach-card__img|frameless|alt={{{alt|{{{title}}}}}}|link=]]|<div class="capsach-card__placeholder" role="img" aria-label="{{{alt|{{{title}}}}}}"></div>}}▼
| [[File:{{{img}}}|frameless|alt={{{alt|Product image}}}|link={{#if:{{{link|}}}|{{{link}}}|{{{url|}}}}}]]
▲
}}
</div>▼
</div>
<div class="capsach-card__cta">{{CS button▼
▲ </div>
| url={{{url|}}}▼
▲ <div class="capsach-card__cta">{{CS button
|
| mobile=full▼
| text={{{button|Check out on Etsy}}}
| width=100%▼
▲ | mobile=full
| align=left▼
▲ | width=100%
}}</div>▼
▲ | align=left
▲ }}</div>
</div>
<noinclude>
{{Documentation}}
;Template: CS/products/card
== Parameters ==
{| class="wikitable"
! Parameter !! Required !! Default !! Notes
|-
| <code>url</code> || yes* || — || External URL. Required unless <code>link</code> is provided.
Line 33:
| <code>link</code> || no || — || Internal wiki link. If set, it takes precedence over <code>url</code>.
|-
| <code>img</code> || no || — || Image filename (without <code>File:</code>). If missing, a neutral placeholder is shown.
|-
| <code>button</code> || no || <code>Check out on Etsy</code> || CTA button text (passed to {{tl|CS button}}).
|-
| <code>align</code> || no || <code>left</code> || One of <code>left</code> · <code>center</code> · <code>right</code>
|-
| <code>alt</code> || no || <code>
|}
== Behavior ==
*
* Media area enforces a **2:3 (w:h) aspect ratio**; the image fills and crops as needed.
* If neither <code>link</code> nor <code>url</code> is provided, media is non‑clickable and the CTA renders as a non‑link (per {{tl|CS button}} behavior).
▲* Width: 100% on mobile; max-width 480px on larger screens.
== Example ==
<pre>
{{CS/products/card
| url=https://etsy.com/
| img=AtomicHabits.png
| button=Check out on Etsy
}}
Line 66 ⟶ 58:
== Troubleshooting ==
* **
* **Image not full width**: ensure your image param is just the filename (no <code>File:</code>) and do not pass fixed sizes; CSS scales it to the card width.
* **No image available**: omit <code>img</code> to get the neutral placeholder (still sized 2:3).
</noinclude>
| |||