ntphuc149 commited on
Commit
420aee8
·
verified ·
1 Parent(s): 7f8a48e

Update src/App.js

Browse files
Files changed (1) hide show
  1. src/App.js +6 -336
src/App.js CHANGED
@@ -1,342 +1,12 @@
1
  import React, { useState } from 'react';
 
2
 
3
- const HoroscopeApp = () => {
4
- const [selectedSign, setSelectedSign] = useState('taurus');
5
- const [selectedGender, setSelectedGender] = useState('female');
6
- const [selectedPeriod, setSelectedPeriod] = useState('today');
7
- const [selectedCategory, setSelectedCategory] = useState('love');
8
- const [isDarkMode, setIsDarkMode] = useState(false);
9
-
10
- const zodiacSigns = [
11
- { id: 'taurus', name: 'Taurus', dates: 'April 20 - May 20', emoji: '🐂', image: 'http://cbx-prod.b-cdn.net/COLOURBOX42780190.jpg?width=800&height=800&quality=70' },
12
- { id: 'sagittarius', name: 'Sagittarius', dates: 'Nov 22 - Dec 21', emoji: '🏹', image: null },
13
- { id: 'pisces', name: 'Pisces', dates: 'Feb 19 - Mar 20', emoji: '🐠', image: null },
14
- { id: 'libra', name: 'Libra', dates: 'Sep 23 - Oct 22', emoji: '⚖️', image: null },
15
- { id: 'gemini', name: 'Gemini', dates: 'May 21 - Jun 20', emoji: '👯', image: null },
16
- { id: 'leo', name: 'Leo', dates: 'Jul 23 - Aug 22', emoji: '🦁', image: null },
17
- { id: 'virgo', name: 'Virgo', dates: 'Aug 23 - Sep 22', emoji: '👸', image: null },
18
- { id: 'aquarius', name: 'Aquarius', dates: 'Jan 20 - Feb 18', emoji: '🏺', image: null },
19
- { id: 'aries', name: 'Aries', dates: 'Mar 21 - Apr 19', emoji: '🐏', image: null },
20
- { id: 'cancer', name: 'Cancer', dates: 'Jun 21 - Jul 22', emoji: '🦀', image: null },
21
- { id: 'scorpio', name: 'Scorpio', dates: 'Oct 23 - Nov 21', emoji: '🦂', image: null },
22
- { id: 'capricorn', name: 'Capricorn', dates: 'Dec 22 - Jan 19', emoji: '🐐', image: null }
23
- ];
24
-
25
- const periods = [
26
- { id: 'today', name: 'Today' },
27
- { id: 'week', name: 'Week' },
28
- { id: 'month', name: 'Month' },
29
- { id: 'year', name: 'Year' }
30
- ];
31
-
32
- const categories = [
33
- { id: 'love', name: 'Love', icon: '💖' },
34
- { id: 'health', name: 'Health', icon: '🌟' },
35
- { id: 'relationship', name: 'Relationship', icon: '👥' },
36
- { id: 'finance', name: 'Finance', icon: '💰' }
37
- ];
38
-
39
- const horoscopeContent = {
40
- love: {
41
- today: "Love is in the air today! Your romantic side is highlighted, making it a perfect day for expressing your feelings.",
42
- week: "This week brings romantic opportunities and deepening connections with your loved ones.",
43
- month: "A month of passionate encounters and meaningful relationships awaits you.",
44
- year: "This year will be transformative for your love life, bringing lasting happiness."
45
- },
46
- health: {
47
- today: "Your energy levels are high today. Focus on maintaining balance between work and rest.",
48
- week: "Pay attention to your physical wellbeing this week. Small changes can make big differences.",
49
- month: "This month emphasizes the importance of mental and physical health harmony.",
50
- year: "A year of wellness and vitality lies ahead. Make health your priority."
51
- },
52
- relationship: {
53
- today: "Relationships flourish under today's cosmic energy. Communication is key to success.",
54
- week: "Strengthen your bonds with family and friends through meaningful conversations.",
55
- month: "Social connections expand this month, bringing new friendships and opportunities.",
56
- year: "Your social circle will grow significantly, enriching your life in unexpected ways."
57
- },
58
- finance: {
59
- today: "Financial opportunities present themselves today. Stay alert for new possibilities.",
60
- week: "This week favors careful financial planning and smart investments.",
61
- month: "Money matters require attention this month. Budget wisely for future security.",
62
- year: "Financial growth and stability are highlighted throughout this year."
63
- }
64
- };
65
-
66
- const luckyData = {
67
- colors: ['Green', 'Blue', 'Purple', 'Gold', 'Silver', 'Red', 'Pink', 'Orange', 'Yellow', 'Turquoise', 'Violet', 'Indigo'],
68
- numbers: [1, 3, 7, 9, 11, 13, 21, 23, 27, 33, 42, 77],
69
- stones: ['Emerald', 'Sapphire', 'Ruby', 'Diamond', 'Amethyst', 'Topaz', 'Opal', 'Pearl', 'Garnet', 'Aquamarine', 'Citrine', 'Turquoise'],
70
- moods: ['Optimistic', 'Energetic', 'Peaceful', 'Confident', 'Creative', 'Adventurous', 'Romantic', 'Focused', 'Joyful', 'Balanced', 'Inspired', 'Harmonious']
71
- };
72
-
73
- const getCurrentSign = () => {
74
- return zodiacSigns.find(sign => sign.id === selectedSign);
75
- };
76
-
77
- const getHoroscopeText = () => {
78
- return horoscopeContent[selectedCategory][selectedPeriod];
79
- };
80
-
81
- const getLuckyElement = (type) => {
82
- const data = luckyData[type];
83
- return data[Math.floor(Math.random() * data.length)];
84
- };
85
-
86
- const getPeriodTitle = () => {
87
- const titles = {
88
- today: 'Horoscope for Today',
89
- week: 'Horoscope for This Week',
90
- month: 'Horoscope for This Month',
91
- year: 'Horoscope for This Year'
92
- };
93
- return titles[selectedPeriod];
94
- };
95
-
96
- const toggleTheme = () => {
97
- setIsDarkMode(!isDarkMode);
98
- };
99
-
100
  return (
101
- <div className={`min-h-screen transition-all duration-500 ${
102
- isDarkMode
103
- ? 'bg-gradient-to-br from-gray-900 via-blue-900 to-purple-900 text-white'
104
- : 'bg-gradient-to-br from-blue-50 via-purple-50 to-pink-50 text-gray-800'
105
- }`}>
106
- <div className="max-w-6xl mx-auto p-5">
107
- {/* Header Controls */}
108
- <div className="flex justify-between items-center mb-8">
109
- {/* Theme Toggle */}
110
- <button
111
- onClick={toggleTheme}
112
- className={`flex items-center gap-2 px-4 py-2 rounded-full font-medium transition-all duration-300 ${
113
- isDarkMode
114
- ? 'bg-white bg-opacity-10 text-white hover:bg-opacity-20'
115
- : 'bg-white bg-opacity-90 text-gray-700 hover:bg-opacity-100'
116
- } shadow-lg hover:scale-105`}
117
- >
118
- <span className="text-xl">{isDarkMode ? '☀️' : '🌙'}</span>
119
- {isDarkMode ? 'Light Mode' : 'Dark Mode'}
120
- </button>
121
-
122
- {/* Gender Selection */}
123
- <div className={`flex rounded-full p-1 shadow-lg ${
124
- isDarkMode ? 'bg-white bg-opacity-10' : 'bg-white bg-opacity-90'
125
- }`}>
126
- <button
127
- onClick={() => setSelectedGender('female')}
128
- className={`px-6 py-2 rounded-full font-medium transition-all ${
129
- selectedGender === 'female'
130
- ? 'bg-pink-400 text-white shadow-md'
131
- : isDarkMode ? 'text-white hover:text-pink-300' : 'text-gray-600 hover:text-pink-400'
132
- }`}
133
- >
134
- Female
135
- </button>
136
- <button
137
- onClick={() => setSelectedGender('male')}
138
- className={`px-6 py-2 rounded-full font-medium transition-all ${
139
- selectedGender === 'male'
140
- ? 'bg-blue-400 text-white shadow-md'
141
- : isDarkMode ? 'text-white hover:text-blue-300' : 'text-gray-600 hover:text-blue-400'
142
- }`}
143
- >
144
- Male
145
- </button>
146
- </div>
147
- </div>
148
-
149
- {/* App Title */}
150
- <div className="text-center mb-10">
151
- <div className="inline-flex items-center justify-center w-16 h-16 bg-gradient-to-r from-blue-400 to-purple-500 rounded-full mb-4 shadow-lg">
152
- <span className="text-2xl text-white">🔮</span>
153
- </div>
154
- <h1 className="text-4xl font-bold mb-2">Horoscope App</h1>
155
- </div>
156
-
157
- {/* Zodiac Signs Grid - Single Row */}
158
- <div className="flex justify-center gap-3 mb-10 overflow-x-auto pb-4">
159
- {zodiacSigns.map((sign) => (
160
- <div
161
- key={sign.id}
162
- onClick={() => setSelectedSign(sign.id)}
163
- className="flex flex-col items-center cursor-pointer transition-all duration-300 hover:scale-105 min-w-max"
164
- >
165
- <div className={`w-16 h-16 rounded-full p-1 transition-all ${
166
- selectedSign === sign.id
167
- ? 'shadow-lg'
168
- : ''
169
- }`}
170
- style={{
171
- background: selectedSign === sign.id
172
- ? 'linear-gradient(135deg, #1D3249 0%, #96D1E2 100%)'
173
- : 'linear-gradient(135deg, #07090A 0%, #979999 100%)'
174
- }}>
175
- <div className={`w-full h-full rounded-full flex items-center justify-center text-xl overflow-hidden ${
176
- isDarkMode ? 'bg-gray-800' : 'bg-gray-100'
177
- }`}>
178
- {sign.image ? (
179
- <img
180
- src={sign.image}
181
- alt={sign.name}
182
- className="w-full h-full object-cover rounded-full"
183
- onError={(e) => {
184
- e.target.style.display = 'none';
185
- e.target.nextSibling.style.display = 'block';
186
- }}
187
- />
188
- ) : null}
189
- <span style={{ display: sign.image ? 'none' : 'block' }}>
190
- {sign.emoji}
191
- </span>
192
- </div>
193
- </div>
194
- <p className="text-xs font-medium mt-2 text-center">{sign.name}</p>
195
- </div>
196
- ))}
197
- </div>
198
-
199
- {/* Period Selection */}
200
- <div className="flex justify-center mb-8">
201
- <div className={`flex rounded-full p-1 shadow-lg ${
202
- isDarkMode ? 'bg-white bg-opacity-10' : 'bg-white bg-opacity-90'
203
- }`}>
204
- {periods.map((period) => (
205
- <button
206
- key={period.id}
207
- onClick={() => setSelectedPeriod(period.id)}
208
- className={`px-6 py-3 rounded-full font-medium transition-all ${
209
- selectedPeriod === period.id
210
- ? 'bg-blue-400 text-white shadow-md'
211
- : isDarkMode ? 'text-white hover:text-blue-300' : 'text-gray-600 hover:text-blue-400'
212
- }`}
213
- >
214
- {period.name}
215
- </button>
216
- ))}
217
- </div>
218
- </div>
219
-
220
- {/* Category Selection */}
221
- <div className="flex justify-center flex-wrap gap-3 mb-10">
222
- {categories.map((category) => (
223
- <button
224
- key={category.id}
225
- onClick={() => setSelectedCategory(category.id)}
226
- className={`flex items-center gap-2 px-4 py-2 rounded-full font-medium transition-all duration-300 shadow-lg hover:scale-105 ${
227
- selectedCategory === category.id
228
- ? 'bg-purple-400 text-white shadow-lg'
229
- : isDarkMode
230
- ? 'bg-white bg-opacity-10 text-white hover:bg-opacity-20'
231
- : 'bg-white bg-opacity-90 text-gray-600 hover:bg-opacity-100'
232
- }`}
233
- >
234
- <span>{category.icon}</span>
235
- {category.name}
236
- </button>
237
- ))}
238
- </div>
239
-
240
- {/* Horoscope Content */}
241
- <div className={`rounded-3xl p-8 mb-4 shadow-2xl backdrop-blur-lg transition-all ${
242
- isDarkMode
243
- ? 'bg-white bg-opacity-10 border border-white border-opacity-20'
244
- : 'bg-white bg-opacity-95'
245
- }`}>
246
- <div className="flex items-center gap-6 mb-8">
247
- <div className="w-16 h-16 rounded-full p-1 shadow-lg"
248
- style={{
249
- background: 'linear-gradient(135deg, #1D3249 0%, #96D1E2 100%)'
250
- }}>
251
- <div className={`w-full h-full rounded-full flex items-center justify-center text-2xl overflow-hidden ${
252
- isDarkMode ? 'bg-gray-800' : 'bg-gray-100'
253
- }`}>
254
- {getCurrentSign()?.image ? (
255
- <img
256
- src={getCurrentSign()?.image}
257
- alt={getCurrentSign()?.name}
258
- className="w-full h-full object-cover rounded-full"
259
- onError={(e) => {
260
- e.target.style.display = 'none';
261
- e.target.nextSibling.style.display = 'block';
262
- }}
263
- />
264
- ) : null}
265
- <span style={{ display: getCurrentSign()?.image ? 'none' : 'block' }}>
266
- {getCurrentSign()?.emoji}
267
- </span>
268
- </div>
269
- </div>
270
- <div className="flex-1">
271
- <h2 className="text-3xl font-bold text-blue-400 flex items-center gap-2 mb-2">
272
- {getPeriodTitle()}
273
- <span className="text-xl">📈</span>
274
- </h2>
275
- <div className="flex items-center gap-2">
276
- <span className="text-xl">{getCurrentSign()?.emoji}</span>
277
- <span className="font-semibold">{getCurrentSign()?.name}</span>
278
- </div>
279
- </div>
280
- </div>
281
-
282
- <p className={`font-medium mb-6 ${isDarkMode ? 'text-gray-300' : 'text-gray-600'}`}>
283
- {getCurrentSign()?.name} ({getCurrentSign()?.dates})
284
- </p>
285
-
286
- <p className="text-lg leading-relaxed mb-8">
287
- {getHoroscopeText()}
288
- </p>
289
-
290
- {/* Lucky Elements */}
291
- <div className={`grid grid-cols-2 md:grid-cols-4 gap-6 pt-6 border-t ${
292
- isDarkMode ? 'border-gray-700' : 'border-gray-200'
293
- }`}>
294
- <div className="text-center">
295
- <div className="text-3xl mb-3">🍀</div>
296
- <p className={`text-xs uppercase tracking-wider mb-2 ${
297
- isDarkMode ? 'text-gray-400' : 'text-gray-500'
298
- }`}>
299
- Lucky Color
300
- </p>
301
- <p className="font-bold text-green-500">{getLuckyElement('colors')}</p>
302
- </div>
303
- <div className="text-center">
304
- <div className="text-3xl mb-3">🔢</div>
305
- <p className={`text-xs uppercase tracking-wider mb-2 ${
306
- isDarkMode ? 'text-gray-400' : 'text-gray-500'
307
- }`}>
308
- Lucky Number
309
- </p>
310
- <p className="font-bold text-blue-500">{getLuckyElement('numbers')}</p>
311
- </div>
312
- <div className="text-center">
313
- <div className="text-3xl mb-3">💎</div>
314
- <p className={`text-xs uppercase tracking-wider mb-2 ${
315
- isDarkMode ? 'text-gray-400' : 'text-gray-500'
316
- }`}>
317
- Lucky Stone
318
- </p>
319
- <p className="font-bold text-purple-500">{getLuckyElement('stones')}</p>
320
- </div>
321
- <div className="text-center">
322
- <div className="text-3xl mb-3">⭐</div>
323
- <p className={`text-xs uppercase tracking-wider mb-2 ${
324
- isDarkMode ? 'text-gray-400' : 'text-gray-500'
325
- }`}>
326
- Mood
327
- </p>
328
- <p className="font-bold text-yellow-500">{getLuckyElement('moods')}</p>
329
- </div>
330
- </div>
331
- </div>
332
-
333
- {/* Footer */}
334
- <div className="text-center text-sm opacity-70 mt-4">
335
- <p>✨ Discover your daily horoscope and unlock the secrets of the stars ✨</p>
336
- </div>
337
- </div>
338
- </div>
339
  );
340
  };
341
 
342
- export default HoroscopeApp;
 
1
  import React, { useState } from 'react';
2
+ import './index.css';
3
 
4
+ // Paste toàn bộ code component HoroscopeApp của chúng ta vào đây
5
+ const App = () => {
6
+ // Code component hoàn chỉnh từ artifact
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  return (
8
+ // JSX của horoscope app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  );
10
  };
11
 
12
+ export default App;