Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

fix(design-system): DS::Disclosure :default variant summary_content layout (#1929)

Guillem Arias Faustec8b1d8cf92fe
diff --git a/app/components/DS/disclosure.html.erb b/app/components/DS/disclosure.html.erb
index 876dc054c0..c323aa76c1 100644
--- a/app/components/DS/disclosure.html.erb
+++ b/app/components/DS/disclosure.html.erb
@@ -1,13 +1,21 @@
<%= tag.details class: details_classes, open: open, **details_opts do %>
<%= tag.summary class: summary_classes do %>
<% if summary_content? %>
- <%# `<summary>` is `display: list-item`, so a flex inner div would
- shrink-wrap to content width and any `justify-between` inside
- the slot has nothing to distribute. Wrap in a `w-full` block
- so caller-supplied flex rows stretch across the card. %>
- <div class="w-full">
+ <% if variant == :default %>
+ <%# `:default` summary is already `flex justify-between`, so
+ caller-provided sibling divs get distributed directly.
+ Wrapping would collapse them into a single flex child and
+ kill the justify-between distribution. %>
<%= summary_content %>
- </div>
+ <% else %>
+ <%# Non-default summaries are `list-item` (no flex), so a flex
+ caller div would shrink-wrap to content width and any
+ `justify-between` inside has nothing to distribute. Wrap
+ in `w-full` so caller flex rows stretch across the card. %>
+ <div class="w-full">
+ <%= summary_content %>
+ </div>
+ <% end %>
<% else %>
<div class="flex items-center gap-3">
<% if align == :left %>