|
78 | 78 |
|
79 | 79 | <%# ── Locale Tabs ── %> |
80 | 80 | <% if @blocks_by_locale.present? %> |
81 | | - <% active_locale = @blocks_by_locale.key?(@content_block.locale.to_s) ? @content_block.locale.to_s : @blocks_by_locale.keys.first %> |
82 | 81 | <div class="rounded-xl border border-border/60 overflow-hidden" data-controller="ruby-cms--locale-tabs"> |
83 | | - <div class="flex gap-1 p-2 bg-muted/30 border-b border-border/60" role="tablist"> |
84 | | - <% @blocks_by_locale.each do |locale_s, _| %> |
85 | | - <% selected = locale_s == active_locale %> |
| 82 | + <div class="flex gap-1 p-2 bg-background border-b border-border/60" role="tablist"> |
| 83 | + <% @blocks_by_locale.each_with_index do |(locale_s, _), idx| %> |
86 | 84 | <button type="button" |
87 | 85 | role="tab" |
88 | | - aria-selected="<%= selected %>" |
| 86 | + aria-selected="<%= idx == 0 %>" |
89 | 87 | aria-controls="locale-panel-<%= locale_s %>" |
90 | 88 | id="locale-tab-<%= locale_s %>" |
91 | 89 | data-ruby-cms--locale-tabs-target="tab" |
92 | 90 | data-panel-id="locale-panel-<%= locale_s %>" |
93 | | - data-active-classes="bg-background text-primary shadow-sm ring-1 ring-border/60" |
94 | | - data-inactive-classes="bg-transparent text-muted-foreground hover:bg-muted hover:text-foreground" |
95 | 91 | data-action="click->ruby-cms--locale-tabs#switchTab" |
96 | | - class="px-3 py-1.5 rounded-md text-xs font-medium border-none cursor-pointer transition-colors <%= selected ? 'bg-background text-primary shadow-sm ring-1 ring-border/60' : 'bg-transparent text-muted-foreground hover:bg-muted hover:text-foreground' %>"> |
| 92 | + class="px-3 py-1.5 rounded-md text-xs font-medium border-none cursor-pointer transition-colors <%= idx == 0 ? 'bg-background text-primary shadow-sm ring-1 ring-border/60' : 'bg-transparent text-muted-foreground hover:bg-muted hover:text-foreground' %>"> |
97 | 93 | <%= ruby_cms_locale_display_name(locale_s) %> |
98 | 94 | </button> |
99 | 95 | <% end %> |
100 | 96 | </div> |
101 | 97 |
|
102 | | - <% @blocks_by_locale.each do |locale_s, block| %> |
103 | | - <% selected = locale_s == active_locale %> |
| 98 | + <% @blocks_by_locale.each_with_index do |(locale_s, block), idx| %> |
104 | 99 | <div id="locale-panel-<%= locale_s %>" |
105 | 100 | role="tabpanel" |
106 | 101 | aria-labelledby="locale-tab-<%= locale_s %>" |
107 | | - class="p-5 <%= selected ? '' : 'hidden' %>" |
| 102 | + class="p-5 <%= idx > 0 ? 'hidden' : '' %>" |
108 | 103 | data-locale-panel> |
109 | 104 |
|
110 | 105 | <%= hidden_field_tag "content_block[locales][#{locale_s}][locale]", locale_s %> |
|
209 | 204 | <div class="space-y-3"> |
210 | 205 | <% @blocks_by_locale.each do |locale_s, block| %> |
211 | 206 | <% next if block.title.blank? && block.content_body.blank? %> |
212 | | - <div class="py-1"> |
213 | | - <span class="text-[10px] font-semibold uppercase tracking-wide text-muted-foreground"><%= ruby_cms_locale_display_name(locale_s) %></span> |
| 207 | + <div class="rounded-lg border border-border/60 bg-background p-3"> |
| 208 | + <span class="inline-flex items-center rounded-md bg-background px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground ring-1 ring-border/60 mb-2"><%= ruby_cms_locale_display_name(locale_s) %></span> |
214 | 209 | <% if block.title.present? %> |
215 | 210 | <p class="text-xs font-medium text-foreground"><%= block.title %></p> |
216 | 211 | <% end %> |
|
0 commit comments