CarbonO2 commited on
Commit
d9194f8
·
verified ·
1 Parent(s): 100befc

Upload components/PlanetInfo.jsx with huggingface_hub

Browse files
Files changed (1) hide show
  1. components/PlanetInfo.jsx +176 -0
components/PlanetInfo.jsx ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React from 'react';
2
+ import { X, Orbit, Globe, Calendar, Wind, Thermometer } from 'lucide-react';
3
+
4
+ const PlanetInfo = ({ planet, onClose }) => {
5
+ if (!planet) return null;
6
+
7
+ const planetData = {
8
+ mercury: {
9
+ name: "Mercury",
10
+ description: "The smallest planet in the Solar System and the closest to the Sun. It is only slightly larger than Earth's Moon.",
11
+ facts: {
12
+ diameter: "4,879 km",
13
+ distance: "57.9 million km",
14
+ orbit: "88 Earth days",
15
+ temperature: "-173°C to 427°C",
16
+ moons: "0"
17
+ },
18
+ color: "bg-gray-400"
19
+ },
20
+ venus: {
21
+ name: "Venus",
22
+ description: "The second planet from the Sun. It has a thick atmosphere that traps heat, making it the hottest planet.",
23
+ facts: {
24
+ diameter: "12,104 km",
25
+ distance: "108.2 million km",
26
+ orbit: "225 Earth days",
27
+ temperature: "462°C",
28
+ moons: "0"
29
+ },
30
+ color: "bg-yellow-200"
31
+ },
32
+ earth: {
33
+ name: "Earth",
34
+ description: "Our home planet! The third planet from the Sun and the only place we know of so far that’s inhabited by living things.",
35
+ facts: {
36
+ diameter: "12,742 km",
37
+ distance: "149.6 million km",
38
+ orbit: "365.25 days",
39
+ temperature: "-88°C to 58°C",
40
+ moons: "1"
41
+ },
42
+ color: "bg-blue-400"
43
+ },
44
+ mars: {
45
+ name: "Mars",
46
+ description: "The fourth planet from the Sun and the second-smallest planet. It's often called the 'Red Planet'.",
47
+ facts: {
48
+ diameter: "6,779 km",
49
+ distance: "227.9 million km",
50
+ orbit: "687 Earth days",
51
+ temperature: "-113°C to 35°C",
52
+ moons: "2"
53
+ },
54
+ color: "bg-red-500"
55
+ },
56
+ jupiter: {
57
+ name: "Jupiter",
58
+ description: "The largest planet in the Solar System. A gas giant with a mass one-thousandth that of the Sun.",
59
+ facts: {
60
+ diameter: "139,820 km",
61
+ distance: "778.5 million km",
62
+ orbit: "11.86 Earth years",
63
+ temperature: "-108°C",
64
+ moons: "79"
65
+ },
66
+ color: "bg-orange-200"
67
+ },
68
+ saturn: {
69
+ name: "Saturn",
70
+ description: "The sixth planet from the Sun and the second-largest. It's famous for its prominent ring system.",
71
+ facts: {
72
+ diameter: "116,460 km",
73
+ distance: "1.4 billion km",
74
+ orbit: "29.45 Earth years",
75
+ temperature: "-139°C",
76
+ moons: "82"
77
+ },
78
+ color: "bg-yellow-100"
79
+ },
80
+ uranus: {
81
+ name: "Uranus",
82
+ description: "The seventh planet from the Sun. It has the third-largest planetary radius and fourth-largest planetary mass.",
83
+ facts: {
84
+ diameter: "50,724 km",
85
+ distance: "2.9 billion km",
86
+ orbit: "84 Earth years",
87
+ temperature: "-197°C",
88
+ moons: "27"
89
+ },
90
+ color: "bg-cyan-300"
91
+ },
92
+ neptune: {
93
+ name: "Neptune",
94
+ description: "The eighth and farthest-known solar planet from the Sun. It's known for its strong winds.",
95
+ facts: {
96
+ diameter: "49,244 km",
97
+ distance: "4.5 billion km",
98
+ orbit: "164.8 Earth years",
99
+ temperature: "-201°C",
100
+ moons: "14"
101
+ },
102
+ color: "bg-blue-500"
103
+ }
104
+ };
105
+
106
+ const data = planetData[planet.toLowerCase()] || planetData.earth;
107
+
108
+ return (
109
+ <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm p-4">
110
+ <div className="bg-gray-900 rounded-2xl border border-white/10 w-full max-w-2xl max-h-[90vh] overflow-y-auto shadow-2xl">
111
+ <div className="relative">
112
+ <div className={`h-32 ${data.color} relative overflow-hidden`}>
113
+ <div className="absolute inset-0 bg-gradient-to-b from-transparent to-gray-900/80" />
114
+ <button
115
+ onClick={onClose}
116
+ className="absolute top-4 right-4 text-white/70 hover:text-white p-2 rounded-full hover:bg-white/10"
117
+ >
118
+ <X className="h-6 w-6" />
119
+ </button>
120
+ <div className="absolute bottom-6 left-6">
121
+ <h2 className="text-4xl font-bold text-white mb-2">{data.name}</h2>
122
+ <p className="text-white/80 text-lg max-w-xl">{data.description}</p>
123
+ </div>
124
+ </div>
125
+
126
+ <div className="p-6">
127
+ <h3 className="text-xl font-semibold text-white mb-4">Key Statistics</h3>
128
+ <div className="grid grid-cols-2 md:grid-cols-3 gap-4">
129
+ <div className="bg-gray-800/50 p-4 rounded-xl">
130
+ <Globe className="h-6 w-6 text-blue-400 mb-2" />
131
+ <p className="text-gray-400 text-sm">Diameter</p>
132
+ <p className="text-white font-medium">{data.facts.diameter}</p>
133
+ </div>
134
+ <div className="bg-gray-800/50 p-4 rounded-xl">
135
+ <Orbit className="h-6 w-6 text-purple-400 mb-2" />
136
+ <p className="text-gray-400 text-sm">Distance from Sun</p>
137
+ <p className="text-white font-medium">{data.facts.distance}</p>
138
+ </div>
139
+ <div className="bg-gray-800/50 p-4 rounded-xl">
140
+ <Calendar className="h-6 w-6 text-green-400 mb-2" />
141
+ <p className="text-gray-400 text-sm">Orbit Period</p>
142
+ <p className="text-white font-medium">{data.facts.orbit}</p>
143
+ </div>
144
+ <div className="bg-gray-800/50 p-4 rounded-xl">
145
+ <Thermometer className="h-6 w-6 text-red-400 mb-2" />
146
+ <p className="text-gray-400 text-sm">Temperature</p>
147
+ <p className="text-white font-medium">{data.facts.temperature}</p>
148
+ </div>
149
+ <div className="bg-gray-800/50 p-4 rounded-xl">
150
+ <Wind className="h-6 w-6 text-cyan-400 mb-2" />
151
+ <p className="text-gray-400 text-sm">Moons</p>
152
+ <p className="text-white font-medium">{data.facts.moons}</p>
153
+ </div>
154
+ </div>
155
+
156
+ <div className="mt-8 p-6 bg-gradient-to-r from-blue-900/20 to-purple-900/20 rounded-xl border border-white/5">
157
+ <h3 className="text-lg font-medium text-white mb-2">Did You Know?</h3>
158
+ <p className="text-gray-300">
159
+ {planet.toLowerCase() === 'venus' && "Venus is the hottest planet in our solar system, with surface temperatures around 462°C (864°F), hot enough to melt lead!"}
160
+ {planet.toLowerCase() === 'jupiter' && "Jupiter is so large that all the other planets in the solar system could fit inside it!"}
161
+ {planet.toLowerCase() === 'saturn' && "Saturn's rings are made mostly of ice particles, with some rock and dust mixed in."}
162
+ {planet.toLowerCase() === 'earth' && "Earth is the only planet known to support life and the only one with liquid water on its surface."}
163
+ {planet.toLowerCase() === 'mars' && "Mars is home to Olympus Mons, the tallest volcano in the solar system, standing nearly 22 km (13.6 miles) high."}
164
+ {planet.toLowerCase() === 'mercury' && "Mercury is the smallest planet and has the most extreme temperature swings, from -173°C to 427°C."}
165
+ {planet.toLowerCase() === 'uranus' && "Uranus rotates on its side, with its axis tilted at 98 degrees, making it unique among the planets."}
166
+ {planet.toLowerCase() === 'neptune' && "Neptune has the strongest winds in the solar system, reaching speeds of up to 2,100 km/h (1,300 mph)."}
167
+ </p>
168
+ </div>
169
+ </div>
170
+ </div>
171
+ </div>
172
+ </div>
173
+ );
174
+ };
175
+
176
+ export default PlanetInfo;