{# ================================================================================ Card Base Component (Kida-Native {% embed %} Showcase) ================================================================================ Reusable card component designed for use with Kida's {% embed %} directive. Provides customizable slots (blocks) for header, body, footer, and badges. This is a SHOWCASE of Kida's powerful template composition features: - {% embed %} allows including a template AND overriding its blocks - Unlike {% include %}, {% embed %} lets callers customize specific regions - Think of it like "slots" in modern component frameworks USAGE WITH {% embed %}: {% embed 'partials/components/card-base.html' with context %} {% block header %}

{{ post.title }}

{% end %} {% block body %}

{{ post.excerpt }}

{% end %} {% block footer %} {% end %} {% end %} AVAILABLE BLOCKS: - badges: Optional badges/tags area (top-right corner) - icon: Optional icon area (before header) - header: Main title/header content (required for meaningful card) - body: Main content area - footer: Bottom area for metadata, links, actions - actions: CTA buttons area (after footer) CONFIGURATION VARIABLES (passed via context): - card_class: Additional CSS classes for the card (default: '') - card_variant: Card style variant: 'default', 'feature', 'compact', 'hero' - card_href: If set, wraps the entire card in a link - card_elevation: Shadow level: 'none', 'low', 'medium', 'high' - gradient_border: Enable gradient border effect (default: false) KIDA FEATURES SHOWCASED: - {% block %} for named content slots - {% match %} for variant-based styling - Optional chaining (?.) and null coalescing (??) - {% spaceless %} for clean output - Template composition pattern ================================================================================ #} {# Configuration with defaults #} {% let variant = card_variant ?? 'default', extra_class = card_class ?? '', elevation = card_elevation ?? 'low', href = card_href ?? '', has_gradient = gradient_border ?? false %} {# Build CSS classes based on configuration #} {% let card_classes = ['card', 'card--' ~ variant] %} {% if extra_class %}{% let card_classes = card_classes + [extra_class] %}{% end %} {% if elevation != 'none' %}{% let card_classes = card_classes + ['card--elevation-' ~ elevation] %}{% end %} {% if has_gradient %}{% let card_classes = card_classes + ['gradient-border'] %}{% end %} {# Render card structure #} {% if href %} {% else %}
{% end %} {# Badges slot (optional) - top corner for tags, status indicators #}
{% block badges %}{% end %}
{# Icon slot (optional) - visual indicator before content #} {% block icon %}{% end %} {# Header slot - title area #}
{% block header %}

Card Title

{% end %}
{# Body slot - main content area #}
{% block body %}

Card content goes here.

{% end %}
{# Footer slot - metadata, timestamps, secondary info #}
{% block footer %}{% end %}
{# Actions slot - CTA buttons, links #}
{% block actions %}{% end %}
{% if href %}
{% else %}
{% end %}