Skip to content

Commit cce8771

Browse files
committed
Add FeatureDemo component
1 parent 149fcfe commit cce8771

File tree

4 files changed

+142
-3
lines changed

4 files changed

+142
-3
lines changed

theme/components/Landingpage/index.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { BackgroundImage } from '../background-image';
22
import { Hero } from '../hero';
3-
import CodeDemo from '../code-demo';
3+
// import CodeDemo from '../code-demo';
4+
import FeatureDemo from '../feature-demo';
45
import styles from './index.module.scss';
56

67
import { useCallback } from 'react';
@@ -38,7 +39,18 @@ const LandingPage = () => {
3839
githubURL="https://github.com/aiscriptdev/aiscript"
3940
onClickGetStarted={onClickGetStarted}
4041
/>
41-
<CodeDemo code={demoCode} filename='main.ai' />
42+
<FeatureDemo
43+
title='AI Native'
44+
description='AIscript is designed to be the first-class language for AI development. It is designed to be easy to learn and use, and it is designed to be fast and efficient.'
45+
code={demoCode}
46+
filename='main.ai' />
47+
48+
<FeatureDemo
49+
title='AI Native'
50+
description='AIscript is designed to be the first-class language for AI development. It is designed to be easy to learn and use, and it is designed to be fast and efficient.'
51+
code={demoCode}
52+
isReversed={true}
53+
filename='main.ai' />
4254
</div>
4355
);
4456
};

theme/components/code-demo/index.module.scss

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
.codeDemo {
22
margin: 2rem auto;
3-
max-width: 800px;
3+
max-width: 100%;
44
padding: 1rem;
55
border-radius: 8px;
66
overflow: hidden;
7+
8+
@media screen and (max-width: 768px) {
9+
padding: 0.25rem;
10+
margin: 0.5rem auto;
11+
border-radius: 4px;
12+
}
713
}
814

915
.filename {
@@ -14,6 +20,13 @@
1420
padding: 0.75rem 1.5rem;
1521
border-top-left-radius: 8px;
1622
border-top-right-radius: 8px;
23+
24+
@media screen and (max-width: 768px) {
25+
font-size: 0.75rem;
26+
padding: 0.5rem 0.75rem;
27+
border-top-left-radius: 4px;
28+
border-top-right-radius: 4px;
29+
}
1730
}
1831

1932
.codeContainer {
@@ -22,6 +35,13 @@
2235
border-top-left-radius: 0;
2336
border-top-right-radius: 0;
2437
overflow: auto;
38+
-webkit-overflow-scrolling: touch;
39+
40+
@media screen and (max-width: 768px) {
41+
border-radius: 4px;
42+
border-top-left-radius: 0;
43+
border-top-right-radius: 0;
44+
}
2545

2646
&:has(+ .filename) {
2747
border-top-left-radius: 0;
@@ -41,4 +61,12 @@
4161
color: #333;
4262
display: block;
4363
white-space: pre;
64+
65+
@media screen and (max-width: 768px) {
66+
font-size: 0.75rem;
67+
line-height: 1.4;
68+
white-space: pre-wrap;
69+
word-break: break-all;
70+
padding: 0.25rem;
71+
}
4472
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
.featureDemo {
2+
padding: 5rem 4rem;
3+
width: 100%;
4+
max-width: 1200px;
5+
margin: 0 auto;
6+
}
7+
8+
.container {
9+
display: flex;
10+
align-items: center;
11+
gap: 4rem;
12+
13+
&.reversed {
14+
flex-direction: row-reverse;
15+
}
16+
}
17+
18+
.content {
19+
flex: 0.8;
20+
}
21+
22+
.title {
23+
font-size: 2.5rem;
24+
font-weight: 700;
25+
margin-bottom: 1rem;
26+
background: linear-gradient(279deg, #ff8b00 35.21%, #f93920 63.34%);
27+
-webkit-background-clip: text;
28+
-webkit-text-fill-color: transparent;
29+
}
30+
31+
.description {
32+
font-size: 1.2rem;
33+
line-height: 1.6;
34+
color: var(--rstack-hero-desc-color, #6b7075);
35+
margin: 0;
36+
}
37+
38+
.codeWrapper {
39+
flex: 1.2;
40+
min-width: 0;
41+
}
42+
43+
@media screen and (max-width: 768px) {
44+
.featureDemo {
45+
padding: 4rem 2rem;
46+
}
47+
.container {
48+
flex-direction: column;
49+
gap: 2rem;
50+
51+
&.reversed {
52+
flex-direction: column;
53+
}
54+
}
55+
56+
.title {
57+
font-size: 2rem;
58+
text-align: center;
59+
}
60+
61+
.description {
62+
text-align: center;
63+
}
64+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { type FC } from 'react';
2+
import CodeDemo from '../code-demo';
3+
import styles from './index.module.scss';
4+
5+
interface FeatureDemoProps {
6+
title: string;
7+
description: string;
8+
code: string;
9+
filename?: string;
10+
isReversed?: boolean;
11+
}
12+
13+
const FeatureDemo: FC<FeatureDemoProps> = ({
14+
title,
15+
description,
16+
code,
17+
filename,
18+
isReversed = false,
19+
}) => {
20+
return (
21+
<div className={styles.featureDemo}>
22+
<div className={`${styles.container} ${isReversed ? styles.reversed : ''}`}>
23+
<div className={styles.content}>
24+
<h2 className={styles.title}>{title}</h2>
25+
<p className={styles.description}>{description}</p>
26+
</div>
27+
<div className={styles.codeWrapper}>
28+
<CodeDemo code={code} filename={filename} />
29+
</div>
30+
</div>
31+
</div>
32+
);
33+
};
34+
35+
export default FeatureDemo;

0 commit comments

Comments
 (0)