-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
178 lines (155 loc) · 7.12 KB
/
index.html
File metadata and controls
178 lines (155 loc) · 7.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>React Q&A Collection</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- Animated background particles -->
<div class="particles" id="particles"></div>
<div class="container">
<header>
<div class="logo">
<i class="fab fa-react"></i>
</div>
<h1>React and Javascript Q&A Collection</h1>
<p class="subtitle">Discover answers to the most common React questions with our beautifully designed knowledge base</p>
<div class="filter-container">
<select id="questionNumberFilter" class="filter-select">
<option value="">All Questions</option>
</select>
<select id="difficultyFilter" class="filter-select">
<option value="">All Difficulties</option>
<option value="Easy">Easy</option>
<option value="Medium">Medium</option>
<option value="Hard">Hard</option>
<option value="Super Hard">Super Hard</option>
</select>
<select id="topicFilter" class="filter-select">
<option value="">All Topics</option>
</select>
</div>
<div class="stats">
<div class="stat-card">
<div class="stat-value" id="questionCount">6+</div>
<div class="stat-label">Questions</div>
</div>
<div class="stat-card">
<div class="stat-value">24/7</div>
<div class="stat-label">Available</div>
</div>
<div class="stat-card">
<div class="stat-value">100%</div>
<div class="stat-label">Satisfaction</div>
</div>
</div>
</header>
<main>
<div class="qa-container" id="qaContainer">
<!-- Questions and answers will be dynamically generated here -->
</div>
</main>
<footer class="footer">
<p>© 2025 React and Javascript Q&A Collection. All rights reserved.</p>
<p class="made-with">
Made with <i class="fas fa-heart" style="color: #ff4d8d;"></i> for React developers
</p>
</footer>
</div>
<script src="data.js"></script>
<script>
// Initialize questions and answers
function renderQAs(faqs) {
const qaContainer = document.getElementById('qaContainer');
qaContainer.innerHTML = '';
faqs.forEach(faq => {
const qaItem = document.createElement('div');
qaItem.className = 'qa-item';
qaItem.innerHTML = `
<p class="question">${faq.question}</p>
<p class="question-meta">Difficulty: ${faq.difficulty} | Topic: ${faq.topic}</p>
<p class="answer">${faq.answer}</p>
`;
qaContainer.appendChild(qaItem);
});
}
// Initialize filters
function initializeFilters() {
const questionNumberFilter = document.getElementById('questionNumberFilter');
const topicFilter = document.getElementById('topicFilter');
const uniqueTopics = [...new Set(faqData.map(faq => faq.topic))];
faqData.forEach(faq => {
const option = document.createElement('option');
option.value = faq.id;
option.textContent = `Question ${faq.id}`;
questionNumberFilter.appendChild(option);
});
uniqueTopics.forEach(topic => {
const option = document.createElement('option');
option.value = topic;
option.textContent = topic;
topicFilter.appendChild(option);
});
}
// Filter questions and answers
function filterQAs() {
const questionNumber = document.getElementById('questionNumberFilter').value;
const difficulty = document.getElementById('difficultyFilter').value;
const topic = document.getElementById('topicFilter').value;
let filteredFaqs = faqData;
if (questionNumber) {
filteredFaqs = filteredFaqs.filter(faq => faq.id.toString() === questionNumber);
}
if (difficulty) {
filteredFaqs = filteredFaqs.filter(faq => faq.difficulty === difficulty);
}
if (topic) {
filteredFaqs = filteredFaqs.filter(faq => faq.topic === topic);
}
renderQAs(filteredFaqs);
}
// Create animated background particles
function createParticles() {
const particlesContainer = document.getElementById('particles');
const particleCount = 30;
for (let i = 0; i < particleCount; i++) {
const particle = document.createElement('div');
particle.classList.add('particle');
const size = Math.random() * 20 + 5;
const posX = Math.random() * 100;
const posY = Math.random() * 100;
const animationDuration = Math.random() * 10 + 10;
const animationDelay = Math.random() * 5;
const hue = Math.floor(Math.random() * 360);
particle.style.width = `${size}px`;
particle.style.height = `${size}px`;
particle.style.left = `${posX}%`;
particle.style.top = `${posY}%`;
particle.style.animationDuration = `${animationDuration}s`;
particle.style.animationDelay = `${animationDelay}s`;
particle.style.backgroundColor = `hsla(${hue}, 70%, 60%, 0.2)`;
particlesContainer.appendChild(particle);
}
}
// Initialize
document.addEventListener('DOMContentLoaded', () => {
// Sort FAQs by difficulty
const difficultyOrder = { Easy: 1, Medium: 2, Hard: 3, "Super Hard": 4 };
faqData.sort((a, b) => difficultyOrder[a.difficulty] - difficultyOrder[b.difficulty]);
renderQAs(faqData);
initializeFilters();
createParticles();
// Add filter event listeners
['questionNumberFilter', 'difficultyFilter', 'topicFilter'].forEach(id => {
document.getElementById(id).addEventListener('change', filterQAs);
});
// Update question count
document.getElementById('questionCount').textContent = `${faqData.length}+`;
});
</script>
</body>
</html>