Skip to content

Commit c8777e3

Browse files
authored
Merge pull request #252 from hashicorp/melsumner/docs-section-links
adds section links in docs
2 parents df14834 + bbe597e commit c8777e3

File tree

17 files changed

+85
-88
lines changed

17 files changed

+85
-88
lines changed

packages/components/tests/dummy/app/styles/app.scss

+3
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ body.dummy-app {
212212
border-color: #f5c6cb;
213213
}
214214

215+
.dummy-link-section {
216+
text-decoration: none;
217+
}
215218

216219
// Percy (percySnapshot) doesn't allow to target specific DOM elements, so we have to "blacklist" the elements
217220
// that we want to exclude from the snapshots using their own "Percy-specific CSS".

packages/components/tests/dummy/app/templates/components/badge.hbs

+9-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<h2 class="dummy-h2">Badge</h2>
44

55
<section>
6-
<h3 class="dummy-h3">Component API</h3>
6+
<h3 class="dummy-h3" id="component-api"><a href="#component-api" class="dummy-link-section">§</a> Component API</h3>
77
<p class="dummy-paragraph" id="component-api-badge">Here is the API for the component:</p>
88
<dl class="dummy-component-props" aria-labelledby="component-api-badge">
99
<dt>size <code>enum</code></dt>
@@ -63,7 +63,7 @@
6363
</section>
6464

6565
<section>
66-
<h3 class="dummy-h3">How to use</h3>
66+
<h3 class="dummy-h3" id="how-to-use"><a href="#how-to-use" class="dummy-link-section">§</a> How to use</h3>
6767
<p class="dummy-paragraph">Invocation of the component would look something like this:</p>
6868
{{! prettier-ignore-start }}
6969
<CodeBlock
@@ -76,7 +76,8 @@
7676
</section>
7777

7878
<section>
79-
<h3 class="dummy-h3">Design guidelines</h3>
79+
<h3 class="dummy-h3" id="design-guidelines"><a href="#design-guidelines" class="dummy-link-section">§</a>
80+
Design guidelines</h3>
8081

8182
<div class="dummy-design-guidelines">
8283
<p class="dummy-paragraph"><a href="https://www.figma.com/file/noyY6dUMDYjmySpHcMjhkN/?node-id=2%3A8">Figma UI Kit</a></p>
@@ -86,7 +87,7 @@
8687
</section>
8788

8889
<section data-test-percy>
89-
<h3 class="dummy-h3">Showcase</h3>
90+
<h3 class="dummy-h3" id="showcase"><a href="#showcase" class="dummy-link-section">§</a> Showcase</h3>
9091
<h4 class="dummy-h4">Content</h4>
9192
<div class="dummy-badge-base-sample">
9293
<Hds::Badge @text="Only text" />
@@ -149,7 +150,8 @@
149150
<h2 class="dummy-h2">BadgeCount</h2>
150151

151152
<section>
152-
<h3 class="dummy-h3">Component API</h3>
153+
<h3 class="dummy-h3" id="bc-component-api"><a href="#bc-component-api" class="dummy-link-section">§</a>
154+
Component API</h3>
153155
<p class="dummy-paragraph" id="component-api-badge-count">Here is the API for the component:</p>
154156
<dl class="dummy-component-props" aria-labelledby="component-api-badge-count">
155157
<dt>size <code>enum</code></dt>
@@ -190,7 +192,7 @@
190192
</section>
191193

192194
<section>
193-
<h3 class="dummy-h3">How to use</h3>
195+
<h3 class="dummy-h3" id="bc-how-to-use"><a href="#bc-how-to-use" class="dummy-link-section">§</a> How to use</h3>
194196
<p class="dummy-paragraph">Invocation of the component would look something like this:</p>
195197
{{! prettier-ignore-start }}
196198
<CodeBlock
@@ -203,7 +205,7 @@
203205
</section>
204206

