{#- chirp-ui: Timeline component Vertical timeline for activity feeds, order tracking, audit logs. Usage: from "chirpui/timeline.html" import timeline, timeline_item timeline(items=[ {"title": "Created", "date": "Jan 1", "content": "Order placed"}, {"title": "Shipped", "date": "Jan 3", "content": "In transit"} ]) Or with slot: call timeline() timeline_item("Created", "Jan 1", "Order placed") timeline_item("Shipped", "Jan 3", "In transit") end Variants: timeline_item("Deployed", "Now", icon="◎", variant="success") timeline_item("Error", "12:05", variant="error", avatar="/img/user.jpg") timeline(hoverable=true) -#} {% def timeline(items=none, hoverable=false, cls="") %} {% set hover_class = " chirpui-timeline--hoverable" if hoverable else "" %}
{% if items %} {% for item in items %}
{% if item.avatar %} {% elif item.icon %} {% else %} {% end %}
{% if item.time %} {{ item.time }} {% end %}
{{ item.title }} {{ item.date }}
{% if item.content %}
{{ item.content }}
{% end %}
{% if item.href %}{% end %}
{% end %} {% else %} {% slot %} {% end %}
{% end %} {% def timeline_item(title, date, content=none, icon=none, avatar=none, variant="", time=none, href=none, cls="") %} {% set variant_class = " chirpui-timeline__item--" ~ variant if variant else "" %} {% set link_class = " chirpui-timeline__item--link" if href else "" %} {% end %}