1
1
---
2
- import Particles from " astro-particles"
3
- import Layout from ' ../layouts/Layout.astro' ;
4
- import Card from ' ../components/Card.astro' ;
2
+ import Particles from " astro-particles" ;
3
+ import Layout from " ../layouts/Layout.astro" ;
4
+ import Card from " ../components/Card.astro" ;
5
5
import type { ISourceOptions } from " tsparticles-engine" ;
6
6
7
- const options: ISourceOptions = {
7
+ const options = {
8
8
background: {
9
- color: " #000 "
9
+ color: " #fff "
10
10
},
11
11
fullScreen: {
12
12
zIndex: - 1
13
13
},
14
14
particles: {
15
- number: {
16
- value: 100
17
- },
15
+ color: {
16
+ value: " #000"
17
+ },
18
+ links: {
19
+ color: " #000" ,
20
+ enable: true
21
+ },
22
+ number: {
23
+ value: 100
24
+ },
18
25
move: {
19
26
enable: true
20
27
}
@@ -23,88 +30,94 @@ const options: ISourceOptions = {
23
30
---
24
31
25
32
<script >
26
- import { tsParticles } from "tsparticles-engine";
33
+ import { type Engine, tsParticles } from "tsparticles-engine";
27
34
import { loadFull } from "tsparticles";
28
35
29
- ( async () => {
30
- await loadFull(tsParticles );
31
- })() ;
36
+ window.particlesInit = async (engine: Engine ) => {
37
+ await loadFull(engine );
38
+ };
32
39
</script >
33
40
34
41
<Layout title =" Welcome to Astro." >
35
- <main >
36
- <Particles id =" tsparticles" options ={ options } />
37
- <h1 >Welcome to <span class =" text-gradient" >Astro</span ></h1 >
38
- <p class =" instructions" >
39
- To get started, open the directory <code >src/pages</code > in your project.<br />
40
- <strong >Code Challenge:</strong > Tweak the "Welcome to Astro" message above.
41
- </p >
42
- <ul role =" list" class =" link-card-grid" >
43
- <Card
44
- href =" https://docs.astro.build/"
45
- title =" Documentation"
46
- body =" Learn how Astro works and explore the official API docs."
47
- />
48
- <Card
49
- href =" https://astro.build/integrations/"
50
- title =" Integrations"
51
- body =" Supercharge your project with new frameworks and libraries."
52
- />
53
- <Card
54
- href =" https://astro.build/themes/"
55
- title =" Themes"
56
- body =" Explore a galaxy of community-built starter themes."
57
- />
58
- <Card
59
- href =" https://astro.build/chat/"
60
- title =" Community"
61
- body =" Come say hi to our amazing Discord community. ❤️"
62
- />
63
- </ul >
64
- </main >
42
+ <main >
43
+ <Particles id =" tsparticles" options ={ options } init = " particlesInit " />
44
+ <h1 >Welcome to <span class =" text-gradient" >Astro</span ></h1 >
45
+ <p class =" instructions" >
46
+ To get started, open the directory <code >src/pages</code > in your project.<br />
47
+ <strong >Code Challenge:</strong > Tweak the "Welcome to Astro" message above.
48
+ </p >
49
+ <ul role =" list" class =" link-card-grid" >
50
+ <Card
51
+ href =" https://docs.astro.build/"
52
+ title =" Documentation"
53
+ body =" Learn how Astro works and explore the official API docs."
54
+ />
55
+ <Card
56
+ href =" https://astro.build/integrations/"
57
+ title =" Integrations"
58
+ body =" Supercharge your project with new frameworks and libraries."
59
+ />
60
+ <Card
61
+ href =" https://astro.build/themes/"
62
+ title =" Themes"
63
+ body =" Explore a galaxy of community-built starter themes."
64
+ />
65
+ <Card
66
+ href =" https://astro.build/chat/"
67
+ title =" Community"
68
+ body =" Come say hi to our amazing Discord community. ❤️"
69
+ />
70
+ </ul >
71
+ </main >
65
72
</Layout >
66
73
67
74
<style >
68
- main {
69
- margin: auto;
70
- padding: 1.5rem;
71
- max-width: 60ch;
72
- }
73
- h1 {
74
- font-size: 3rem;
75
- font-weight: 800;
76
- margin: 0;
77
- }
78
- .text-gradient {
79
- background-image: var(--accent-gradient);
80
- -webkit-background-clip: text;
81
- -webkit-text-fill-color: transparent;
82
- background-size: 400%;
83
- background-position: 0%;
84
- }
85
- .instructions {
86
- line-height: 1.6;
87
- margin: 1rem 0;
88
- border: 1px solid rgba(var(--accent), 25%);
89
- background-color: white;
90
- padding: 1rem;
91
- border-radius: 0.4rem;
92
- }
93
- .instructions code {
94
- font-size: 0.875em;
95
- font-weight: bold;
96
- background: rgba(var(--accent), 12%);
97
- color: rgb(var(--accent));
98
- border-radius: 4px;
99
- padding: 0.3em 0.45em;
100
- }
101
- .instructions strong {
102
- color: rgb(var(--accent));
103
- }
104
- .link-card-grid {
105
- display: grid;
106
- grid-template-columns: repeat(auto-fit, minmax(24ch, 1fr));
107
- gap: 1rem;
108
- padding: 0;
109
- }
75
+ main {
76
+ margin: auto;
77
+ padding: 1.5rem;
78
+ max-width: 60ch;
79
+ }
80
+
81
+ h1 {
82
+ font-size: 3rem;
83
+ font-weight: 800;
84
+ margin: 0;
85
+ }
86
+
87
+ .text-gradient {
88
+ background-image: var(--accent-gradient);
89
+ -webkit-background-clip: text;
90
+ -webkit-text-fill-color: transparent;
91
+ background-size: 400%;
92
+ background-position: 0%;
93
+ }
94
+
95
+ .instructions {
96
+ line-height: 1.6;
97
+ margin: 1rem 0;
98
+ border: 1px solid rgba(var(--accent), 25%);
99
+ background-color: white;
100
+ padding: 1rem;
101
+ border-radius: 0.4rem;
102
+ }
103
+
104
+ .instructions code {
105
+ font-size: 0.875em;
106
+ font-weight: bold;
107
+ background: rgba(var(--accent), 12%);
108
+ color: rgb(var(--accent));
109
+ border-radius: 4px;
110
+ padding: 0.3em 0.45em;
111
+ }
112
+
113
+ .instructions strong {
114
+ color: rgb(var(--accent));
115
+ }
116
+
117
+ .link-card-grid {
118
+ display: grid;
119
+ grid-template-columns: repeat(auto-fit, minmax(24ch, 1fr));
120
+ gap: 1rem;
121
+ padding: 0;
122
+ }
110
123
</style >
0 commit comments