浏览代码

feat(navigation): Improve sidebar action button styling

Replace the grouped button wrapper with a semantic
`dropdown-item-buttons` container and render sidebar action buttons with
the `btn-ghost` style while preserving existing color support.

Scope dropdown item link styles to direct child anchors so nested action
buttons keep their intended styling, and reveal the buttons on hover,
active, and focus-within states.
Martin Hauser 2 月之前
父节点
当前提交
f027b0b206

文件差异内容过多而无法显示
+ 0 - 0
netbox/project-static/dist/netbox.css


+ 7 - 6
netbox/project-static/styles/transitional/_navigation.scss

@@ -21,21 +21,22 @@
     .dropdown-menu {
     .dropdown-menu {
       // Adjust hover color & style for menu items
       // Adjust hover color & style for menu items
       .dropdown-item {
       .dropdown-item {
-        a {
+        > a {
           color: $rich-black;
           color: $rich-black;
         }
         }
-        .btn-group {
+        .dropdown-item-buttons {
           visibility: hidden;
           visibility: hidden;
         }
         }
 
 
         // Style menu item hover/active state
         // Style menu item hover/active state
         &:hover,
         &:hover,
-        &.active {
+        &.active,
+        &:focus-within {
           background-color: var(--tblr-navbar-active-bg);
           background-color: var(--tblr-navbar-active-bg);
-          a {
+          > a {
             text-decoration: none;
             text-decoration: none;
           }
           }
-          .btn-group {
+          .dropdown-item-buttons {
             visibility: visible;
             visibility: visible;
           }
           }
         }
         }
@@ -106,7 +107,7 @@ html[data-bs-theme='dark'] .navbar-vertical.navbar-expand-lg {
 
 
   // Adjust hover color & style for menu items
   // Adjust hover color & style for menu items
   .dropdown-item {
   .dropdown-item {
-    a {
+    > a {
       color: white !important;
       color: white !important;
     }
     }
     &.active,
     &.active,

+ 3 - 3
netbox/utilities/templates/navigation/menu.html

@@ -40,12 +40,12 @@
                 {{ group.label }}
                 {{ group.label }}
               </div>
               </div>
               {% for item, buttons in items %}
               {% for item, buttons in items %}
-                <div class="dropdown-item d-flex justify-content-between ps-3 py-0">
+                <div class="dropdown-item d-flex align-items-center justify-content-between ps-3 py-0">
                   <a href="{{ item.url }}" class="d-inline-flex flex-fill py-1">{{ item.link_text }}</a>
                   <a href="{{ item.url }}" class="d-inline-flex flex-fill py-1">{{ item.link_text }}</a>
                   {% if buttons %}
                   {% if buttons %}
-                    <div class="btn-group ms-1">
+                    <div class="dropdown-item-buttons d-inline-flex ms-1">
                       {% for button in buttons %}
                       {% for button in buttons %}
-                        <a href="{{ button.url }}" class="btn btn-sm btn-{{ button.color|default:"outline" }} lh-2 px-2" title="{{ button.title }}" aria-label="{{ button.title }}">
+                        <a href="{{ button.url }}" class="btn btn-sm btn-ghost btn-{{ button.color|default:"secondary" }} px-2" title="{{ button.title }}" aria-label="{{ button.title }}">
                           <i class="{{ button.icon_class }}" aria-hidden="true"></i>
                           <i class="{{ button.icon_class }}" aria-hidden="true"></i>
                         </a>
                         </a>
                       {% endfor %}
                       {% endfor %}

部分文件因为文件数量过多而无法显示