drop redundant "Home" from PDP breadcrumbs
Logo already links home; breadcrumb now starts at category. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
dc8bf28892
commit
8775c2eeef
@ -13,21 +13,18 @@
|
|||||||
<main id="main-content" class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
<main id="main-content" class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
||||||
<.breadcrumb
|
<.breadcrumb
|
||||||
items={
|
items={
|
||||||
[
|
if @product.category do
|
||||||
%{label: "Home", page: "home", href: "/"}
|
[
|
||||||
] ++
|
%{
|
||||||
if @product.category do
|
label: @product.category,
|
||||||
[
|
page: "collection",
|
||||||
%{
|
href:
|
||||||
label: @product.category,
|
"/collections/#{@product.category |> String.downcase() |> String.replace(" ", "-")}"
|
||||||
page: "collection",
|
}
|
||||||
href:
|
]
|
||||||
"/collections/#{@product.category |> String.downcase() |> String.replace(" ", "-")}"
|
else
|
||||||
}
|
[]
|
||||||
]
|
end ++
|
||||||
else
|
|
||||||
[]
|
|
||||||
end ++
|
|
||||||
[%{label: @product.name, current: true}]
|
[%{label: @product.name, current: true}]
|
||||||
}
|
}
|
||||||
mode={@mode}
|
mode={@mode}
|
||||||
|
|||||||
@ -27,19 +27,12 @@ defmodule SimpleshopThemeWeb.ShopLive.ProductShowTest do
|
|||||||
assert html =~ SimpleshopTheme.Cart.format_price(product.price)
|
assert html =~ SimpleshopTheme.Cart.format_price(product.price)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "renders breadcrumb with Home link", %{conn: conn} do
|
|
||||||
product = List.first(PreviewData.products())
|
|
||||||
{:ok, _view, html} = live(conn, ~p"/products/#{product.id}")
|
|
||||||
|
|
||||||
assert html =~ "Home"
|
|
||||||
assert html =~ ~s(href="/")
|
|
||||||
end
|
|
||||||
|
|
||||||
test "renders breadcrumb with category link", %{conn: conn} do
|
test "renders breadcrumb with category link", %{conn: conn} do
|
||||||
product = List.first(PreviewData.products())
|
product = List.first(PreviewData.products())
|
||||||
{:ok, _view, html} = live(conn, ~p"/products/#{product.id}")
|
{:ok, _view, html} = live(conn, ~p"/products/#{product.id}")
|
||||||
|
|
||||||
assert html =~ product.category
|
assert html =~ product.category
|
||||||
|
assert html =~ "/collections/"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "renders add to cart button", %{conn: conn} do
|
test "renders add to cart button", %{conn: conn} do
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user