Skip to content

Commit 61f89c1

Browse files
feat: add download snippet at home page (#175)
* feat: add download snippet at home page * fixup!
1 parent 241a05d commit 61f89c1

5 files changed

Lines changed: 54 additions & 8 deletions

File tree

components/HomePage/Hero/index.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import styles from './index.module.css';
22
import { version } from '#theme/config';
33
import Logo from '../../Icons/Webpack';
4-
export default () => {
4+
export default ({ children }) => {
55
return (
66
<section className={styles.hero}>
77
<div className={styles.webpackContainer}>
@@ -20,6 +20,8 @@ export default () => {
2020
splitting allows for loading parts of the application on demand —
2121
designed for modern JavaScript apps.
2222
</p>
23+
{/* rendering the code block described at root index.md*/}
24+
<div className={styles.codeWrapper}>{children}</div>
2325

2426
<div className={styles.actions}>
2527
<a href="/guides/getting-started" className={styles.primaryBtn}>

components/HomePage/Hero/index.module.css

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
}
4141

4242
.preTitle {
43-
@apply mb-4
43+
@apply mb-2
4444
flex
4545
items-center
4646
justify-center
@@ -64,7 +64,7 @@
6464
}
6565

6666
.title {
67-
@apply mb-4
67+
@apply mb-2
6868
font-normal
6969
text-5xl
7070
leading-[1.1]
@@ -77,13 +77,22 @@
7777
}
7878

7979
.subtext {
80-
@apply mb-8
80+
@apply mb-6
8181
text-lg
8282
leading-relaxed
8383
text-neutral-800
8484
dark:text-neutral-500;
8585
}
8686

87+
.codeWrapper {
88+
@apply mb-8
89+
w-full
90+
max-w-[26rem]
91+
mx-auto
92+
lg:mx-0
93+
text-left;
94+
}
95+
8796
.actions {
8897
@apply flex
8998
items-center

layouts/Home/index.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
import Footer from '../../components/Footer';
22
import NavBar from '../../components/NavBar';
3-
import Hero from '../../components/HomePage/Hero';
43
import FeaturesSection from '../../components/HomePage/FeaturesSection';
54
import HomeSponsorSection from '../../components/HomePage/HomeSponsorSection';
6-
import ConfigSection from '../../components/HomePage/ConfigSection';
75

86
export default ({ metadata, children }) => {
97
return (
108
<>
119
<NavBar metadata={metadata} />
12-
<Hero />
13-
<ConfigSection>{children}</ConfigSection>
10+
{/* rendering hero + configSection described at root index.md*/}
11+
{children}
1412
<FeaturesSection />
1513
<HomeSponsorSection />
1614
<Footer />

pages/index.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,32 @@ layout: home
33
mdx: true
44
---
55

6+
<Hero>
7+
8+
```bash displayName="npm"
9+
npm install webpack webpack-cli --save-dev
10+
```
11+
12+
```bash displayName="yarn"
13+
yarn add webpack webpack-cli --dev
14+
```
15+
16+
```bash displayName="pnpm"
17+
pnpm add webpack webpack-cli -D
18+
```
19+
20+
```bash displayName="bun"
21+
bun add -d webpack webpack-cli
22+
```
23+
24+
```bash displayName="deno"
25+
deno add npm:webpack npm:webpack-cli
26+
```
27+
28+
</Hero>
29+
30+
<ConfigSection>
31+
632
```javascript displayName="webpack.config.js"
733
const path = require('path');
834

@@ -44,3 +70,5 @@ const config: Configuration = {
4470

4571
export default config;
4672
```
73+
74+
</ConfigSection>

scripts/html/doc-kit.config.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ export default {
8282
'#theme/Navigation': join(ROOT, 'components/NavBar.jsx'),
8383
'#theme/Footer': join(ROOT, 'components/Footer/index.jsx'),
8484
'#theme/Logo': join(ROOT, 'components/Icons/Webpack.jsx'),
85+
'#theme/Home/Hero': join(ROOT, 'components/HomePage/Hero/index.jsx'),
86+
'#theme/Home/ConfigSection': join(
87+
ROOT,
88+
'components/HomePage/ConfigSection/index.jsx'
89+
),
90+
},
91+
components: {
92+
Hero: '#theme/Home/Hero',
93+
ConfigSection: '#theme/Home/ConfigSection',
8594
},
8695
lightningcss: {
8796
resolver: {

0 commit comments

Comments
 (0)