-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds nav_item pattern for tabs for breaking change to parent theme (#61)
Co-authored-by: “Kerry <“kmurphychi@gmail.com”>
- Loading branch information
1 parent
80fb46d
commit fa3015f
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
nav_item: | ||
label: "(Nav item)" | ||
description: "Internal: to be used in the 'nav' components (nav, navbar-nav, etc)." | ||
links: | ||
- 'https://getbootstrap.com/docs/5.3/components/navs-tabs/' | ||
category: "Navs and tabs" | ||
settings: | ||
active: | ||
type: "boolean" | ||
label: "Active link" | ||
description: "Css class for whether the link corresponds to the current url." | ||
disabled: | ||
type: "boolean" | ||
label: "Disabled link" | ||
description: "Html attribute to render the link unclickable." | ||
toggle: | ||
type: "machine_name" | ||
label: "Toggle" | ||
description: "The HTML ID of the pane to activate." | ||
fields: | ||
link: | ||
type: "render" | ||
label: "Link" | ||
description: "The link item." | ||
preview: | ||
type: 'html_tag' | ||
tag: 'a' | ||
value: 'Link' | ||
attributes: | ||
href: 'https://example.com' |
3 changes: 3 additions & 0 deletions
3
templates/patterns/nav_item/pattern-nav-item--preview.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<ul class="nav"> | ||
{{ include('pattern-nav-item.html.twig') }} | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<li{{ attributes.addClass('nav-item') }}> | ||
{% set link = active ? link|add_class('active') : link %} | ||
{% set link = disabled ? link|add_class('disabled') : link %} | ||
{% set link = toggle ? link|set_attribute('role', 'tab')|set_attribute('data-bs-toggle', 'tab') : link %} | ||
{% set link = toggle ? link|set_attribute('aria-controls', toggle)|set_attribute('data-bs-target', '#' ~ toggle) : link %} | ||
{{ link|add_class('nav-link') }} | ||
</li> |