Skip to content

Commit ce9a1bd

Browse files
committed
Change homepage layout and add footer
1 parent 9bf2156 commit ce9a1bd

File tree

6 files changed

+190
-48
lines changed

6 files changed

+190
-48
lines changed

docs/tutorialkit.dev/astro.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default defineConfig({
2525
},
2626
components: {
2727
Head: './src/components/Layout/Head.astro',
28+
PageFrame: './src/components/Layout/PageFrame.astro',
2829
},
2930
customCss: ['./src/styles/custom.scss'],
3031
logo: {
1.28 MB
Loading
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<footer class="page-footer">
2+
<a href="https://github.com/stackblitz/tutorialkit/blob/main/LICENSE" target="_blank">MIT License © 2024</a>
3+
<span><a href="https://webcontainers.io" target="_blank">Powered by WebContainers</a></span>
4+
</footer>
5+
6+
<style>
7+
footer {
8+
width: 100%;
9+
padding: var(--sl-nav-pad-y) var(--sl-nav-pad-x);
10+
opacity: 0.7;
11+
font-size: 90%;
12+
position: relative;
13+
z-index: 10;
14+
text-align: center;
15+
display: flex;
16+
justify-content: space-between;
17+
}
18+
a {
19+
color: inherit;
20+
text-decoration: none;
21+
}
22+
</style>
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
import MobileMenuToggle from 'virtual:starlight/components/MobileMenuToggle';
3+
import type { Props } from '../props';
4+
import PageFooter from './PageFooter.astro';
5+
6+
const { hasSidebar, labels } = Astro.props;
7+
---
8+
9+
<div class="page sl-flex">
10+
<header class="header"><slot name="header" /></header>
11+
{
12+
hasSidebar && (
13+
<nav class="sidebar" aria-label={labels['sidebarNav.accessibleLabel']}>
14+
<MobileMenuToggle {...Astro.props} />
15+
<div id="starlight__sidebar" class="sidebar-pane">
16+
<div class="sidebar-content sl-flex">
17+
<slot name="sidebar" />
18+
</div>
19+
</div>
20+
</nav>
21+
)
22+
}
23+
<div class="main-frame"><slot /></div>
24+
<PageFooter />
25+
</div>
26+
27+
<style>
28+
.page {
29+
flex-direction: column;
30+
min-height: 100vh;
31+
}
32+
33+
.header {
34+
z-index: var(--sl-z-index-navbar);
35+
position: fixed;
36+
inset-inline-start: 0;
37+
inset-block-start: 0;
38+
width: 100%;
39+
height: var(--sl-nav-height);
40+
border-bottom: 1px solid var(--sl-color-hairline-shade);
41+
padding: var(--sl-nav-pad-y) var(--sl-nav-pad-x);
42+
padding-inline-end: var(--sl-nav-pad-x);
43+
background-color: var(--sl-color-bg-nav);
44+
}
45+
46+
:global([data-has-sidebar]) .header {
47+
padding-inline-end: calc(var(--sl-nav-gap) + var(--sl-nav-pad-x) + var(--sl-menu-button-size));
48+
}
49+
50+
.sidebar-pane {
51+
visibility: var(--sl-sidebar-visibility, hidden);
52+
position: fixed;
53+
z-index: var(--sl-z-index-menu);
54+
inset-block: var(--sl-nav-height) 0;
55+
inset-inline-start: 0;
56+
width: 100%;
57+
background-color: var(--sl-color-black);
58+
overflow-y: auto;
59+
}
60+
61+
:global([aria-expanded='true']) ~ .sidebar-pane {
62+
--sl-sidebar-visibility: visible;
63+
}
64+
65+
.sidebar-content {
66+
height: 100%;
67+
min-height: max-content;
68+
padding: 1rem var(--sl-sidebar-pad-x) 0;
69+
flex-direction: column;
70+
gap: 1rem;
71+
}
72+
73+
@media (min-width: 50rem) {
74+
.sidebar-content::after {
75+
content: '';
76+
padding-bottom: 1px;
77+
}
78+
}
79+
80+
.main-frame {
81+
padding-top: calc(var(--sl-nav-height) + var(--sl-mobile-toc-height));
82+
padding-inline-start: var(--sl-content-inline-start);
83+
}
84+
85+
@media (min-width: 50rem) {
86+
:global([data-has-sidebar]) .header {
87+
padding-inline-end: var(--sl-nav-pad-x);
88+
}
89+
.sidebar-pane {
90+
--sl-sidebar-visibility: visible;
91+
width: var(--sl-sidebar-width);
92+
background-color: var(--sl-color-bg-sidebar);
93+
border-inline-end: 1px solid var(--sl-color-hairline-shade);
94+
}
95+
}
96+
</style>

docs/tutorialkit.dev/src/content/docs/index.astro

Lines changed: 63 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,46 @@
11
---
22
import { Button } from '@components/Buttons/Button/Button';
3-
import tutorialkitThemesImg from '@assets/tutorialkit-themes.png';
3+
import tutorialkitImg from '@assets/tutorialkit-preview.png';
44
---
55

66
<div class="simple-page-hero">
7-
<h1>Increase Library Adoption with Interactive Coding Tutorials.</h1>
8-
<p>
9-
TutorialKit by <a href="https://stackblitz.com" target="_blank" rel="noopener">StackBlitz</a> enables you to create interactive
10-
coding tutorials effortlessly, boosting the adoption of your framework, UI library or design system.
11-
</p>
12-
<div class="simple-page-hero__links">
13-
<Button url="/guides/about/" theme="accent">Get Started</Button>
14-
<Button url="https://demo.tutorialkit.dev">Try Demo</Button>
7+
<div class="main">
8+
<h1>Increase Library Adoption with Interactive Coding Tutorials.</h1>
9+
<p>
10+
TutorialKit by <a href="https://stackblitz.com" target="_blank" rel="noopener">StackBlitz</a> enables you to create
11+
interactive coding tutorials effortlessly, boosting the adoption of your framework, UI library or design system.
12+
</p>
13+
<div class="simple-page-hero__links">
14+
<Button url="/guides/about/" theme="accent">Get Started</Button>
15+
<Button url="https://demo.tutorialkit.dev">Try Demo</Button>
16+
</div>
1517
</div>
1618
<div class="ui-example">
17-
<img src={tutorialkitThemesImg.src} />
19+
<a href="https://demo.tutorialkit.dev" target="_blank">
20+
<img src={tutorialkitImg.src} />
21+
</a>
1822
</div>
1923
</div>
2024

2125
<style lang="scss">
2226
@import '../../styles/breakpoints.scss';
2327

28+
:global(body) {
29+
--sl-content-width: 75rem;
30+
}
31+
2432
.simple-page-hero {
2533
display: flex;
26-
flex-direction: column;
34+
flex-direction: row;
2735
justify-content: center;
28-
align-items: center;
29-
gap: 16px;
30-
width: 820px;
36+
align-items: start;
37+
gap: 48px;
3138
max-width: 100%;
32-
margin: 9dvh auto 0;
33-
padding: 0 24px;
34-
overflow-y: hidden;
39+
margin: 9dvh auto 6dvh;
3540

3641
@media screen and (max-width: $breakpoint-tablet-small) {
37-
gap: 8px;
42+
display: block;
43+
padding: 0 24px;
3844
}
3945

4046
@media screen and (max-width: $breakpoint-small) {
@@ -47,38 +53,49 @@ import tutorialkitThemesImg from '@assets/tutorialkit-themes.png';
4753
}
4854
}
4955

56+
.simple-page-hero .main {
57+
display: flex;
58+
flex-direction: column;
59+
gap: 16px;
60+
61+
@media screen and (max-width: $breakpoint-tablet-small) {
62+
gap: 12px;
63+
}
64+
65+
@media screen and (max-width: $breakpoint-mobile) {
66+
gap: 8px;
67+
}
68+
}
69+
5070
.simple-page-hero h1 {
51-
font-size: 56px;
71+
font-size: 48px;
5272
font-weight: 600;
53-
line-height: 1.12;
73+
line-height: 1.3;
5474
letter-spacing: -2px;
55-
text-align: center;
5675

5776
@media screen and (max-width: $breakpoint-tablet-small) {
5877
max-width: 620px;
5978
font-size: 40px;
6079
letter-spacing: -1px;
80+
text-align: center;
6181
}
6282

6383
@media screen and (max-width: $breakpoint-mobile) {
6484
font-size: 28px;
6585
line-height: 1.2;
6686
}
67-
68-
@media screen and (max-width: $breakpoint-tiny) {
69-
// font-size: 24px;
70-
}
7187
}
7288

7389
.simple-page-hero p {
7490
max-width: 680px;
75-
font-size: 16px;
91+
font-size: 20px;
7692
line-height: 1.8;
77-
text-align: center;
93+
margin-bottom: 1em;
7894

7995
@media screen and (max-width: $breakpoint-tablet-small) {
8096
max-width: 680px;
8197
text-wrap: pretty;
98+
text-align: center;
8299
}
83100

84101
@media screen and (max-width: $breakpoint-small) {
@@ -104,42 +121,47 @@ import tutorialkitThemesImg from '@assets/tutorialkit-themes.png';
104121
.simple-page-hero__links {
105122
display: flex;
106123
justify-content: center;
107-
gap: 12px;
124+
gap: 44px;
108125

109126
@media screen and (max-width: $breakpoint-mobile) {
110127
width: 100%;
111128
flex-direction: column;
112129
}
130+
131+
:global(> *) {
132+
@media screen and (max-width: $breakpoint-mobile) {
133+
margin: 0 auto;
134+
}
135+
}
113136
}
114137

115138
.ui-example {
116-
position: fixed;
117-
top: max(532px, 50dvh);
118-
width: 1400px;
119-
max-width: 100%;
120-
height: auto;
121-
padding: 0 32px;
139+
width: 100%;
122140
mask-image: radial-gradient(160% 100% at 50% 0%, #000 70%, transparent);
123-
z-index: -1;
141+
overflow: visible;
124142

125143
html[data-theme='light'] & {
126144
mask-image: none;
127145
}
128146

129147
@media screen and (max-width: $breakpoint-small) {
130148
top: 524px;
131-
padding: 0 16px;
132149
}
133150

134-
@media screen and (max-width: $breakpoint-mobile) {
135-
padding: 0;
151+
a {
152+
display: block;
153+
transition: all 0.1s ease-in-out;
154+
transform-origin: 0 150%;
155+
scale: 0.98;
156+
}
157+
158+
a:hover {
159+
scale: 1;
136160
}
137161

138162
img {
163+
transition: all 0.2s ease-in-out;
139164
border-radius: 6px;
140-
box-shadow:
141-
-2px -2px 2px 0 hsla(0, 0%, 6%, 0.02),
142-
0 0 0 1px rgba(0, 0, 0, 0.032);
143165

144166
@media screen and (max-width: $breakpoint-mobile) {
145167
border-radius: 0;

docs/tutorialkit.dev/src/styles/custom.scss

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ body {
1212
font-family: 'Inter', sans-serif;
1313
box-sizing: border-box;
1414
overscroll-behavior: none;
15+
--footer-height: 50px;
1516

1617
&::before {
1718
position: absolute;
@@ -30,17 +31,10 @@ body {
3031

3132
[data-theme='dark'] & {
3233
background-image: radial-gradient(100% 100% at 50% 0%, transparent 60%, rgba(0, 0, 0, 0.4) 100%);
33-
&::before {
34-
background-image: linear-gradient(transparent 60%, rgba(0, 0, 0, 0.8) 100%);
35-
}
3634
}
3735

3836
[data-theme='light'] & {
3937
background-image: radial-gradient(100% 100% at 50% 0%, #fff 60%, #eff0f3 100%);
40-
41-
&::before {
42-
background-image: linear-gradient(transparent 60%, rgba(255, 255, 255, 0.8) 100%);
43-
}
4438
}
4539
}
4640
}
@@ -85,12 +79,19 @@ site-search button[data-open-modal] {
8579
transition-property: border-color, color;
8680
}
8781

82+
// ----------------------------------------
83+
// Left sidebar
84+
#starlight__sidebar {
85+
margin-bottom: var(--footer-height);
86+
}
87+
8888
// ----------------------------------------
8989
// Table of contents
9090

9191
.right-sidebar {
9292
padding-left: 32px;
9393
border: none;
94+
height: calc(100% - var(--footer-height));
9495
}
9596

9697
#starlight__on-this-page {

0 commit comments

Comments
 (0)