Skip to content

Commit be528d5

Browse files
committed
Make feature group item alternate reversed
1 parent d942614 commit be528d5

File tree

3 files changed

+92
-13
lines changed

3 files changed

+92
-13
lines changed
Lines changed: 76 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,88 @@
11
{
2-
"features": [
2+
"ai": [
33
{
4-
"title": "AI Native",
4+
"title": "Prompt",
55
"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.",
66
"code": "// Define a function that takes a prompt and returns a response\nfn generate_response(prompt: string) -> string {\n // Call the AI model to generate a response\n let response = ai.generate({\n model: \"gpt-4\",\n prompt: prompt,\n max_tokens: 100\n });\n \n return response;\n}\n\n// Example usage\nlet result = generate_response(\"Tell me a joke\");\nprint(result);",
77
"filename": "main.ai"
88
},
99
{
10-
"title": "Type Safe",
10+
"title": "AI Function",
1111
"description": "AIscript comes with a powerful type system that helps catch errors before they happen. The type system is designed to be intuitive and easy to use.",
1212
"code": "// Define a function that takes a prompt and returns a response\nfn generate_response(prompt: string) -> string {\n // Call the AI model to generate a response\n let response = ai.generate({\n model: \"gpt-4\",\n prompt: prompt,\n max_tokens: 100\n });\n \n return response;\n}\n\n// Example usage\nlet result = generate_response(\"Tell me a joke\");\nprint(result);",
13-
"filename": "main.ai",
14-
"isReversed": true
13+
"filename": "main.ai"
14+
},
15+
{
16+
"title": "Agent",
17+
"description": "AIscript comes with a powerful type system that helps catch errors before they happen. The type system is designed to be intuitive and easy to use.",
18+
"code": "// Define a function that takes a prompt and returns a response\nfn generate_response(prompt: string) -> string {\n // Call the AI model to generate a response\n let response = ai.generate({\n model: \"gpt-4\",\n prompt: prompt,\n max_tokens: 100\n });\n \n return response;\n}\n\n// Example usage\nlet result = generate_response(\"Tell me a joke\");\nprint(result);",
19+
"filename": "main.ai"
20+
}
21+
],
22+
"web": [
23+
{
24+
"title": "Route DSL",
25+
"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.",
26+
"code": "// Define a function that takes a prompt and returns a response\nfn generate_response(prompt: string) -> string {\n // Call the AI model to generate a response\n let response = ai.generate({\n model: \"gpt-4\",\n prompt: prompt,\n max_tokens: 100\n });\n \n return response;\n}\n\n// Example usage\nlet result = generate_response(\"Tell me a joke\");\nprint(result);",
27+
"filename": "main.ai"
28+
},
29+
{
30+
"title": "Validator",
31+
"description": "AIscript comes with a powerful type system that helps catch errors before they happen. The type system is designed to be intuitive and easy to use.",
32+
"code": "// Define a function that takes a prompt and returns a response\nfn generate_response(prompt: string) -> string {\n // Call the AI model to generate a response\n let response = ai.generate({\n model: \"gpt-4\",\n prompt: prompt,\n max_tokens: 100\n });\n \n return response;\n}\n\n// Example usage\nlet result = generate_response(\"Tell me a joke\");\nprint(result);",
33+
"filename": "main.ai"
34+
},
35+
{
36+
"title": "OpenAPI",
37+
"description": "AIscript comes with a powerful type system that helps catch errors before they happen. The type system is designed to be intuitive and easy to use.",
38+
"code": "// Define a function that takes a prompt and returns a response\nfn generate_response(prompt: string) -> string {\n // Call the AI model to generate a response\n let response = ai.generate({\n model: \"gpt-4\",\n prompt: prompt,\n max_tokens: 100\n });\n \n return response;\n}\n\n// Example usage\nlet result = generate_response(\"Tell me a joke\");\nprint(result);",
39+
"filename": "main.ai"
40+
},
41+
{
42+
"title": "Effortless Social Login",
43+
"description": "AIscript comes with a powerful type system that helps catch errors before they happen. The type system is designed to be intuitive and easy to use.",
44+
"code": "// Define a function that takes a prompt and returns a response\nfn generate_response(prompt: string) -> string {\n // Call the AI model to generate a response\n let response = ai.generate({\n model: \"gpt-4\",\n prompt: prompt,\n max_tokens: 100\n });\n \n return response;\n}\n\n// Example usage\nlet result = generate_response(\"Tell me a joke\");\nprint(result);",
45+
"filename": "main.ai"
46+
}
47+
],
48+
"language": [
49+
{
50+
"title": "Enum",
51+
"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.",
52+
"code": "// Define a function that takes a prompt and returns a response\nfn generate_response(prompt: string) -> string {\n // Call the AI model to generate a response\n let response = ai.generate({\n model: \"gpt-4\",\n prompt: prompt,\n max_tokens: 100\n });\n \n return response;\n}\n\n// Example usage\nlet result = generate_response(\"Tell me a joke\");\nprint(result);",
53+
"filename": "main.ai"
54+
},
55+
{
56+
"title": "Pipe Operator",
57+
"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.",
58+
"code": "// Define a function that takes a prompt and returns a response\nfn generate_response(prompt: string) -> string {\n // Call the AI model to generate a response\n let response = ai.generate({\n model: \"gpt-4\",\n prompt: prompt,\n max_tokens: 100\n });\n \n return response;\n}\n\n// Example usage\nlet result = generate_response(\"Tell me a joke\");\nprint(result);",
59+
"filename": "main.ai"
60+
},
61+
{
62+
"title": "Error handling",
63+
"description": "AIscript comes with a powerful type system that helps catch errors before they happen. The type system is designed to be intuitive and easy to use.",
64+
"code": "// Define a function that takes a prompt and returns a response\nfn generate_response(prompt: string) -> string {\n // Call the AI model to generate a response\n let response = ai.generate({\n model: \"gpt-4\",\n prompt: prompt,\n max_tokens: 100\n });\n \n return response;\n}\n\n// Example usage\nlet result = generate_response(\"Tell me a joke\");\nprint(result);",
65+
"filename": "main.ai"
66+
}
67+
],
68+
"std-library": [
69+
{
70+
"title": "Database",
71+
"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.",
72+
"code": "// Define a function that takes a prompt and returns a response\nfn generate_response(prompt: string) -> string {\n // Call the AI model to generate a response\n let response = ai.generate({\n model: \"gpt-4\",\n prompt: prompt,\n max_tokens: 100\n });\n \n return response;\n}\n\n// Example usage\nlet result = generate_response(\"Tell me a joke\");\nprint(result);",
73+
"filename": "main.ai"
74+
},
75+
{
76+
"title": "Redis",
77+
"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.",
78+
"code": "// Define a function that takes a prompt and returns a response\nfn generate_response(prompt: string) -> string {\n // Call the AI model to generate a response\n let response = ai.generate({\n model: \"gpt-4\",\n prompt: prompt,\n max_tokens: 100\n });\n \n return response;\n}\n\n// Example usage\nlet result = generate_response(\"Tell me a joke\");\nprint(result);",
79+
"filename": "main.ai"
80+
},
81+
{
82+
"title": "Builtin functions",
83+
"description": "AIscript comes with a powerful type system that helps catch errors before they happen. The type system is designed to be intuitive and easy to use.",
84+
"code": "// Define a function that takes a prompt and returns a response\nfn generate_response(prompt: string) -> string {\n // Call the AI model to generate a response\n let response = ai.generate({\n model: \"gpt-4\",\n prompt: prompt,\n max_tokens: 100\n });\n \n return response;\n}\n\n// Example usage\nlet result = generate_response(\"Tell me a joke\");\nprint(result);",
85+
"filename": "main.ai"
1586
}
1687
]
1788
}

theme/components/Landingpage/index.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import styles from './index.module.scss';
55

66
import { useCallback } from 'react';
77
import { useNavigate } from 'rspress/runtime';
8-
import { features } from './features.json';
8+
import featureData from './features.json';
99

1010
const LandingPage = () => {
1111
const navigate = useNavigate();
@@ -23,7 +23,15 @@ const LandingPage = () => {
2323
githubURL="https://github.com/aiscriptdev/aiscript"
2424
onClickGetStarted={onClickGetStarted}
2525
/>
26-
<FeatureGroup features={features} />
26+
{
27+
Object.entries(featureData).map(([key, features], index) => {
28+
const featureList = features.map((feature) => ({
29+
...feature,
30+
isReversed: index % 2 === 0,
31+
}));
32+
return <FeatureGroup key={key} features={featureList} />;
33+
})
34+
}
2735
</div>
2836
);
2937
};

theme/components/feature-group/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface FeatureGroupProps {
1616

1717
const FeatureGroup: FC<FeatureGroupProps> = ({ features }) => {
1818
const [activeIndex, setActiveIndex] = useState(0);
19-
19+
const feature = features[activeIndex];
2020
return (
2121
<div className={styles.featureGroup}>
2222
<div className={styles.tabs}>
@@ -31,11 +31,11 @@ const FeatureGroup: FC<FeatureGroupProps> = ({ features }) => {
3131
))}
3232
</div>
3333
<FeatureDemo
34-
title={features[activeIndex].title}
35-
description={features[activeIndex].description}
36-
code={features[activeIndex].code}
37-
filename={features[activeIndex].filename}
38-
isReversed={features[activeIndex].isReversed}
34+
title={feature.title}
35+
description={feature.description}
36+
code={feature.code}
37+
filename={feature.filename}
38+
isReversed={feature.isReversed}
3939
/>
4040
</div>
4141
);

0 commit comments

Comments
 (0)