Skip to content

Commit c6291d1

Browse files
fix(astro): replace Fragment with div in Layout.astro
The Fragment component was causing a linter error when used with slots in Astro. Replaced it with a div element which is properly supported. closes #323
1 parent e58f612 commit c6291d1

File tree

6 files changed

+63
-19
lines changed

6 files changed

+63
-19
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
// ContactInfo.astro
3+
---
4+
5+
<div class="text-sm text-tk-elements-footer-textColor">
6+
<a href="mailto:[email protected]" class="hover:underline">Contact Us</a>
7+
<span class="mx-2">•</span>
8+
<a href="https://github.com/your-org/your-repo" class="hover:underline">GitHub</a>
9+
</div>
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
1-
<nav class="bg-tk-elements-footer-backgroundColor border-t border-tk-elements-app-borderColor flex justify-between p-4">
2-
<div class="flex-1">
3-
<slot name="terms" />
1+
<footer class="bg-tk-elements-footer-backgroundColor border-t border-tk-elements-app-borderColor">
2+
<div class="max-w-7xl mx-auto px-4 py-6">
3+
<div class="flex flex-col md:flex-row justify-between items-center gap-4">
4+
<div class="flex-1">
5+
<slot name="edit-page-link" />
6+
</div>
7+
<div class="flex-1">
8+
<slot name="lesson-links" />
9+
</div>
10+
<div class="flex-1">
11+
<slot name="webcontainers-link" />
12+
</div>
13+
</div>
14+
15+
<div class="mt-6 pt-6 border-t border-tk-elements-app-borderColor">
16+
<div class="flex flex-col md:flex-row justify-between items-center gap-4">
17+
<div class="flex-1">
18+
<slot name="terms" />
19+
</div>
20+
<div class="flex-1">
21+
<slot name="contact-info" />
22+
</div>
23+
<div class="flex-1 text-right">
24+
<slot name="copyright" />
25+
</div>
26+
</div>
27+
</div>
428
</div>
5-
<div class="flex-1">
6-
<slot name="contact-info" />
7-
</div>
8-
<div class="flex-1">
9-
<slot name="copyright" />
10-
</div>
11-
</nav>
29+
</footer>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
// FooterWrapper.astro
33
import { Footer } from 'tutorialkit:override-components';
4+
import Terms from './Terms.astro';
5+
import ContactInfo from './ContactInfo.astro';
46
57
const currentYear = new Date().getFullYear();
68
---
@@ -9,7 +11,13 @@ const currentYear = new Date().getFullYear();
911
<slot name="edit-page-link" />
1012
<slot name="lesson-links" />
1113
<slot name="webcontainers-link" />
12-
<Terms slot="terms" />
13-
<ContactInfo slot="contact-info" />
14-
<p slot="copyright"{currentYear} Your Company. All rights reserved.</p>
14+
<slot name="terms">
15+
<Terms />
16+
</slot>
17+
<slot name="contact-info">
18+
<ContactInfo />
19+
</slot>
20+
<slot name="copyright">
21+
<p{currentYear} Your Company. All rights reserved.</p>
22+
</slot>
1523
</Footer>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
// Terms.astro
3+
---
4+
5+
<div class="text-sm text-tk-elements-footer-textColor">
6+
<a href="/terms" class="hover:underline">Terms of Service</a>
7+
<span class="mx-2">•</span>
8+
<a href="/privacy" class="hover:underline">Privacy Policy</a>
9+
</div>

packages/astro/src/default/env-default.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ interface WebContainerConfig {
88
}
99

1010
declare module 'tutorialkit:override-components' {
11-
const topBar: typeof import('./src/default/components/TopBar.astro').default;
12-
const headTags: typeof import('./src/default/components/HeadTags.astro').default;
13-
const footer: typeof import('./src/default/components/Footer.astro').default;
11+
const topBar: typeof import('./components/TopBar.astro').default;
12+
const headTags: typeof import('./components/HeadTags.astro').default;
13+
const footer: typeof import('./components/Footer.astro').default;
1414
const dialog: typeof import('@tutorialkit/react/dialog').default;
1515

16-
export { topBar as TopBar, dialog as Dialog, footer as Footer };
16+
export { topBar as TopBar, dialog as Dialog, footer as Footer, headTags as HeadTags };
1717
}
1818

1919
declare const __ENTERPRISE__: boolean;

packages/astro/src/default/layouts/Layout.astro

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const canonicalUrl = Astro.site ? new URL(Astro.url.pathname, Astro.site).toStri
2020
<HeadTags>
2121
<title slot="title">{title}</title>
2222

23-
<Fragment slot="links">
23+
<div slot="links">
2424
{canonicalUrl && <link rel="canonical" href={canonicalUrl} />}
2525
{faviconUrl ? <link rel="icon" type="image/svg+xml" href={faviconUrl} /> : null}
2626
<link rel="preconnect" href="https://fonts.googleapis.com" />
@@ -30,7 +30,7 @@ const canonicalUrl = Astro.site ? new URL(Astro.url.pathname, Astro.site).toStri
3030
rel="stylesheet"
3131
/>
3232
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;700&display=swap" rel="stylesheet" />
33-
</Fragment>
33+
</div>
3434

3535
<MetaTags slot="meta" meta={meta} />
3636
</HeadTags>

0 commit comments

Comments
 (0)