diff --git a/packages/web-twig/src/Resources/components/Breadcrumbs/Breadcrumbs.stories.twig b/packages/web-twig/src/Resources/components/Breadcrumbs/Breadcrumbs.stories.twig index 3e6b183b99..786609b7a0 100644 --- a/packages/web-twig/src/Resources/components/Breadcrumbs/Breadcrumbs.stories.twig +++ b/packages/web-twig/src/Resources/components/Breadcrumbs/Breadcrumbs.stories.twig @@ -10,4 +10,8 @@ {% include '@components/Breadcrumbs/stories/BreadcrumbsCustom.twig' %} + + {% include '@components/Breadcrumbs/stories/BreadcrumbsCurrentNotLink.twig' %} + + {% endblock %} diff --git a/packages/web-twig/src/Resources/components/Breadcrumbs/Breadcrumbs.twig b/packages/web-twig/src/Resources/components/Breadcrumbs/Breadcrumbs.twig index b0863fc480..a7e98b76b0 100644 --- a/packages/web-twig/src/Resources/components/Breadcrumbs/Breadcrumbs.twig +++ b/packages/web-twig/src/Resources/components/Breadcrumbs/Breadcrumbs.twig @@ -22,9 +22,9 @@
    {% for item in _items %} {% if loop.index is same as(_items|length - 1) and _goBackTitle is not same as('') %} - {{ _goBackTitle }} + {{ _goBackTitle }} {% endif %} - {{ item.title }} + {{ item.title }} {% endfor %}
{%- else -%} diff --git a/packages/web-twig/src/Resources/components/Breadcrumbs/BreadcrumbsItem.twig b/packages/web-twig/src/Resources/components/Breadcrumbs/BreadcrumbsItem.twig index eb22be4086..291bf81a2c 100644 --- a/packages/web-twig/src/Resources/components/Breadcrumbs/BreadcrumbsItem.twig +++ b/packages/web-twig/src/Resources/components/Breadcrumbs/BreadcrumbsItem.twig @@ -1,7 +1,7 @@ {# API #} {%- set props = props | default([]) -%} {%- set _children = block('content') -%} -{%- set _href = props.href -%} +{%- set _href = props.href | default(null) -%} {%- set _isCurrent = props.isCurrent | default(false) -%} {%- set _isGoBackOnly = props.isGoBackOnly | default(false) -%} {%- set _iconNameStart = props.iconNameStart | default(null) -%} @@ -24,14 +24,18 @@ {% if _iconNameStart %} {% endif %} - + {% if _href %} + + {{ _children }} + + {% else %} {{ _children }} - + {% endif %} {% if _isCurrent is not same as(true) and _isGoBackOnly is not same as(true) %} {% endif %} diff --git a/packages/web-twig/src/Resources/components/Breadcrumbs/README.md b/packages/web-twig/src/Resources/components/Breadcrumbs/README.md index 91a2de7a2c..5ebc211300 100644 --- a/packages/web-twig/src/Resources/components/Breadcrumbs/README.md +++ b/packages/web-twig/src/Resources/components/Breadcrumbs/README.md @@ -120,7 +120,7 @@ Use the `BreadcrumbsItem` component for the ordered list as the component's chil | Name | Type | Default | Required | Description | | ------------------ | --------------- | --------------- | -------- | ----------------------------------------------------- | | `children` | `string` | — | ✕ | Custom content to override items rendering from array | -| `href` | `string` | — | ✔ | URL | +| `href` | `string` | — | ✕ | URL, if not set, the item is rendered as a plain text | | `isCurrent` | `boolean` | `false` | ✕ | Whether is the item the current page | | `isGoBackOnly` | `boolean` | `fasle` | ✕ | Whether should be displayed in go back mode | | `iconNameEnd` | `string` | `chevron-right` | ✕ | Icon component on the end of the item wrapper | diff --git a/packages/web-twig/src/Resources/components/Breadcrumbs/stories/BreadcrumbsCurrentNotLink.twig b/packages/web-twig/src/Resources/components/Breadcrumbs/stories/BreadcrumbsCurrentNotLink.twig new file mode 100644 index 0000000000..1f537585ab --- /dev/null +++ b/packages/web-twig/src/Resources/components/Breadcrumbs/stories/BreadcrumbsCurrentNotLink.twig @@ -0,0 +1,19 @@ +{% set items = [ + { + title: 'Root', + url: '#rootUrl', + }, + { + title: 'Category', + url: '#categoryUrl', + }, + { + title: 'Subcategory', + url: '#subcategoryUrl', + }, + { + title: 'Current page', + }, +] %} + +