Skip to content

Commit 734d224

Browse files
authored
fix: tab items css refactoring (#1495)
1 parent 9bc26f2 commit 734d224

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

src/unfold/static/unfold/css/styles.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/unfold/templates/unfold/helpers/tab_items.html

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,22 @@
11
{% load i18n %}
22

33
{% if inlines_list or tabs_list %}
4-
<nav class="bg-base-100 flex flex-col font-medium gap-1 p-1 rounded-default w-full dark:border-base-700 md:flex-row md:w-auto dark:bg-white/[.04]">
4+
<nav class="bg-base-100 flex flex-col font-medium gap-1 p-1 rounded-default w-full dark:border-base-700 md:flex-row md:w-auto dark:bg-white/[.04] *:flex *:flex-row *:font-medium *:items-center *:px-2.5 *:py-[5px] *:rounded-default *:transition-colors *:hover:bg-base-700/[.04] *:dark:hover:bg-white/[.04] [&>.active]:bg-white [&>.active]:shadow-xs [&>.active]:text-font-important-light [&>.active]:hover:bg-white [&>.active]:dark:bg-base-900 [&>.active]:dark:hover:bg-base-900 [&>.active]:dark:text-font-important-dark">
55
{% for item in tabs_list %}
66
{% if item.has_permission %}
7-
<a href="{% if item.link_callback %}{{ item.link_callback }}{% else %}{{ item.link }}{% endif %}{% if item.inline %}#{{ item.inline|slugify }}{% endif %}"
8-
class="flex flex-row font-medium items-center px-2.5 py-[5px] rounded-default transition-colors
9-
{% if item.active and not item.inline %}
10-
bg-white shadow-xs text-font-important-light hover:bg-white dark:bg-base-900 dark:hover:bg-base-900 dark:text-font-important-dark
11-
{% else %}
12-
hover:bg-base-700/[.04] dark:hover:bg-white/[.04]
13-
{% endif %}"
14-
{% if item.inline %}
15-
x-on:click="activeTab = '{{ item.inline|slugify }}'"
16-
x-bind:class="{'bg-base-100 text-primary-600 hover:text-primary-500 dark:text-primary-500 dark:bg-white/[.06]': activeTab == '{{ item.inline|slugify }}'}"
17-
{% endif %}
18-
>
7+
<a href="{% if item.link_callback %}{{ item.link_callback }}{% else %}{{ item.link }}{% endif %}{% if item.inline %}#{{ item.inline|slugify }}{% endif %}" class="{% if item.active and not item.inline %}active{% endif %}" {% if item.inline %}x-on:click="activeTab = '{{ item.inline|slugify }}'" x-bind:class="{'active': activeTab == '{{ item.inline|slugify }}'}"{% endif %}>
198
{{ item.title }}
209
</a>
2110
{% endif %}
2211
{% endfor %}
2312

2413
{% if inlines_list %}
25-
<a class="flex flex-row items-center px-2.5 py-[5px] rounded-default transition-colors"
26-
href="#general"
27-
x-on:click="activeTab = 'general'"
28-
x-bind:class="{'bg-white shadow-xs text-font-important-light hover:bg-white dark:bg-base-900 dark:hover:bg-base-900 dark:text-font-important-dark': activeTab == 'general', 'hover:bg-base-700/[.04] dark:hover:bg-white/[.04]': activeTab != 'general'}">
14+
<a href="#general" x-on:click="activeTab = 'general'" x-bind:class="{'active': activeTab == 'general'}">
2915
{% trans "General" %}
3016
</a>
3117

3218
{% for inline in inlines_list %}
33-
<a class="flex flex-row items-center px-2.5 py-[5px] rounded-default transition-colors"
34-
href="#{{ inline.formset.prefix|slugify }}"
35-
x-on:click="activeTab = '{{ inline.formset.prefix|slugify }}'"
36-
x-bind:class="{'bg-white shadow-xs text-font-important-light hover:bg-white dark:bg-base-900 dark:hover:bg-base-900 dark:text-font-important-dark': activeTab == '{{ inline.formset.prefix|slugify }}', 'hover:bg-base-700/[.04] dark:hover:bg-white/[.04]': activeTab != '{{ inline.formset.prefix|slugify }}'}">
19+
<a href="#{{ inline.formset.prefix|slugify }}" x-on:click="activeTab = '{{ inline.formset.prefix|slugify }}'" x-bind:class="{'active': activeTab == '{{ inline.formset.prefix|slugify }}'}">
3720
{% if inline.formset.max_num == 1 %}
3821
{{ inline.opts.verbose_name|capfirst }}
3922
{% else %}

0 commit comments

Comments
 (0)