feat: align admin dashboard cards with epteam

This commit is contained in:
fromme committed 2026-11-13 12:03:39 +01:00
1 parent 558e45fe5f
commit df564c30ae
4 files changed
+78 -14

No files matched your search

+37
View File
@@ -273,6 +273,43 @@
@apply border-b last:border-b-0; @apply border-b last:border-b-0;
} }
/*
* Lists of entries in a card, as on a dashboard (components/dashboard/): one line per entry, the
* whole line is the link or button, its parts separated by a dot, the last part cut off with "…".
*/
.entry-list {
@apply divide-y divide-line;
}
.entry-list > li {
@apply py-2 first:pt-0 last:pb-0;
}
/* a work queue that would otherwise grow the card without limit; keep it rare, it scrolls awkwardly on phones */
.entry-list--scroll {
@apply max-h-64 overflow-y-auto pr-3;
}
.entry-link {
@apply flex w-full min-w-0 items-center gap-1.5 text-left text-ink no-underline;
}
:is(a, button).entry-link {
@apply hover:text-brand;
}
.entry-link > * {
@apply shrink-0 whitespace-nowrap;
}
.entry-link > :last-child {
@apply min-w-0 shrink truncate;
}
.entry-link > .entry-dot {
@apply text-muted;
}
/* notices (_partials/_alert.html.twig): light, with a coloured bar on the left */ /* notices (_partials/_alert.html.twig): light, with a coloured bar on the left */
.notice { .notice {
@apply border-l-4 px-4 py-2; @apply border-l-4 px-4 py-2;
+1 -1
View File
@@ -10,7 +10,7 @@
<twig:dashboard:widget title="{{ widget.title }}" emptyText="{{ widget.emptyText }}"> <twig:dashboard:widget title="{{ widget.title }}" emptyText="{{ widget.emptyText }}">
<twig:block name="actions"> <twig:block name="actions">
{% if widget.actionUrl %} {% if widget.actionUrl %}
<a href="{{ widget.actionUrl }}" class="text-sm font-normal text-brand">{{ widget.actionLabel }}</a> <a href="{{ widget.actionUrl }}" class="text-sm text-brand hover:underline">{{ widget.actionLabel }}</a>
{% endif %} {% endif %}
</twig:block> </twig:block>
{% for entry in widget.entries %} {% for entry in widget.entries %}
+24 -7
View File
@@ -1,13 +1,30 @@
{#-
One line of a dashboard:widget. Its text is `parts` (shown with dots between them) or the content
block; `icon` in front. With `url` the line is a link, without one but with hx-* attributes a
button (opening a modal, say), otherwise plain text.
-#}
{% set url = url ?? null %} {% set url = url ?? null %}
{% set icon = icon ?? null %} {% set icon = icon ?? null %}
{% set parts = parts ?? null %}
{% set is_button = not url and attributes.all|keys|filter(k => k starts with 'hx-')|length > 0 %}
{% set body %} {% set body %}
{% if icon %}{{ icon(icon, 'w-4 h-4 shrink-0') }}{% endif %} {% if icon %}{{ include('_partials/_icon.html.twig', {icon: icon, class: 'size-4 text-muted'}) }}{% endif %}
<span class="whitespace-nowrap">{{ block('content') }}</span> {% if parts is not null %}
{% endset %} {% for part in parts|filter(p => p is not empty) %}
<li class="py-2 first:pt-0 last:pb-0 overflow-x-hidden"> {% if not loop.first %}<span class="entry-dot" aria-hidden="true">·</span>{% endif %}
{% if url %} <span>{{ part }}</span>
<a href="{{ url }}" {{ attributes.defaults({class: 'flex items-center space-x-1'}).without('url', 'icon') }}>{{ body }}</a> {% endfor %}
{% else %} {% else %}
<div {{ attributes.defaults({class: 'flex items-center space-x-1'}).without('url', 'icon') }}>{{ body }}</div> <span>{{ block('content') }}</span>
{% endif %}
{% endset %}
{% set attrs = attributes.defaults({class: 'entry-link'}).without('url', 'icon', 'parts') %}
<li>
{% if url %}
<a href="{{ url }}" {{ attrs }}>{{ body }}</a>
{% elseif is_button %}
<button type="button" {{ attributes.defaults({class: 'entry-link', 'hx-target': 'body', 'hx-swap': 'beforeend'}).without('url', 'icon', 'parts') }}>{{ body }}</button>
{% else %}
<div {{ attrs }}>{{ body }}</div>
{% endif %} {% endif %}
</li> </li>
@@ -1,15 +1,25 @@
{#-
A card of entries, as on a dashboard. `title`; optional `meta` (a short count beside the title,
such as "3 neu, 2 in Bearbeitung"), `emptyText` and `scroll` (for work queues that would grow the
card without limit); the `actions` block goes to the right of the header, typically "alle anzeigen".
-#}
{% set emptyText = emptyText ?? 'Keine Einträge vorhanden.' %} {% set emptyText = emptyText ?? 'Keine Einträge vorhanden.' %}
{% set meta = meta ?? null %}
{% set scroll = scroll ?? false %}
{% set entries %}{% block content %}{% endblock %}{% endset %} {% set entries %}{% block content %}{% endblock %}{% endset %}
<div {{ attributes.defaults({class: 'card px-5 py-4'}).without('title', 'emptyText') }}> <section {{ attributes.defaults({class: 'card p-5'}).without('title', 'meta', 'emptyText', 'scroll') }}>
<div class="flex justify-between pb-3"> <div class="flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 pb-3">
<h2 class="section-title">{{ title }}</h2> <h2 class="section-title">{{ title }}</h2>
{% block actions %}{% endblock %} <div class="flex items-baseline gap-x-4">
{% if meta %}<span class="text-sm text-muted">{{ meta }}</span>{% endif %}
{% block actions %}{% endblock %}
</div>
</div> </div>
{% if entries|trim is empty %} {% if entries|trim is empty %}
{% block empty %} {% block empty %}
<p class="py-2 text-sm text-muted">{{ emptyText }}</p> <p class="text-sm text-muted">{{ emptyText }}</p>
{% endblock %} {% endblock %}
{% else %} {% else %}
<ul class="divide-y divide-line">{{ entries }}</ul> <ul class="entry-list {{ scroll ? 'entry-list--scroll' }}">{{ entries }}</ul>
{% endif %} {% endif %}
</div> </section>