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 2 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
42 changes: 13 additions & 29 deletions scss/_patterns_table-of-contents.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,38 @@

@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__link {
border-bottom: 0;
color: $colors--light-theme--text-default;
margin-bottom: $sp-x-small;

&:visited {
color: $colors--light-theme--text-default;
}
.p-table-of-contents__list {
margin-left: $sph--large;
}

&:hover {
color: $color-link;
}
.p-table-of-contents__link {
display: block;
// paddings based on side navigation
padding-bottom: $spv--x-small;
padding-top: $spv--x-small;

&.is-active {
font-weight: $font-weight-bold;
padding-left: $sp-x-small;
}
}
}
Expand Down
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">
<h4 class="p-table-of-contents__header">On this page:</h4>
<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">
<h4 class="p-table-of-contents__header">Resources:</h4>
<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 %}
17 changes: 11 additions & 6 deletions templates/docs/examples/patterns/table-of-contents.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
{% block content %}
<aside class="p-table-of-contents">
<div class="p-table-of-contents__section">
<h4 class="p-table-of-contents__header">CONTENTS</h4>
<h4 class="p-table-of-contents__header">On this page:</h4>
<nav class="p-table-of-contents__nav" aria-label="Table of contents">
<ul class="p-list">
<li><a class="p-table-of-contents__link" href="#link1">Install from snap</a></li>
<li><a class="p-table-of-contents__link" href="#link2">Initialisation</a></li>
<li><a class="p-table-of-contents__link is-active" href="#link3">Configuration verification</a></li>
<li><a class="p-table-of-contents__link" href="#link4">Service statuses</a></li>
<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>
Expand Down