Fix admin nav selection: use !important to override text-black
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
The direct bg-stone-500 text-white classes were losing to text-black in Tailwind specificity. Use !bg-stone-500 !text-white to ensure selected admin nav items display correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -120,6 +120,10 @@ def _post_admin_nav_html(ctx: dict, *, selected: str = "") -> str:
|
||||
styles = ctx.get("styles") or {}
|
||||
nav_btn = styles.get("nav_button", "") if isinstance(styles, dict) else getattr(styles, "nav_button", "")
|
||||
|
||||
# Base and selected class for nav items
|
||||
base_cls = "justify-center cursor-pointer flex flex-row items-center gap-2 rounded bg-stone-200 text-black p-3"
|
||||
selected_cls = "justify-center cursor-pointer flex flex-row items-center gap-2 rounded !bg-stone-500 !text-white p-3"
|
||||
|
||||
parts = []
|
||||
|
||||
# External links to events / market services
|
||||
@@ -134,9 +138,10 @@ def _post_admin_nav_html(ctx: dict, *, selected: str = "") -> str:
|
||||
if not callable(url_fn):
|
||||
continue
|
||||
href = url_fn(path)
|
||||
cls = selected_cls if label == selected else (nav_btn or base_cls)
|
||||
parts.append(render("blog-admin-nav-item",
|
||||
href=href, nav_btn_class=nav_btn, label=label,
|
||||
is_selected=(label == selected), select_colours=select_colours,
|
||||
href=href, nav_btn_class=cls, label=label,
|
||||
select_colours=select_colours,
|
||||
))
|
||||
|
||||
# HTMX links
|
||||
@@ -147,9 +152,11 @@ def _post_admin_nav_html(ctx: dict, *, selected: str = "") -> str:
|
||||
("blog.post.admin.settings", "settings"),
|
||||
]:
|
||||
href = qurl(endpoint, slug=slug)
|
||||
is_sel = label == selected
|
||||
parts.append(render("nav-link",
|
||||
href=href, label=label, select_colours=select_colours,
|
||||
is_selected=(label == selected),
|
||||
is_selected=is_sel,
|
||||
aclass=(selected_cls + " " + select_colours) if is_sel else None,
|
||||
))
|
||||
|
||||
return "".join(parts)
|
||||
|
||||
Reference in New Issue
Block a user