← back to Dw Theme Hamburger
assets/dw-filter-horizontal.css
189 lines
/* ============================================================================
DW Horizontal Filter Bar — restyles Boost AI Search & Discovery filter groups
from a vertical LEFT SIDEBAR into a HORIZONTAL, collapsible bar across the
top of the product grid.
Scope: only takes effect when <body> carries the `dw-filters-horizontal`
class (added by dw-filter-horizontal.js once the Boost filter tree exists).
Replaces the old `dw-filters-collapsed` hide-entirely behavior.
Boost DOM (React-rendered):
.boost-sd__filter-tree-wrapper > .boost-sd__filter-tree (the sidebar)
.boost-sd__filter (one per group: Color, Style, Brand, …)
.boost-sd__filter-title (group label / toggle)
.boost-sd__filter-options (the option list / swatches)
.boost-sd__product-list (the grid)
============================================================================ */
/* ---- 1. Make the filter tree a horizontal row pinned above the grid ------- */
body.dw-filters-horizontal .boost-sd__filter-tree-wrapper {
display: block !important;
width: 100% !important;
max-width: 100% !important;
flex: 0 0 100% !important;
padding: 0 !important;
margin: 0 0 14px 0 !important;
border: none !important;
background: transparent !important;
}
/* The product+filter wrap is normally a side-by-side flex row; stack it so the
bar sits ABOVE the grid and the grid gets full width. */
body.dw-filters-horizontal .boost-sd__filter-products-wrap,
body.dw-filters-horizontal .boost-sd__filter-products-wrap > div {
display: block !important;
width: 100% !important;
max-width: 100% !important;
}
body.dw-filters-horizontal .boost-sd__product-list-wrapper,
body.dw-filters-horizontal .boost-sd__product-list {
width: 100% !important;
max-width: 100% !important;
flex: 1 1 100% !important;
padding-left: 0 !important;
padding-right: 0 !important;
}
/* The filter tree itself: a flex row of group chips, wrap on small screens. */
body.dw-filters-horizontal .boost-sd__filter-tree {
display: flex !important;
flex-direction: row !important;
flex-wrap: wrap !important;
align-items: stretch !important;
gap: 8px !important;
width: 100% !important;
max-width: 100% !important;
padding: 10px 12px !important;
margin: 0 !important;
background: #fff !important;
border: 1.5px solid #000 !important;
border-radius: 12px !important;
box-sizing: border-box !important;
}
/* ---- 2. Each filter group → a self-contained dropdown chip ----------------- */
body.dw-filters-horizontal .boost-sd__filter {
position: relative !important;
flex: 0 0 auto !important;
width: auto !important;
margin: 0 !important;
padding: 0 !important;
border: none !important;
border-bottom: none !important;
}
/* Group title becomes the chip face */
body.dw-filters-horizontal .boost-sd__filter-title {
display: inline-flex !important;
align-items: center !important;
gap: 6px !important;
margin: 0 !important;
padding: 7px 14px !important;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
font-size: 11px !important;
font-weight: 700 !important;
text-transform: uppercase !important;
letter-spacing: 1px !important;
color: #222 !important;
background: #f7f5f2 !important;
border: 1px solid #cfc8bd !important;
border-radius: 999px !important;
cursor: pointer !important;
white-space: nowrap !important;
user-select: none !important;
}
body.dw-filters-horizontal .boost-sd__filter-title:hover {
background: #efe9e0 !important;
}
/* The option list becomes an absolutely-positioned dropdown under the chip.
We DO NOT hide it with display:none on the Boost element (that would fight
Boost's own collapse state); instead we float it and toggle visibility via
the `dw-open` class our JS puts on the parent .boost-sd__filter. */
body.dw-filters-horizontal .boost-sd__filter-options,
body.dw-filters-horizontal .boost-sd__filter-collapsible,
body.dw-filters-horizontal .boost-sd__filter-content {
position: absolute !important;
top: calc(100% + 6px) !important;
left: 0 !important;
z-index: 60 !important;
min-width: 220px !important;
max-width: 340px !important;
max-height: 60vh !important;
overflow-y: auto !important;
padding: 12px 14px !important;
background: #fff !important;
border: 1.5px solid #000 !important;
border-radius: 10px !important;
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16) !important;
/* hidden until the group is opened */
display: none !important;
}
/* Open state — our JS toggles .dw-open on the .boost-sd__filter */
body.dw-filters-horizontal .boost-sd__filter.dw-open > .boost-sd__filter-options,
body.dw-filters-horizontal .boost-sd__filter.dw-open .boost-sd__filter-collapsible,
body.dw-filters-horizontal .boost-sd__filter.dw-open .boost-sd__filter-content {
display: block !important;
}
/* Keep swatch / option layout sane inside the dropdown */
body.dw-filters-horizontal .boost-sd__filter.dw-open .boost-sd__filter-option {
display: flex !important;
align-items: center !important;
}
/* Price ($) group can render a slider — give it room */
body.dw-filters-horizontal .boost-sd__filter.dw-open .boost-sd__filter-price,
body.dw-filters-horizontal .boost-sd__filter.dw-open [class*="price-slider"] {
min-width: 240px !important;
}
/* ---- 3. The collapse/expand toggle for the WHOLE bar ----------------------- */
.dw-hbar-toggle {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 12px;
margin: 4px 0 4px 8px;
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 1.5px;
user-select: none;
background: #fff;
border: 1.5px solid #000;
border-radius: 999px;
cursor: pointer;
vertical-align: middle;
}
.dw-hbar-toggle:hover { background: #f5f5f5; }
.dw-hbar-toggle svg { width: 14px; height: 14px; }
/* When the bar is collapsed, hide the tree wrapper and free the grid. */
body.dw-filters-horizontal.dw-hbar-collapsed .boost-sd__filter-tree-wrapper {
display: none !important;
}
/* ---- 4. Responsive: horizontal scroll instead of wrap on phones ----------- */
@media (max-width: 768px) {
body.dw-filters-horizontal .boost-sd__filter-tree {
flex-wrap: nowrap !important;
overflow-x: auto !important;
-webkit-overflow-scrolling: touch !important;
padding: 8px 10px !important;
}
body.dw-filters-horizontal .boost-sd__filter-options,
body.dw-filters-horizontal .boost-sd__filter.dw-open .boost-sd__filter-collapsible,
body.dw-filters-horizontal .boost-sd__filter.dw-open .boost-sd__filter-content {
position: fixed !important;
top: auto !important;
left: 8px !important;
right: 8px !important;
bottom: 8px !important;
min-width: 0 !important;
max-width: none !important;
max-height: 55vh !important;
}
}