Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh styles of table of contents component #4885

Merged
merged 3 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
url: /docs/patterns/navigation#paper
status: New
notes: We've added a support for paper background for the side navigation (via <code>is-paper</code> class on body element).
- component: Table of contents
url: /docs/patterns/table-of-contents
status: Updated
notes: We've refreshed the style of the table of contents and improved the consistency of HTML markup.
- version: 4.3.0
features:
- component: Logo section
Expand Down
2 changes: 1 addition & 1 deletion scss/_base_typography-definitions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@
text-transform: uppercase;
}

// deprecated: %muted-text is deprecated, use %small-caps-text instead
%muted-heading {
@extend %small-caps-text;
@extend %bold;
}

%bold {
Expand Down
44 changes: 16 additions & 28 deletions scss/_patterns_table-of-contents.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,43 @@

@mixin vf-p-table-of-contents {
.p-table-of-contents {
border-top: 1px solid $color-mid-light;
font-size: 0.875rem;
padding: 0 $sp-large;

@media (min-width: $threshold-6-12-col) {
border-left: 1px solid $color-mid-light;
border-top: 0;
padding: 0 $sp-medium;
}
@extend %vf-grid-container-padding;
}

.p-table-of-contents__header {
color: $color-mid-dark;
font-size: $sp-medium;
line-height: 1.5;
margin-bottom: $sp-medium;
text-transform: uppercase;
@extend %muted-heading;
}

.p-table-of-contents__section {
padding: $sp-medium 0;
padding-bottom: $spv--large;

&:not(:last-child) {
border-bottom: 1px dotted $color-mid-light;
border-bottom: 1px solid $color-mid-light;
}
}

.p-table-of-contents__nav {
.p-table-of-contents__list {
list-style: none;
margin: 0;
padding: 0;

.p-table-of-contents__list {
margin-left: $sph--large;
}

.p-table-of-contents__link {
border-bottom: 0;
color: $colors--light-theme--text-default;
margin-bottom: $sp-x-small;
display: block;
// paddings based on side navigation
padding-bottom: $spv--x-small;
padding-top: $spv--x-small;

&:visited {
color: $colors--light-theme--text-default;
&.is-active {
font-weight: $font-weight-bold;
}

&:hover {
&:visited {
color: $color-link;
}

&.is-active {
font-weight: $font-weight-bold;
padding-left: $sp-x-small;
}
}
}
}
20 changes: 0 additions & 20 deletions templates/docs/examples/patterns/table-of-contents.html

This file was deleted.

25 changes: 25 additions & 0 deletions templates/docs/examples/patterns/table-of-contents/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% extends "_layouts/examples.html" %}
{% block title %}Table of contents{% endblock %}

{% block standalone_css %}patterns_table-of-contents{% endblock %}

{% block content %}
<aside class="p-table-of-contents">
<div class="p-table-of-contents__section">
<h2 class="p-table-of-contents__header">On this page</h2>
<nav class="p-table-of-contents__nav" aria-label="Table of contents">
<ul class="p-table-of-contents__list">
<li class="p-table-of-contents__item"><a class="p-table-of-contents__link" href="#link1">Install from snap</a></li>
<li class="p-table-of-contents__item"><a class="p-table-of-contents__link" href="#link2">Initialisation</a></li>
<li class="p-table-of-contents__item"><a class="p-table-of-contents__link is-active" href="#link3">Configuration verification</a>
<ul class="p-table-of-contents__list">
<li class="p-table-of-contents__item"><a class="p-table-of-contents__link" href="#">Networkd backend</a></li>
<li class="p-table-of-contents__item"><a class="p-table-of-contents__link" href="#">NetworkManager backend</a></li>
</ul>
</li>
<li class="p-table-of-contents__item"><a class="p-table-of-contents__link" href="#link4">Service statuses</a></li>
</ul>
</nav>
</div>
</aside>
{% endblock %}
35 changes: 35 additions & 0 deletions templates/docs/examples/patterns/table-of-contents/sections.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{% extends "_layouts/examples.html" %}
{% block title %}Table of contents / Sections{% endblock %}

{% block standalone_css %}patterns_table-of-contents{% endblock %}

{% block content %}
<aside class="p-table-of-contents">
<div class="p-table-of-contents__section">
<h2 class="p-table-of-contents__header">On this page</h2>
<nav class="p-table-of-contents__nav" aria-label="Table of contents">
<ul class="p-table-of-contents__list">
<li class="p-table-of-contents__item"><a class="p-table-of-contents__link" href="#link1">Install from snap</a></li>
<li class="p-table-of-contents__item"><a class="p-table-of-contents__link" href="#link2">Initialisation</a></li>
<li class="p-table-of-contents__item"><a class="p-table-of-contents__link is-active" href="#link3">Configuration verification</a>
<ul class="p-table-of-contents__list">
<li class="p-table-of-contents__item"><a class="p-table-of-contents__link" href="#">Networkd backend</a></li>
<li class="p-table-of-contents__item"><a class="p-table-of-contents__link" href="#">NetworkManager backend</a></li>
</ul>
</li>
<li class="p-table-of-contents__item"><a class="p-table-of-contents__link" href="#link4">Service statuses</a></li>
</ul>
</nav>
</div>
<div class="p-table-of-contents__section">
<h2 class="p-table-of-contents__header">Resources</h2>
<nav class="p-table-of-contents__nav" aria-label="Resources">
<ul class="p-table-of-contents__list">
<li class="p-table-of-contents__item"><a class="p-table-of-contents__link" href="#link1">Documentation</a></li>
<li class="p-table-of-contents__item"><a class="p-table-of-contents__link" href="#link2">Forum</a></li>
<li class="p-table-of-contents__item"><a class="p-table-of-contents__link" href="#link3">GitHub</a></li>
</ul>
</nav>
</div>
</aside>
{% endblock %}
2 changes: 1 addition & 1 deletion templates/docs/patterns/table-of-contents.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ context:

A table of contents can be used to display supplementary links to a page.

<div class="embedded-example"><a href="/docs/examples/patterns/table-of-contents/" class="js-example">
<div class="embedded-example"><a href="/docs/examples/patterns/table-of-contents/default" class="js-example">
View example of the table of contents pattern
</a></div>

Expand Down