Skip to content

Commit b735ee3

Browse files
committed
Adds styling (copied from guidemaker) and update the classes to match that
1 parent cd6e195 commit b735ee3

File tree

4 files changed

+78
-19
lines changed

4 files changed

+78
-19
lines changed

app/components/table-of-contents.hbs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
<ol class='toc-level-0'>
2-
<li class='toc-level-0'>
1+
<ul class='table-of-contents '>
2+
<li class='toc-item toc-group'>
33
<a {{on 'click' (fn this.toggle 'modules')}} href='#' data-test-toc-title='packages'>Packages</a>
4-
<ol class='toc-level-1 modules selected'>
4+
<ul class='sub-table-of-contents modules selected'>
55
{{#each @moduleIDs as |moduleID|}}
66

77
{{#if (not-eq moduleID '@ember/object/computed')}}
8-
<li class='toc-level-1' data-test-module={{moduleID}}>
8+
<li class='toc-item toc-link' data-test-module={{moduleID}}>
99
<LinkTo @route='project-version.modules.module' @models={{array @version moduleID}}>{{moduleID}}</LinkTo>
1010
</li>
1111
{{/if}}
1212

1313
{{/each}}
14-
</ol>
14+
</ul>
1515
</li>
1616

1717
{{#if @isShowingNamespaces}}
18-
<li class='toc-level-0'>
18+
<li class='table-of-contents'>
1919
<a {{on 'click' (fn this.toggle 'namespaces')}} href='#' data-test-toc-title='namespaces'>Namespaces</a>
20-
<ol class='toc-level-1 namespaces selected'>
20+
<ul class='sub-table-of-contents namespaces selected'>
2121
{{#each @namespaceIDs as |namespaceID|}}
22-
<li class='toc-level-1' data-test-namespace={{namespaceID}}>
22+
<li class='toc-item toc-link' data-test-namespace={{namespaceID}}>
2323
<LinkTo @route='project-version.namespaces.namespace' @models={{array @version namespaceID}}>{{namespaceID}}</LinkTo>
2424
</li>
2525
{{/each}}
26-
</ol>
26+
</ul>
2727
</li>
2828
{{/if}}
2929

30-
<li class='toc-level-0'>
30+
<li class='table-of-contents '>
3131
<a {{on 'click' (fn this.toggle 'classes')}} href='#' data-test-toc-title='classes'>Classes</a>
32-
<ol class='toc-level-1 classes selected'>
32+
<ul class='sub-table-of-contents classes selected'>
3333
{{#each @classesIDs as |classID|}}
34-
<li class='toc-level-1' data-test-class={{classID}}>
34+
<li class='toc-item toc-link' data-test-class={{classID}}>
3535
<LinkTo @route='project-version.classes.class' @models={{array @version classID}}>{{classID}}</LinkTo>
3636
</li>
3737
{{/each}}
38-
</ol>
38+
</ul>
3939
</li>
40-
</ol>
40+
</ul>
4141
<label class='toc-private-toggle'>
4242
<input type='checkbox' checked={{@showPrivateClasses}} onchange={{@togglePrivateClasses}} class='private-deprecated-toggle' />
4343
Show Private / Deprecated

app/components/table-of-contents.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import Component from '@glimmer/component';
44
export default class TableOfContents extends Component {
55
@action
66
toggle(type) {
7-
const tableElement = document.querySelector(`ol.toc-level-1.${type}`);
7+
const tableElement = document.querySelector(
8+
`ul.sub-table-of-contents.${type}`
9+
);
810
tableElement.classList.toggle('selected');
911
}
1012
}

app/styles/app.css

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,60 @@ main a.edit-icon {
2525
display: inline-block;
2626
background: none;
2727
}
28+
29+
.table-of-contents {
30+
list-style-type: none;
31+
padding-left: 0;
32+
font-size: var(--font-size-lg);
33+
font-weight: var(--font-weight-3);
34+
}
35+
36+
.sub-table-of-contents {
37+
padding-left: var(--spacing-1);
38+
font-size: var(--font-size-md);
39+
font-weight: var(--font-weight-2);
40+
}
41+
42+
.sub-table-of-contents .sub-table-of-contents {
43+
padding-left: var(--spacing-3);
44+
margin-bottom: 0;
45+
}
46+
47+
.table-of-contents a:link {
48+
background: none;
49+
}
50+
51+
.sub-table-of-contents .toc-item a {
52+
display: block;
53+
padding: var(--spacing-1);
54+
border-radius: var(--radius);
55+
line-height: var(--line-height-xs);
56+
color: var(--color-gray-700);
57+
border-left: 0 solid transparent;
58+
transition: border-width .3s;
59+
}
60+
61+
.sub-table-of-contents .toc-item a:hover {
62+
border-left: 4px solid var(--color-gray-400);
63+
border-radius: 0;
64+
}
65+
66+
.sub-table-of-contents .toc-item.selected > a, .sub-table-of-contents .toc-item > a.active {
67+
border-left: 4px solid var(--color-brand-hc-dark);
68+
border-radius: 0;
69+
}
70+
71+
.table-of-contents li {
72+
margin: 3px 0;
73+
list-style-type: none;
74+
}
75+
76+
li.toc-heading {
77+
margin-top: var(--spacing-4);
78+
color: var(--color-gray-600);
79+
}
80+
81+
li.toc-heading:first-child {
82+
margin-top: 0;
83+
}
84+

tests/integration/components/table-of-contents-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module('Integration | Component | table of contents', function (hooks) {
2727
const contentTitle = document.querySelector(
2828
'[data-test-toc-title="classes"]'
2929
);
30-
const contentReference = '.toc-level-1';
30+
const contentReference = '.sub-table-of-contents';
3131

3232
assert.dom(contentTitle).hasText('Classes');
3333
assert
@@ -51,7 +51,7 @@ module('Integration | Component | table of contents', function (hooks) {
5151
/>
5252
`);
5353

54-
const contentReference = '.toc-level-1';
54+
const contentReference = '.sub-table-of-contents';
5555
const content = document.querySelector(contentReference);
5656
const contentTitle = document.querySelector(
5757
'[data-test-toc-title="classes"]'
@@ -84,7 +84,7 @@ module('Integration | Component | table of contents', function (hooks) {
8484
const contentTitle = document.querySelector(
8585
'[data-test-toc-title="packages"]'
8686
);
87-
const contentReference = '.toc-level-1';
87+
const contentReference = '.sub-table-of-content';
8888
const content = document.querySelector(contentReference);
8989

9090
assert.dom(contentTitle).hasText('Packages');
@@ -118,7 +118,7 @@ module('Integration | Component | table of contents', function (hooks) {
118118
const titleButton = document.querySelector(
119119
'[data-test-toc-title="packages"]'
120120
);
121-
const contentReference = '.toc-level-1';
121+
const contentReference = '.sub-table-of-contents';
122122
const content = document.querySelector(contentReference);
123123

124124
assert.dom(titleButton).hasText('Packages');

0 commit comments

Comments
 (0)