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

Table of Contents SEO Updates - Undo Revert #1258

Merged
merged 19 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions express/blocks/how-to-steps/how-to-steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
shareIcon.addEventListener('click', () => {
if (templateHref) {
navigator.clipboard.writeText(templateHref).catch((err) => {
console.error('Failed to copy template-x link: ', err);

Check warning on line 27 in express/blocks/how-to-steps/how-to-steps.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement

Check warning on line 27 in express/blocks/how-to-steps/how-to-steps.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement

Check warning on line 27 in express/blocks/how-to-steps/how-to-steps.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement
});
}
});
Expand Down Expand Up @@ -67,6 +67,7 @@
if (isStepNumberDefined) {
numberStepStart = +rows[0].querySelectorAll('div')[1].innerText.trim();
rows[0].remove();
rows.splice(0, 1);
}

const narrowVariant = block?.classList.contains('narrow');
Expand Down
85 changes: 69 additions & 16 deletions express/features/table-of-contents-seo/table-of-contents-seo.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.table-of-contents-seo {
position: fixed;
z-index: 25;
z-index: 1;
top: 50%;
transform: translateY(-50%);
left: 0;
background-color: #f4f4f4;
padding-top: 10px;
padding-bottom: 10px;
width: 300px;
width: 200px;
white-space: nowrap;
text-align: left;
border-radius: 0 12px 12px 0;
Expand All @@ -18,6 +18,7 @@
.toc-title {
font-weight: bold;
margin-bottom: 10px;
color: var(--color-info-accent);
}

.toc-entry {
Expand All @@ -26,7 +27,6 @@
display: flex;
align-items: flex-start;
padding-left: 14px;
padding-right: 50px;
text-align: left;
white-space: normal;
overflow-wrap: break-word;
Expand All @@ -38,6 +38,7 @@

.toc .toc-entry a {
color: var(--color-info-accent);
text-decoration: none;
}

.toc.mobile-toc .toc-entry .toc-normal {
Expand All @@ -50,10 +51,11 @@

.toc-entry .vertical-line {
width: 4px;
height: 100%;
height: 20px;
background-color: transparent;
position: absolute;
left: 0;
top: 0;
}

.toc-entry.active .vertical-line {
Expand All @@ -64,13 +66,16 @@
margin-right: 5px;
flex-shrink: 0;
align-self: flex-start;
color: var(--color-info-accent);
flex-shrink: 0;
}

.toc-title,
.toc-entry {
display: flex;
align-items: center;
padding-left: 20px;
padding-right: 20px;
}

.toc-title > div,
Expand All @@ -84,11 +89,6 @@
margin-left: -6px;
}

.toc-entry .toc-number {
flex-shrink: 0;
font-weight: bold;
}

.number-circle {
background-color: #E0E2FD;
color: black;
Expand All @@ -113,14 +113,67 @@
transform: translate(-50%, -50%);
}

.mobile-toc {
color: var(--color-info-accent);
main .section.section-wrapper .mobile-toc {
border: 1px solid #D0D0D0;
background-color: #f8f8f8;
margin: 0;
max-width: none;
z-index: 2;
}

.mobile-toc .toc-title {
height: 36px;
margin-bottom: 0;
}

.mobile-toc .toc-title-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
cursor: pointer;
padding: 10px;
margin-bottom: 15px;
background-color: #f4f4f4;
border-radius: 16px;
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.05), 0 -6px 12px rgba(0, 0, 0, 0.05),
6px 0 12px rgba(0, 0, 0, 0.05), -6px 0 12px rgba(0, 0, 0, 0.05);
}

.mobile-toc .toc-content {
display: none;
}

.mobile-toc .toc-content.open {
margin-top: 8px;
display: block;
padding-left: 10px;
padding-bottom: 10px;
}

.sticky {
position: fixed;
top: 0;
width: 100%;
z-index: 2;
}

.toc-chevron {
padding-right: 10px;
padding-top: 8px;
}

.toc-chevron::before {
border-style: solid;
border-width: 0.15em 0.15em 0 0;
content: '';
display: inline-block;
height: 0.45em;
left: 0.15em;
position: relative;
top: 0.15em;
transform: rotate(-45deg);
vertical-align: top;
width: 0.45em;
transition: transform 0.05s ease;
}

.toc-chevron.up:before {
transform: rotate(135deg);
}

@media (min-width: 600px) {
Expand Down
Loading
Loading