205207
<section data-test-percy>
206-
<h3 class="dummy-h3">Showcase</h3>
208+
<h3 class="dummy-h3" id="bc-showcase"><a href="#bc-showcase" class="dummy-link-section">§</a> Showcase</h3>
207209

208210
<h4 class="dummy-h4">Content</h4>
209211
<div class="dummy-badge-base-sample">

packages/components/tests/dummy/app/templates/components/breadcrumb.hbs

+6-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</section>
1515

1616
<section>
17-
<h3 class="dummy-h3">Component API</h3>
17+
<h3 class="dummy-h3" id="component-api"><a href="#component-api" class="dummy-link-section">§</a> Component API</h3>
1818
<p class="dummy-paragraph">The
1919
<code class="dummy-code">Breadcrumb</code>
2020
component is composed by different parts, with their own APIs:</p>
@@ -95,7 +95,7 @@
9595
</section>
9696

9797
<section>
98-
<h3 class="dummy-h3">How to use</h3>
98+
<h3 class="dummy-h3" id="how-to-use"><a href="#how-to-use" class="dummy-link-section">§</a> How to use</h3>
9999
<p class="dummy-paragraph">The breadcrumb is a high-level UI element, so it's likely that it will be implemented once
100100
per application, and then never changed (apart from follow-up redesigns/improvements). Below we give a couple of
101101
examples to give a general overview and show how it works.</p>
@@ -187,7 +187,8 @@
187187
</section>
188188

189189
<section>
190-
<h3 class="dummy-h3">Design guidelines</h3>
190+
<h3 class="dummy-h3" id="design-guidelines"><a href="#design-guidelines" class="dummy-link-section">§</a>
191+
Design guidelines</h3>
191192

192193
<div class="dummy-design-guidelines">
193194
<p class="dummy-paragraph"><a
@@ -201,7 +202,7 @@
201202
</section>
202203

203204
<section data-test-percy>
204-
<h3 class="dummy-h3">Showcase</h3>
205+
<h3 class="dummy-h3" id="showcase"><a href="#showcase" class="dummy-link-section">§</a> Showcase</h3>
205206

206207
<h4 class="dummy-h4">Variants</h4>
207208

@@ -361,7 +362,7 @@
361362
</section>
362363

363364
<section>
364-
<h3 class="dummy-h3">Known issues</h3>
365+
<h3 class="dummy-h3" id="known-issues"><a href="#known-issues">§</a> Known issues</h3>
365366
<p class="dummy-paragraph">The
366367
<code class="dummy-code">Breadcrumb</code>
367368
component is composed by different parts, with their own APIs:</p>

packages/components/tests/dummy/app/templates/components/button.hbs

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<DummyLinkCtaButtonBanner />
66

77
<section>
8-
<h3 class="dummy-h3">Component API</h3>
8+
<h3 class="dummy-h3" id="component-api"><a href="#component-api" class="dummy-link-section">§</a> Component API</h3>
99
<p class="dummy-paragraph" id="component-api-button">Here is the API for the component:</p>
1010
<dl class="dummy-component-props" aria-labelledby="component-api-button">
1111
<dt>size <code>enum</code></dt>
@@ -84,7 +84,7 @@
8484
</section>
8585

8686
<section>
87-
<h3 class="dummy-h3">How to use</h3>
87+
<h3 class="dummy-h3" id="how-to-use"><a href="#how-to-use" class="dummy-link-section">§</a> How to use</h3>
8888
<p class="dummy-paragraph">
8989
The button component is used to trigger an action or event. For accessibility, buttons should not be used to route
9090
to a URL.</p>
@@ -291,7 +291,8 @@
291291
</section>
292292

293293
<section>
294-
<h3 class="dummy-h3">Design guidelines</h3>
294+
<h3 class="dummy-h3" id="design-guidelines"><a href="#design-guidelines" class="dummy-link-section">§</a>
295+
Design guidelines</h3>
295296

296297
<div class="dummy-design-guidelines">
297298
<p class="dummy-paragraph"><a
@@ -305,7 +306,7 @@
305306
</section>
306307

