@@ -3,6 +3,8 @@ import Circle from "./Circle";
33import { useState , useEffect } from "react" ;
44import Profile from "./Profile" ;
55import About from "./About" ;
6+ import { motion } from "framer-motion" ;
7+
68
79export default function Stat ( { data } ) {
810 const [ userData , setUserData ] = useState ( { } ) ;
@@ -49,46 +51,99 @@ export default function Stat({ data }) {
4951 }
5052 } , [ data ] ) ;
5153
52-
53-
54+ const random1 = Math . random ( ) * 1 ;
55+ const random2 = Math . random ( ) * 2 ;
5456 return (
5557 < div className = "flex justify-center flex-col items-center rounded-lg h-[280px] bg-[#292829]" >
5658 < div >
5759 < div className = "flex gap-1 xl:gap-4 items-center justify-between " >
58- < Profile userData = { userData ?. profileData } />
59- < About result = { userData ?. aboutData } />
60+ { /* Profile */ }
61+ < motion . div
62+ initial = { { opacity : 0 , x : - 50 } }
63+ whileInView = { { opacity : 1 , x : 0 } }
64+ viewport = { { once : true } }
65+ transition = { { duration : 0.3 , type : "spring" , stiffness : 110 , delay : ( random1 % 4 ) * 0.2 } }
66+ >
67+ < Profile userData = { userData ?. profileData } />
68+ </ motion . div >
69+
70+ { /* About */ }
71+ < motion . div
72+ initial = { { opacity : 0 , x : - 50 } }
73+ whileInView = { { opacity : 1 , x : 0 } }
74+ viewport = { { once : true } }
75+ transition = { { duration : 0.3 , type : "spring" , stiffness : 110 , delay : ( random2 % 4 ) * 0.2 + 0.2 } }
76+ >
77+ < About result = { userData ?. aboutData } />
78+ </ motion . div >
6079 </ div >
6180 < div style = { { height : '0.5px' , backgroundColor : '#E0E0E0' } } className = "h-[0.5px] bg-white" />
81+
6282 < div className = " flex lg:flex-row gap-5 items-center justify-center mt-4" >
63- < Circle total = { data ?. totalSolved } />
83+ { /* Circle */ }
84+ < motion . div
85+ initial = { { opacity : 0 , x : - 40 } }
86+ whileInView = { { opacity : 1 , x : 0 } }
87+ viewport = { { once : true } }
88+ transition = { { duration : 0.3 , type : "spring" , stiffness : 110 , delay : ( random1 % 4 ) * 0.3 } }
89+ >
90+ < Circle total = { data ?. totalSolved } />
91+ </ motion . div >
92+
6493 < div className = "flex flex-col gap-3" >
65- < Questions
66- type = { 'Easy' }
67- solved = { data ?. easySolved }
68- total = { data ?. easyTotal }
69- beats = { data ?. easyBeats }
70- line = 'bg-[#2db55d26]'
71- line2 = 'bg-[#01B8A2]'
72- />
73- < Questions
74- type = { 'Medium' }
75- solved = { data ?. mediumSolved }
76- total = { data ?. mediumTotal }
77- beats = { data ?. mediumBeats }
78- line = 'bg-[#ffb80026]'
79- line2 = 'bg-[#FFC11F]'
80- />
81- < Questions
82- type = { 'Hard' }
83- solved = { data ?. hardSolved }
84- total = { data ?. hardTotal }
85- beats = { data ?. hardBeats }
86- line = 'bg-[#ef474326]'
87- line2 = 'bg-[#EF4642]'
88- />
94+ { /* Questions */ }
95+ < motion . div
96+ initial = { { opacity : 0 , x : - 20 } }
97+ whileInView = { { opacity : 1 , x : 0 } }
98+ viewport = { { once : true } }
99+ transition = { { duration : 0.3 , type : "spring" , stiffness : 110 , delay : ( random2 % 4 ) * 0.4 } }
100+ >
101+ < Questions
102+ type = { 'Easy' }
103+ solved = { data ?. easySolved }
104+ total = { data ?. easyTotal }
105+ beats = { data ?. easyBeats }
106+ line = 'bg-[#2db55d26]'
107+ line2 = 'bg-[#01B8A2]'
108+ />
109+ </ motion . div >
110+
111+ < motion . div
112+ initial = { { opacity : 0 , x : - 30 } }
113+ whileInView = { { opacity : 1 , x : 0 } }
114+ viewport = { { once : true } }
115+ transition = { { duration : 0.3 , type : "spring" , stiffness : 110 , delay : ( random2 % 4 ) * 0.3 } }
116+ >
117+ < Questions
118+ type = { 'Medium' }
119+ solved = { data ?. mediumSolved }
120+ total = { data ?. mediumTotal }
121+ beats = { data ?. mediumBeats }
122+ line = 'bg-[#ffb80026]'
123+ line2 = 'bg-[#FFC11F]'
124+ />
125+ </ motion . div >
126+
127+ < motion . div
128+ initial = { { opacity : 0 , x : - 50 } }
129+ whileInView = { { opacity : 1 , x : 0 } }
130+ viewport = { { once : true } }
131+ transition = { { duration : 0.3 , type : "spring" , stiffness : 110 , delay : ( random2 % 4 ) * 0.5 } }
132+ >
133+ < Questions
134+ type = { 'Hard' }
135+ solved = { data ?. hardSolved }
136+ total = { data ?. hardTotal }
137+ beats = { data ?. hardBeats }
138+ line = 'bg-[#ef474326]'
139+ line2 = 'bg-[#EF4642]'
140+ />
141+ </ motion . div >
89142 </ div >
90143 </ div >
91144
145+
146+
92147 </ div >
93148 </ div >
94149
0 commit comments