Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve infinite loading at faq page #281

Merged
merged 1 commit into from
Oct 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions frontend/src/components/FAQ-feature/FAQ.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import '../../styles/FAQ.css'; // Import your CSS
import '../../styles/preloaderStyle.css';

const FAQs = () => {
const [activeIndex, setActiveIndex] = useState(null);
const [searchQuery, setSearchQuery] = useState(''); // Add state for search query
const [isLoading, setIsLoading] = useState(true);

const faqs = [
{ question: "What warranty does Xiaomi offer on its products?", answer: "Xiaomi typically offers a one-year warranty on most of its devices. However, warranty terms may vary depending on the product and region, so it’s best to check the specific warranty policy for your item." },
Expand Down Expand Up @@ -32,10 +33,18 @@ const FAQs = () => {
setActiveIndex(activeIndex === index ? null : index);
};

useEffect(()=>{
setTimeout(()=>{
setIsLoading(false);
}, 2000);
},[]);

return (

<div className="faq-page">
<div id="preloader">
<div id="preloader" style={{
display: isLoading ? "block" : "none"
}} >
< div class="wrapper">
<div class="box-wrap">
<div class="box one"></div>
Expand Down