Skip to content

Commit 0cc38a6

Browse files
feat(astro): add slot-based footer customization
adds support for overriding the footer component via named slots (edit-page-link, lesson-links, webcontainers-link) in Footer.astro, enabling flexible customization of footer content in FooterWrapper.astro. updated TutorialContent.astro to use FooterWrapper.astro for rendering footer elements, aligning with the new slot-based structure. this change ensures consistent and modular handling of footer elements across tutorials. close #423
1 parent 696ee1b commit 0cc38a6

File tree

2 files changed

+34
-26
lines changed

2 files changed

+34
-26
lines changed

packages/astro/src/default/components/FooterWrapper.astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ const currentYear = new Date().getFullYear();
88
---
99

1010
<Footer>
11+
<slot name="edit-page-link" />
12+
<slot name="lesson-links" />
13+
<slot name="webcontainers-link" />
1114
<Terms slot="terms" />
1215
<ContactInfo slot="contact-info" />
1316
<p slot="copyright"{currentYear} Your Company. All rights reserved.</p>
Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
2+
// TutorialContent.astro
23
import type { AstroComponentFactory } from 'astro/runtime/server/index.js';
34
import type { Lesson } from '@tutorialkit/types';
5+
import FooterWrapper from './FooterWrapper.astro';
46
import NavCard from './NavCard.astro';
57
68
interface Props {
@@ -16,33 +18,36 @@ const { Markdown, editPageLink, prev, next } = lesson;
1618
<Markdown />
1719
</div>
1820

19-
{
20-
editPageLink && (
21-
<div class="pb-4 mt-8 border-b border-tk-border-secondary">
22-
<a
23-
href={editPageLink}
24-
class="inline-flex flex-items-center text-tk-elements-link-secondaryColor hover:text-tk-elements-link-secondaryColorHover hover:underline"
25-
>
26-
<span class="icon i-ph-note-pencil pointer-events-none h-5 w-5 mr-2" />
27-
<span>{lesson.data.i18n!.editPageText}</span>
28-
</a>
29-
</div>
30-
)
31-
}
21+
<FooterWrapper>
22+
{
23+
editPageLink && (
24+
<div slot="edit-page-link" class="pb-4 mt-8 border-b border-tk-border-secondary">
25+
<a
26+
href={editPageLink}
27+
class="inline-flex flex-items-center text-tk-elements-link-secondaryColor hover:text-tk-elements-link-secondaryColorHover hover:underline"
28+
>
29+
<span class="icon i-ph-note-pencil pointer-events-none h-5 w-5 mr-2" />
30+
<span>{lesson.data.i18n!.editPageText}</span>
31+
</a>
32+
</div>
33+
)
34+
}
3235

33-
<div class="grid grid-cols-[1fr_1fr] gap-4 mt-8 mb-6">
34-
<div class="flex">
35-
{prev && <NavCard lesson={prev} type="prev" />}
36-
</div>
37-
<div class="flex">
38-
{next && <NavCard lesson={next} type="next" />}
36+
<div slot="lesson-links" class="grid grid-cols-[1fr_1fr] gap-4 mt-8 mb-6">
37+
<div class="flex">
38+
{prev && <NavCard lesson={prev} type="prev" />}
39+
</div>
40+
<div class="flex">
41+
{next && <NavCard lesson={next} type="next" />}
42+
</div>
3943
</div>
40-
</div>
4144

42-
<a
43-
class="inline-block mt-auto font-size-3.5 underline text-tk-elements-link-secondaryColor hover:text-tk-elements-link-secondaryColorHover"
44-
href="https://webcontainers.io/"
45-
>
46-
{lesson.data.i18n!.webcontainerLinkText}
47-
</a>
45+
<a
46+
slot="webcontainers-link"
47+
class="inline-block mt-auto font-size-3.5 underline text-tk-elements-link-secondaryColor hover:text-tk-elements-link-secondaryColorHover"
48+
href="https://webcontainers.io/"
49+
>
50+
{lesson.data.i18n!.webcontainerLinkText}
51+
</a>
52+
</FooterWrapper>
4853
</div>

0 commit comments

Comments
 (0)