307308
<section data-test-percy>
308-
<h3 class="dummy-h3">Showcase</h3>
309+
<h3 class="dummy-h3" id="showcase"><a href="#showcase" class="dummy-link-section">§</a> Showcase</h3>
309310
<h4 class="dummy-h4">Content</h4>
310311
<div class="dummy-button-base-sample">
311312
<Hds::Button @text="Only text" />

packages/components/tests/dummy/app/templates/components/card.hbs

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<h2 class="dummy-h2">Card container</h2>
44

55
<section>
6-
<h3 class="dummy-h3">Component API</h3>
6+
<h3 class="dummy-h3" id="component-api"><a href="#component-api" class="dummy-link-section">§</a> Component API</h3>
77
<p class="dummy-paragraph" id="component-api-card">Here is the API for the component:</p>
88
<dl class="dummy-component-props" aria-labelledby="component-api-card">
99
<dt>level <code>enum</code></dt>
@@ -54,7 +54,7 @@
5454
</section>
5555

5656
<section>
57-
<h3 class="dummy-h3">How to use</h3>
57+
<h3 class="dummy-h3" id="how-to-use"><a href="#how-to-use" class="dummy-link-section">§</a> How to use</h3>
5858
<p class="dummy-paragraph">Invocation of the component would look something like this:</p>
5959
{{! prettier-ignore-start }}
6060
<CodeBlock
@@ -68,16 +68,17 @@
6868

6969
<section>
7070
<div class="dummy-design-guidelines">
71-
<h3 class="dummy-h3">Design guidelines</h3>
71+
<h3 class="dummy-h3" id="design-guidelines"><a href="#design-guidelines" class="dummy-link-section">§</a>
72+
Design guidelines</h3>
7273
<p class="dummy-paragraph"><a href="https://www.figma.com/file/noyY6dUMDYjmySpHcMjhkN/?node-id=2%3A11">Figma UI Kit</a></p>
7374
<br />
7475
<img class="dummy-figma-docs" src="/assets/images/card-container-design-usage.png" alt="" role="none" />
7576
</div>
7677
</section>
7778

7879
<section>
80+
<h3 class="dummy-h3" id="accessibility"><a href="#accessibility" class="dummy-link-section">§</a> Accessibility</h3>
7981
<p class="dummy-paragraph">
80-
<h3 class="dummy-h3">Accessibility</h3>
8182
By default, the
8283
<em>Card Container</em>
8384
component has
@@ -87,7 +88,7 @@
8788
</section>
8889

