Skip to content

Commit 85767ec

Browse files
committed
feat: add docs homepage
1 parent 131f6bd commit 85767ec

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed

src/pages/index.js

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import Link from '@docusaurus/Link';
2+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
3+
import Layout from '@theme/Layout';
4+
import clsx from 'clsx';
5+
import React from 'react';
6+
7+
import styles from './index.module.css';
8+
9+
const FeatureList = [
10+
{
11+
title: 'Algorithms',
12+
description: (
13+
<>
14+
Comprehensive collection of JavaScript algorithms with detailed explanations and
15+
implementation examples.
16+
</>
17+
),
18+
},
19+
{
20+
title: 'Data Structures',
21+
description: (
22+
<>
23+
Learn about various data structures and their implementations in JavaScript, from basic to
24+
advanced concepts.
25+
</>
26+
),
27+
},
28+
{
29+
title: 'Code Challenges',
30+
description: (
31+
<>Practice your skills with real-world coding challenges and their solutions in JavaScript.</>
32+
),
33+
},
34+
];
35+
36+
function Feature({title, description}) {
37+
return (
38+
<div className={clsx('col col--4')}>
39+
<div className="text--center padding-horiz--md">
40+
<h3>{title}</h3>
41+
<p>{description}</p>
42+
</div>
43+
</div>
44+
);
45+
}
46+
47+
function HomepageFeatures() {
48+
return (
49+
<section className={styles.features}>
50+
<div className="container">
51+
<div className="row">
52+
{FeatureList.map((props, idx) => (
53+
<Feature key={idx} {...props} />
54+
))}
55+
</div>
56+
</div>
57+
</section>
58+
);
59+
}
60+
61+
function HomepageHeader() {
62+
const {siteConfig} = useDocusaurusContext();
63+
return (
64+
<header className={clsx('hero hero--primary', styles.heroBanner)}>
65+
<div className="container">
66+
<h1 className="hero__title">{siteConfig.title}</h1>
67+
<p className="hero__subtitle">{siteConfig.tagline}</p>
68+
<div className={styles.buttons}>
69+
<Link className="button button--secondary button--lg" to="/docs/intro">
70+
Get Started
71+
</Link>
72+
</div>
73+
</div>
74+
</header>
75+
);
76+
}
77+
78+
export default function Home() {
79+
const {siteConfig} = useDocusaurusContext();
80+
return (
81+
<Layout
82+
title={`${siteConfig.title}`}
83+
description="JavaScript Algorithms and Data Structures Documentation"
84+
>
85+
<HomepageHeader />
86+
<main>
87+
<HomepageFeatures />
88+
</main>
89+
</Layout>
90+
);
91+
}

src/pages/index.module.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.heroBanner {
2+
padding: 4rem 0;
3+
text-align: center;
4+
position: relative;
5+
overflow: hidden;
6+
}
7+
8+
@media screen and (max-width: 996px) {
9+
.heroBanner {
10+
padding: 2rem;
11+
}
12+
}
13+
14+
.buttons {
15+
display: flex;
16+
align-items: center;
17+
justify-content: center;
18+
}
19+
20+
.features {
21+
display: flex;
22+
align-items: center;
23+
padding: 2rem 0;
24+
width: 100%;
25+
}

0 commit comments

Comments
 (0)