Skip to content

Commit 1c6cd65

Browse files
committed
Add child .s-navigation--item-text element
This time without all the silly line ending noise!
1 parent f18718e commit 1c6cd65

File tree

8 files changed

+479
-129
lines changed

8 files changed

+479
-129
lines changed

docs/_data/navigation.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
"applies": "Child of <code class=\"stacks-code\">.s-navigation</code>",
3131
"description": "The individual pill-shaped link in a navigation"
3232
},
33+
{
34+
"class": ".s-navigation--item-text",
35+
"applies": "Child of <code class=\"stacks-code\">.s-navigation--item</code>",
36+
"description": "The element meant to contain the text of the navigation item"
37+
},
3338
{
3439
"class": ".is-selected",
3540
"applies": "<code class=\"stacks-code\">.s-navigation--item</code>",

docs/_includes/header.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@
99

1010
{% if site-navigation %}
1111
<nav aria-label="Global" class="sm:d-none">
12-
<ul class="s-navigation ml8 fw-nowrap sm:d-none">
12+
<ul class="s-navigation ml8 fw-nowrap">
1313
{% assign slug = page.url | replace:'/',' ' | truncatewords: 2 | remove:'...' %}
1414

1515
{% for section in site-navigation.sections %}
1616
{% assign url = section.url | replace:'/',' ' | truncatewords: 2 | remove:'...' %}
17-
<li><a class="s-navigation--item{% if url == slug %} is-selected{% endif %}" href="{{ section.url }}" {% if url == slug %} aria-current="page"{% endif %}>{{ section.title }}</a></li>
17+
<li>
18+
<a class="s-navigation--item{% if url == slug %} is-selected{% endif %}" href="{{ section.url }}" {% if url == slug %} aria-current="page"{% endif %}>
19+
<span class="s-navigation--item-text" data-text="{{ section.title }}">{{ section.title }}</span>
20+
</a>
21+
</li>
1822
{% endfor %}
1923
</ul>
2024
</nav>

docs/_includes/navigation.html

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
<div class="d-none sm:d-block">
44
<div class="d-flex fd-column ai-center">
55
{% if site-navigation %}
6-
<nav class="s-navigation s-navigation__wrap mx8 mb12 jc-center" aria-label="Global">
7-
{% assign slug = page.url | replace:'/',' ' | truncatewords: 2 | remove:'...' %}
6+
<nav aria-label="Global" class="sm:d-none">
7+
<ul class="s-navigation s-navigation__wrap mx8 mb12 jc-center">
8+
{% assign slug = page.url | replace:'/',' ' | truncatewords: 2 | remove:'...' %}
89

9-
{% for section in site-navigation.sections %}
10-
{% assign url = section.url | replace:'/',' ' | truncatewords: 2 | remove:'...' %}
11-
<a class="s-navigation--item{% if url == slug %} is-selected{% endif %}" href="{{ section.url }}">{{ section.title }}</a>
12-
{% endfor %}
10+
{% for section in site-navigation.sections %}
11+
{% assign url = section.url | replace:'/',' ' | truncatewords: 2 | remove:'...' %}
12+
<a class="s-navigation--item{% if url == slug %} is-selected{% endif %}" href="{{ section.url }}">
13+
<span class="s-navigation--item-text" data-text="{{ section.title }}">{{ section.title }}</span>
14+
</a>
15+
{% endfor %}
16+
</ul>
1317
</nav>
1418
{% endif %}
1519
</div>
@@ -30,7 +34,7 @@
3034
{% if section.links %}
3135
{% for link in section.links %}
3236
<a class="s-navigation--item {% if page.url == link.url %}is-selected{% endif %}" href="{{ link.url | url }}" {% if page.url == link.url %}aria-current="page"{% endif %}>
33-
{{ link.title }}
37+
<span class="s-navigation--item-text" data-text="{{ link.title }}">{{ link.title }}</span>
3438
</a>
3539
{% endfor %}
3640
{% endif %}

docs/_includes/topbar.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@
2222
{% if showFullNavigation %}
2323
<li>
2424
<a href="#" class="s-navigation--item">
25-
About
25+
<span class="s-navigation--item-text" data-text="About">About</span>
2626
</a>
2727
</li>
2828
<li>
2929
<a href="#" class="s-navigation--item is-selected">
30-
Products
30+
<span class="s-navigation--item-text" data-text="Products">Products</span>
3131
</a>
3232
</li>
3333
<li>
3434
<a href="#" class="s-navigation--item">
35-
For Teams
35+
<span class="s-navigation--item-text" data-text="For Teams">For Teams</span>
3636
</a>
3737
</li>
3838
{% else %}
3939
<li>
4040
<a href="#" class="s-navigation--item">
41-
Products
41+
<span class="s-navigation--item-text" data-text="Products">Products</span>
4242
</a>
4343
</li>
4444
{% endif %}

0 commit comments

Comments
 (0)