22import React , { useState , useEffect } from "react" ;
33import Link from "next/link" ;
44import { Button } from "../ui/button" ;
5- import { searchAlgorithms } from "@/lib/data" ;
5+ import {
6+ accentColors ,
7+ primaryColors ,
8+ searchAlgorithms ,
9+ secondaryColors ,
10+ } from "@/lib/data" ;
611
712function SearchingAnimation ( ) {
813 const [ isAnimating , setIsAnimating ] = useState < boolean > ( false ) ;
@@ -14,7 +19,7 @@ function SearchingAnimation() {
1419 const generateRandomArray = ( ) => {
1520 const arr = Array . from (
1621 { length : 12 } ,
17- ( ) => Math . floor ( Math . random ( ) * 80 ) + 10
22+ ( ) => Math . floor ( Math . random ( ) * 80 ) + 10 ,
1823 ) ;
1924 return arr . sort ( ( a , b ) => a - b ) ;
2025 } ;
@@ -71,48 +76,6 @@ function SearchingAnimation() {
7176 } ;
7277
7378 const getBarColor = ( value : number , index : number ) => {
74- // const theme = document.documentElement.getAttribute("data-theme");
75-
76- const primaryColors = [
77- // "--primary-50",
78- // "--primary-100",
79- "--primary-200" ,
80- "--primary-300" ,
81- "--primary-400" ,
82- "--primary-500" ,
83- "--primary-600" ,
84- "--primary-700" ,
85- "--primary-800" ,
86- "--primary-900" ,
87- "--primary-950" ,
88- ] ;
89- const secondaryColors = [
90- // "--secondary-50",
91- // "--secondary-100",
92- "--secondary-200" ,
93- "--secondary-300" ,
94- "--secondary-400" ,
95- "--secondary-500" ,
96- "--secondary-600" ,
97- "--secondary-700" ,
98- "--secondary-800" ,
99- "--secondary-900" ,
100- "--secondary-950" ,
101- ] ;
102- const accentColors = [
103- // "--accent-50",
104- // "--accent-100",
105- "--accent-200" ,
106- "--accent-300" ,
107- "--accent-400" ,
108- "--accent-500" ,
109- "--accent-600" ,
110- "--accent-700" ,
111- "--accent-800" ,
112- "--accent-900" ,
113- "--accent-950" ,
114- ] ;
115-
11679 let colorSet = primaryColors ;
11780
11881 if ( index % 3 === 1 ) colorSet = secondaryColors ;
@@ -134,7 +97,6 @@ function SearchingAnimation() {
13497 height : `${ getBarHeight ( value ) } px` ,
13598 backgroundColor : "#00FF00" ,
13699 borderRadius : "50%" ,
137- // transform: "scale(1.3)",
138100 transition : "all 0.5s ease" ,
139101 boxShadow : "0 6px 12px rgba(0, 128, 0, 0.4)" ,
140102 } ;
@@ -201,10 +163,10 @@ function SearchingAnimation() {
201163 { isAnimating
202164 ? "Searching in progress..."
203165 : foundIndex !== null && foundIndex !== - 1
204- ? `Target found at index ${ foundIndex } !`
205- : foundIndex === - 1
206- ? "Target not found."
207- : "Ready to search again" }
166+ ? `Target found at index ${ foundIndex } !`
167+ : foundIndex === - 1
168+ ? "Target not found."
169+ : "Ready to search again" }
208170 </ span >
209171 </ div >
210172 </ div >
0 commit comments