8990
<section data-test-percy>
90-
<h3 class="dummy-h3">Showcase</h3>
91+
<h3 class="dummy-h3" id="showcase"><a href="#showcase" class="dummy-link-section">§</a> Showcase</h3>
9192
<h4 class="dummy-h4">Level:</h4>
9293
<div class="dummy-card-base-sample">
9394
{{#each @model.CONTAINER_LEVELS as |level|}}

packages/components/tests/dummy/app/templates/components/dropdown.hbs

+6-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</section>
1212

1313
<section>
14-
<h3 class="dummy-h3" id="section-component-api">Component API</h3>
14+
<h3 class="dummy-h3" id="component-api"><a href="#component-api" class="dummy-link-section">§</a> Component API</h3>
1515
<p class="dummy-paragraph">The
1616
<code class="dummy-code">Dropdown</code>
1717
component is composed of different child components, each with their own APIs:</p>
@@ -284,7 +284,7 @@
284284
</section>
285285

286286
<section>
287-
<h3 class="dummy-h3" id="section-usage">How to use</h3>
287+
<h3 class="dummy-h3" id="how-to-use"><a href="#how-to-use" class="dummy-link-section">§</a> How to use</h3>
288288
<h4 class="dummy-h4">Invocation</h4>
289289
<p class="dummy-paragraph">To make the invocation more intuitive for developers, we've provided contextual components
290290
for the toggles and list-item items. For example,
@@ -683,7 +683,8 @@
683683
</section>
684684

685685
<section>
686-
<h3 class="dummy-h3">Design guidelines</h3>
686+
<h3 class="dummy-h3" id="design-guidelines"><a href="#design-guidelines" class="dummy-link-section">§</a>
687+
Design guidelines</h3>
687688

688689
<div class="dummy-design-guidelines">
689690
<p class="dummy-paragraph"><a
@@ -698,7 +699,7 @@
698699
</section>
699700

700701
<section>
701-
<h3 class="dummy-h3" id="section-accessibility">Accessibility</h3>
702+
<h3 class="dummy-h3" id="accessibility"><a href="#accessibility" class="dummy-link-section">§</a> Accessibility</h3>
702703
<p class="dummy-paragraph">This component has been designed and implemented with accessibility in mind. When used as
703704
designed, there should not be any accessibility issues with this component.
704705
</p>
@@ -817,7 +818,7 @@
817818
</section>
818819

819820
<section data-test-percy>
820-
<h3 class="dummy-h3" id="section-showcase">Showcase</h3>
821+
<h3 class="dummy-h3" id="showcase"><a href="#showcase" class="dummy-link-section">§</a> Showcase</h3>
821822

822823
<h4 class="dummy-h4">Toggles</h4>
823824
<h5 class="dummy-h5">Toggle::Button</h5>

packages/components/tests/dummy/app/templates/components/icon-tile.hbs

+5-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<h2 class="dummy-h2">IconTile</h2>
44

55
<section>
6-
<h3 class="dummy-h3">Component API</h3>
6+
<h3 class="dummy-h3" id="component-api"><a href="#component-api" class="dummy-link-section">§</a> Component API</h3>
77
<p class="dummy-paragraph" id="component-api-icontile">Here is the API for the component:</p>
88
<dl class="dummy-component-props" aria-labelledby="component-api-icontile">
99
<dt>size <code>enum</code></dt>
@@ -65,7 +65,7 @@
6565
</section>
6666

6767
<section>
68-
<h3 class="dummy-h3">How to use</h3>
68+
<h3 class="dummy-h3" id="how-to-use"><a href="#how-to-use" class="dummy-link-section">§</a> How to use</h3>
6969
<p class="dummy-paragraph">Invocation of the component would look something like this:</p>
7070

7171
{{! prettier-ignore-start }}
@@ -88,7 +88,8 @@
8888
</section>
8989

9090
<section>
91-
<h3 class="dummy-h3">Design guidelines</h3>
91+
<h3 class="dummy-h3" id="design-guidelines"><a href="#design-guidelines" class="dummy-link-section">§</a>
92+
Design guidelines</h3>
9293

9394
<div class="dummy-design-guidelines">
9495
<p class="dummy-paragraph"><a href="https://www.figma.com/file/noyY6dUMDYjmySpHcMjhkN/?node-id=1377%3A11992">Figma
@@ -102,7 +103,7 @@
102103
</section>
103104

104105
<section data-test-percy>
105-
<h3 class="dummy-h3">Showcase</h3>
106+
<h3 class="dummy-h3" id="showcase"><a href="#showcase" class="dummy-link-section">§</a> Showcase</h3>
106107
<h4 class="dummy-h4">Size</h4>
107108
<ul class="dummy-icon-tile-side-by-side">
108109
<li>

packages/components/tests/dummy/app/templates/components/link-to/cta.hbs

+6-9
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
<DummyLinkCtaButtonBanner />
66

77
<section>
8-
<h3 class="dummy-h3">
9-
Overview
10-
</h3>
8+
<h3 class="dummy-h3" id="overview"><a href="#overview" class="dummy-link-section">§</a> Overview</h3>
119

1210
<p class="dummy-paragraph">The LinkTo::CTA component handles the generation of an
1311
<a
@@ -27,7 +25,7 @@
2725
</section>
2826

2927
<section>
30-
<h3 class="dummy-h3">Component API</h3>
28+
<h3 class="dummy-h3" id="component-api"><a href="#component-api" class="dummy-link-section">§</a> Component API</h3>
3129
<p class="dummy-paragraph" id="component-api-linkto-cta">Here is the API for the component:</p>
3230
<dl class="dummy-component-props" aria-labelledby="component-api-linkto-cta">
3331
<dt>size <code>enum</code></dt>
@@ -96,9 +94,7 @@
9694
</section>
9795

9896
<section>
99-
<h3 class="dummy-h3">
100-
Usage
101-
</h3>
97+
<h3 class="dummy-h3" id="how-to-use"><a href="#how-to-use" class="dummy-link-section">§</a> How to use</h3>
10298

10399
<h4 class="dummy-h4">Basic use</h4>
104100
<p class="dummy-paragraph">The most basic invocation requires
@@ -218,7 +214,8 @@
218214
</section>
219215

220216
<section>
221-
<h3 class="dummy-h3">Design guidelines</h3>
217+
<h3 class="dummy-h3" id="design-guidelines"><a href="#design-guidelines" class="dummy-link-section">§</a>
218+
Design guidelines</h3>
222219
<div class="dummy-design-guidelines">
223220
<p class="dummy-paragraph">
224221
<a
@@ -235,7 +232,7 @@
235232
</section>
236233

237234
<section data-test-percy>
238-
<h3 class="dummy-h3">Showcase</h3>
235+
<h3 class="dummy-h3" id="showcase"><a href="#showcase" class="dummy-link-section">§</a> Showcase</h3>
239236
<h4 class="dummy-h4">Content</h4>
240237
<div class="dummy-cta-base-sample">
241238
<Hds::LinkTo::Cta @text="Only text" @route="components.link-to.cta" />

packages/components/tests/dummy/app/templates/components/link-to/standalone.hbs

+6-11
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
<DummyLinkCtaButtonBanner />
88

99
<section>
10-
<h3 class="dummy-h3">
11-
Overview
12-
</h3>
10+
<h3 class="dummy-h3" id="overview"><a href="#overview" class="dummy-link-section">§</a> Overview</h3>
1311

1412
<p class="dummy-paragraph">The LinkTo (Standalone) component handles generation of an
1513
<a
@@ -47,9 +45,7 @@
4745
</section>
4846

4947
<section>
50-
<h3 class="dummy-h3">
51-
Component API
52-
</h3>
48+
<h3 class="dummy-h3" id="component-api"><a href="#component-api">§</a> Component API</h3>
5349
<p class="dummy-paragraph" aria-labelledby="component-api-linkto-standalone">
5450
Here is the API for the component:
5551
</p>
@@ -137,7 +133,7 @@
137133
</section>
138134

139135
<section>
140-
<h3 class="dummy-h3">How to use</h3>
136+
<h3 class="dummy-h3" id="how-to-use"><a href="#how-to-use" class="dummy-link-section">§</a> How to use</h3>
141137

142138
<h4 class="dummy-h4">Basic use</h4>
143139
<p class="dummy-paragraph">The most basic invocation requires both
@@ -274,7 +270,8 @@
274270
</section>
275271

276272
<section>
277-
<h3 class="dummy-h3">Design guidelines</h3>
273+
<h3 class="dummy-h3" id="design-guidelines"><a href="#design-guidelines" class="dummy-link-section">§</a>
274+
Design guidelines</h3>
278275
<div class="dummy-design-guidelines">
279276
<p class="dummy-paragraph">
280277
<a
@@ -297,9 +294,7 @@
297294
</section>
298295

299296
<section data-test-percy>
300-
<h3 class="dummy-h3">
301-
Showcase
302-
</h3>
297+
<h3 class="dummy-h3" id="showcase"><a href="#showcase" class="dummy-link-section">§</a> Showcase</h3>
303298
<h4 class="dummy-h4">
304299
Content
305300
</h4>

0 commit comments

Comments
 (0)