Skip to content

Commit 7961718

Browse files
committed
First version of landing page completed
1 parent dc5e989 commit 7961718

19 files changed

Lines changed: 701 additions & 96 deletions

docusaurus.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type * as Preset from '@docusaurus/preset-classic';
44

55
const config: Config = {
66
title: 'Python Doesn\'t Byte',
7-
tagline: 'Programmare in Python senza farsi male',
7+
tagline: 'Il libro di testo, reinventato.',
88
favicon: 'img/icons/favicon.ico',
99

1010
// Set the production url of your site here
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
3+
import styles from './styles.module.css';
4+
5+
function Section({children}) {
6+
return (
7+
<div className={styles.wrapper}>
8+
<div className={styles.container}>{children}</div>
9+
</div>
10+
);
11+
}
12+
13+
export default Section;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
.wrapper {
9+
background: linear-gradient(
10+
to bottom,
11+
var(--home-section-top),
12+
var(--home-section-bottom)
13+
),
14+
var(--home-section-top);
15+
display: flex;
16+
justify-content: center;
17+
}
18+
19+
.container {
20+
max-width: 1000px;
21+
padding: 8rem 1rem 5rem;
22+
display: flex;
23+
flex-direction: column;
24+
justify-content: center;
25+
align-items: center;
26+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
3+
import styles from './styles.module.css';
4+
5+
function SectionTitle({title, description}) {
6+
return (
7+
<div className={styles.container}>
8+
<h1 className={styles.title}>{title}</h1>
9+
<h3 className={styles.description}>{description}</h3>
10+
</div>
11+
);
12+
}
13+
14+
export default SectionTitle;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
.container {
9+
text-align: center;
10+
display: flex;
11+
flex-direction: column;
12+
align-items: center;
13+
}
14+
15+
.title {
16+
font-size: 48px;
17+
}
18+
19+
.description {
20+
font-size: 20px;
21+
color: var(--home-secondary-text);
22+
line-height: 150%;
23+
margin-top: 1rem;
24+
font-weight: normal;
25+
max-width: 850px;
26+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React, {useState, useEffect} from 'react';
2+
3+
function ThemeImage({lightSrc, darkSrc, className, alt}) {
4+
const [theme, setTheme] = useState('light');
5+
6+
useEffect(() => {
7+
const themeObserver = new MutationObserver(mutations => {
8+
mutations.forEach(mutation => {
9+
if (
10+
mutation.type === 'attributes' &&
11+
mutation.attributeName === 'data-theme'
12+
) {
13+
setTheme(mutation.target.getAttribute('data-theme'));
14+
}
15+
});
16+
});
17+
18+
const htmlElement = document.documentElement;
19+
themeObserver.observe(htmlElement, {
20+
attributes: true,
21+
});
22+
23+
return () => themeObserver.disconnect();
24+
}, []);
25+
26+
return (
27+
<img
28+
src={theme === 'dark' ? darkSrc : lightSrc}
29+
alt={alt}
30+
className={className}
31+
/>
32+
);
33+
}
34+
35+
export default ThemeImage;

src/components/Chapters/index.tsx

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import React from 'react';
2+
3+
import ThemeImage from './ThemeImage';
4+
import Section from './Section';
5+
import SectionTitle from './SectionTitle';
6+
7+
import styles from './styles.module.css';
8+
9+
function Chapters() {
10+
return (
11+
<Section>
12+
<SectionTitle
13+
title="Cosa vuoi imparare oggi?"
14+
description={
15+
<>
16+
Ogni capitolo del libro, a portata di mano.
17+
</>
18+
}
19+
/>
20+
<div className={styles.cardContainer}>
21+
<div className={styles.card}>
22+
<ThemeImage
23+
lightSrc="/img/homepage/ide.svg"
24+
darkSrc="/img/homepage/ide.svg"
25+
className={styles.cardImage}
26+
alt="Icon of a terminal window with input and output"
27+
/>
28+
<div className={styles.cardContent}>
29+
<h4 className={styles.cardTitle}>Fondamenti di Python</h4>
30+
<p className={styles.cardDescription}>
31+
Come installare e usare Python, cos'è un IDE, come si scrive e si esegue un programma.
32+
</p>
33+
</div>
34+
</div>
35+
<div className={styles.card}>
36+
<ThemeImage
37+
lightSrc="/img/homepage/input-output_dark.svg"
38+
darkSrc="/img/homepage/input-output_dark.svg"
39+
className={styles.cardImage}
40+
alt=""
41+
/>
42+
<div className={styles.cardContent}>
43+
<h4 className={styles.cardTitle}>
44+
Le basi del linguaggio
45+
</h4>
46+
<p className={styles.cardDescription}>
47+
Input e output, le variabili, i tipi di dati, le operazioni aritmetiche e le espressioni.
48+
</p>
49+
</div>
50+
</div>
51+
</div>
52+
</Section>
53+
);
54+
}
55+
56+
export default Chapters;
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
.cardContainer {
2+
display: grid;
3+
gap: 2rem;
4+
margin: 2rem auto;
5+
grid-template-columns: repeat(3, 1fr);
6+
}
7+
8+
.card {
9+
border: 1px solid var(--home-border);
10+
border-radius: 12px;
11+
overflow: hidden;
12+
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.03);
13+
background-color: var(--home-background);
14+
display: flex;
15+
flex-direction: column;
16+
}
17+
18+
.cardContent {
19+
padding: 16px 24px;
20+
}
21+
22+
.cardTitle {
23+
margin-top: 10px;
24+
margin-bottom: 5px;
25+
font-size: 20px;
26+
line-height: 140%;
27+
}
28+
29+
.cardDescription {
30+
margin-top: 0;
31+
color: var(--home-secondary-text);
32+
font-size: 16px;
33+
line-height: 150%;
34+
}
35+
36+
@media only screen and (max-width: 900px) {
37+
.cardContainer {
38+
display: flex;
39+
flex-direction: column;
40+
}
41+
42+
.card {
43+
flex-direction: row;
44+
text-align: left;
45+
}
46+
47+
.cardImage {
48+
width: auto;
49+
height: 150px;
50+
margin: 1rem;
51+
border-radius: 0.5rem;
52+
border: 1px solid var(--home-border);
53+
}
54+
}
55+
56+
@media only screen and (max-width: 650px) {
57+
.card {
58+
flex-direction: column;
59+
text-align: center;
60+
align-items: center;
61+
}
62+
63+
.cardImage {
64+
margin-bottom: 0;
65+
max-width: calc(100% - 2rem);
66+
}
67+
}

0 commit comments

Comments
 (0)