-
Notifications
You must be signed in to change notification settings - Fork 28
New pull request made without force push #60
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| 'use client'; | ||
|
|
||
| import React, { useEffect, useRef, useState } from 'react'; | ||
| import React, { useEffect, useRef, useState ,useCallback} from 'react'; | ||
| import Image from 'next/image'; | ||
| import { FiUsers, FiBarChart, FiShield, FiMessageCircle, FiGithub, FiClock, FiBell, FiWifi, FiCode, FiChevronLeft, FiChevronRight, FiZap } from 'react-icons/fi'; | ||
| import { FaTrophy } from 'react-icons/fa'; | ||
|
|
@@ -102,30 +102,41 @@ const FeaturesSection = () => { | |
| benefits: ['Automatic tracking', 'Digital wellness insights', 'Time optimization'] | ||
| } | ||
| ]; | ||
|
|
||
|
|
||
| useEffect(() => { | ||
| intervalRef.current = setInterval(() => { | ||
| setCurrentIndex((prev) => (prev + 1) % features.length); | ||
| }, 4000); | ||
| const startAutoScroll = useCallback(() => { | ||
| if (intervalRef.current) { | ||
| clearInterval(intervalRef.current); | ||
| } | ||
|
|
||
|
akash-kumar-dev marked this conversation as resolved.
Outdated
|
||
| return () => { | ||
| if (intervalRef.current) { | ||
| clearInterval(intervalRef.current); | ||
| } | ||
| }; | ||
| }, [features.length]); | ||
|
|
||
| const nextSlide = () => { | ||
| intervalRef.current = setInterval(() => { | ||
| setCurrentIndex((prev) => (prev + 1) % features.length); | ||
| }; | ||
| }, 10000); | ||
| }, [features.length]); | ||
|
||
| useEffect(() => { | ||
| startAutoScroll(); | ||
|
|
||
| const prevSlide = () => { | ||
| setCurrentIndex((prev) => (prev - 1 + features.length) % features.length); | ||
| return () => { | ||
| if (intervalRef.current) { | ||
| clearInterval(intervalRef.current); | ||
| } | ||
| }; | ||
| }, [startAutoScroll]); | ||
|
|
||
| const goToSlide = (index: number) => { | ||
| setCurrentIndex(index); | ||
| }; | ||
| const nextSlide = () => { | ||
| setCurrentIndex((prev) => (prev + 1) % features.length); | ||
| startAutoScroll(); | ||
| }; | ||
|
|
||
|
akash-kumar-dev marked this conversation as resolved.
Outdated
|
||
| const prevSlide = () => { | ||
| setCurrentIndex((prev) => (prev - 1 + features.length) % features.length); | ||
| startAutoScroll(); | ||
| }; | ||
|
|
||
| const goToSlide = (index: number) => { | ||
| setCurrentIndex(index); | ||
| startAutoScroll(); | ||
| }; | ||
|
|
||
| return ( | ||
| <section ref={sectionRef} className="py-32 bg-gradient-to-br from-gray-900 via-gray-800 to-gray-900 relative overflow-hidden"> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.