Skip to content

Commit bee00d8

Browse files
Add banner at the end of the toc section (#3947)
* Add banner at the end of the toc section * Update banner image and make it work nice on a narrow viewport
1 parent 27862ff commit bee00d8

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed
9.71 KB
Binary file not shown.

dspublisher/theme/init-browser.ts

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import '@vaadin/vaadin-lumo-styles/style.js';
1313
import '@vaadin/vaadin-material-styles/color';
1414
import '@vaadin/vaadin-material-styles/typography';
1515

16+
// Import banner image
17+
import tocBanner from './images/toc-banner.webp';
18+
1619
if (!localStorage.getItem('vaadin.docsApp.preferredExample')) {
1720
localStorage.setItem('vaadin.docsApp.preferredExample', 'Java');
1821
}
@@ -151,3 +154,91 @@ class Footer extends LitElement {
151154
}
152155

153156
customElements.define('dspublisher-article-footer', Footer);
157+
158+
class TocFooter extends LitElement {
159+
createRenderRoot() {
160+
return this;
161+
}
162+
163+
render() {
164+
return html`
165+
<style>
166+
.toc-footer {
167+
margin-top: 2rem;
168+
width: 11.25rem;
169+
}
170+
171+
.toc-footer--img img {
172+
margin-top: 1rem;
173+
width: 100%;
174+
height: auto;
175+
border-radius: 0.25rem;
176+
}
177+
178+
.toc-footer--content {
179+
line-height: 1.5;
180+
font-size: var(--docs-font-size-2xs);
181+
color: var(--docs-secondary-text-color);
182+
}
183+
184+
.toc-footer--heading {
185+
font-weight: 600;
186+
color: var(--docs-heading-text-color) !important;
187+
}
188+
189+
.toc-footer > a::after {
190+
content: none !important;
191+
}
192+
193+
/* Hide the footer on mobile when the TOC is closed */
194+
@media screen and (max-width: 65rem) {
195+
.toctoggle:not([open]) + .toc > dspublisher-toc-footer {
196+
display: none;
197+
}
198+
199+
.toc-footer {
200+
width: auto;
201+
display: flex;
202+
flex-direction: row-reverse;
203+
align-items: flex-start;
204+
gap: 1rem;
205+
justify-content: flex-end;
206+
}
207+
208+
.toc-footer--img {
209+
flex-shrink: 0;
210+
width: 4rem;
211+
}
212+
213+
.toc-footer--img img {
214+
margin-top: 0;
215+
width: 100%;
216+
height: auto;
217+
border-radius: 0.25rem;
218+
}
219+
220+
.toc-footer--content {
221+
flex: 1;
222+
padding-top: 0.25rem;
223+
}
224+
}
225+
</style>
226+
227+
<div class="toc-footer">
228+
<a href="https://vaadin.com/learn/training" class="toc-footer--link">
229+
230+
<div class="toc-footer--heading">Video tutorial</div>
231+
<div class="toc-footer--content">
232+
Learn Vaadin fundamentals through short video tutorials.
233+
</div>
234+
235+
<div class="toc-footer--img">
236+
<img src=${tocBanner.src} alt="Learn by watching"
237+
</div>
238+
</a>
239+
</div>
240+
`;
241+
}
242+
}
243+
244+
customElements.define('dspublisher-toc-footer', TocFooter);

0 commit comments

Comments
 (0)