You've already forked wc-bootstrap
Make category tree items span full parent width (v0.1.9)
Move <a> elements to be direct children of the list-group so they naturally fill the full offcanvas/sidebar width. Chevron toggle moved inside the link with click interception to prevent navigation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,13 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [0.1.9] - 2026-03-29
|
||||
|
||||
### Changed
|
||||
|
||||
- **Category tree full-width items** (`category-tree-node.html.twig`): Made `<a>` elements direct children of the `list-group` so they span the full parent/offcanvas width; moved chevron toggle inside the link as a `<span>` with click interception
|
||||
- **Category tree nav wrapper** (`category-tree.html.twig`): Added `w-100` to nav and list-group containers
|
||||
|
||||
## [0.1.8] - 2026-03-29
|
||||
|
||||
### Changed
|
||||
|
||||
12
CLAUDE.md
12
CLAUDE.md
@@ -345,10 +345,20 @@ The child theme inherits from `wp-bootstrap` via WordPress `Template: wp-bootstr
|
||||
|
||||
## Version History
|
||||
|
||||
Current version: **v0.1.8**
|
||||
Current version: **v0.1.9**
|
||||
|
||||
## Session History
|
||||
|
||||
### 2026-03-29 — v0.1.9 Category Tree Full-Width Items
|
||||
|
||||
**Scope:** Made category tree items span the full parent/offcanvas width.
|
||||
|
||||
**Files modified (3):**
|
||||
|
||||
- `templates/global/category-tree.html.twig` — Added `w-100` to nav and list-group containers
|
||||
- `templates/global/category-tree-node.html.twig` — Made `<a>` elements direct children of the list-group; moved chevron toggle inside the link as a `<span>` with `event.preventDefault()` click interception
|
||||
- `style.css` — Version bump 0.1.8 → 0.1.9
|
||||
|
||||
### 2026-03-29 — v0.1.8 Restyle Category Tree to Idiomatic Bootstrap
|
||||
|
||||
**Scope:** Restyled the category tree sidebar to use Bootstrap's native `list-group-item-action` pattern with subtler active highlighting.
|
||||
|
||||
@@ -7,7 +7,7 @@ Description: A Bootstrap 5 child theme for WP Bootstrap that overrides all WooCo
|
||||
Requires at least: 6.7
|
||||
Tested up to: 6.7
|
||||
Requires PHP: 8.3
|
||||
Version: 0.1.8
|
||||
Version: 0.1.9
|
||||
License: GNU General Public License v2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
Template: wp-bootstrap
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Single Category Tree Node (recursive)
|
||||
#
|
||||
# Renders one category as a list-group-item-action link with optional
|
||||
# collapsible nested list for children. Included recursively.
|
||||
# collapsible nested children. Included recursively.
|
||||
#
|
||||
# Expected context:
|
||||
# node - Category node from wc_bootstrap_get_category_tree()
|
||||
@@ -15,33 +15,30 @@
|
||||
{% set has_children = node.children is not empty %}
|
||||
{% set is_open = node.is_active or node.is_ancestor %}
|
||||
|
||||
<div class="category-tree-item">
|
||||
<div class="d-flex align-items-center">
|
||||
<a href="{{ node.url }}"
|
||||
class="list-group-item list-group-item-action border-0 py-1 flex-grow-1{% if node.is_active %} active{% endif %}"
|
||||
style="padding-left: {{ 0.5 + (level - 1) * 1 }}rem;"
|
||||
<a href="{{ node.url }}"
|
||||
class="list-group-item list-group-item-action border-0 py-1 d-flex align-items-center{% if node.is_active %} active{% endif %}"
|
||||
style="padding-left: {{ 0.75 + (level - 1) * 1 }}rem;"
|
||||
{% if node.is_active %}aria-current="page"{% endif %}>
|
||||
{{ node.name }}
|
||||
<span class="flex-grow-1">{{ node.name }}</span>
|
||||
<small class="text-body-secondary ms-1">({{ node.count }})</small>
|
||||
</a>
|
||||
{% if has_children %}
|
||||
<button class="btn btn-sm btn-link text-body-secondary p-0 px-2 category-tree-toggle"
|
||||
type="button"
|
||||
<span class="category-tree-toggle ms-1"
|
||||
role="button"
|
||||
data-bs-toggle="collapse"
|
||||
data-bs-target="#cat-{{ node.term_id }}"
|
||||
aria-expanded="{{ is_open ? 'true' : 'false' }}"
|
||||
aria-controls="cat-{{ node.term_id }}"
|
||||
aria-label="{{ __('Toggle subcategories', 'wc-bootstrap') }}">
|
||||
aria-label="{{ __('Toggle subcategories', 'wc-bootstrap') }}"
|
||||
onclick="event.preventDefault(); event.stopPropagation();">
|
||||
<i class="bi bi-chevron-down small" aria-hidden="true"></i>
|
||||
</button>
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</a>
|
||||
|
||||
{% if has_children %}
|
||||
{% if has_children %}
|
||||
<div class="collapse{{ is_open ? ' show' : '' }}" id="cat-{{ node.term_id }}">
|
||||
{% for child in node.children %}
|
||||
{% include 'global/category-tree-node.html.twig' with { node: child, level: level + 1 } only %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
#}
|
||||
|
||||
{% if categories is not empty %}
|
||||
<nav aria-label="{{ __('Product categories', 'wc-bootstrap') }}">
|
||||
<nav class="category-tree w-100" aria-label="{{ __('Product categories', 'wc-bootstrap') }}">
|
||||
<h3 class="sidebar-heading h6 text-uppercase fw-semibold">
|
||||
{{ __('Categories', 'wc-bootstrap') }}
|
||||
</h3>
|
||||
|
||||
<div class="list-group list-group-flush category-tree">
|
||||
<div class="list-group list-group-flush w-100">
|
||||
<a href="{{ shop_url }}"
|
||||
class="list-group-item list-group-item-action border-0 px-2 py-1{% if current_cat == 0 %} active{% endif %}">
|
||||
class="list-group-item list-group-item-action border-0 py-1{% if current_cat == 0 %} active{% endif %}">
|
||||
{{ __('All products', 'wc-bootstrap') }}
|
||||
</a>
|
||||
{% for cat in categories %}
|
||||
|
||||
Reference in New Issue
Block a user