1+ import { motion } from 'framer-motion' // Import Framer Motion
12import React , { useState , useEffect , useCallback , useMemo } from 'react'
23import {
34 BarChart ,
@@ -153,15 +154,42 @@ const DepositRateComparisonSection = () => {
153154 } , [ ] )
154155
155156 return (
156- < div className = 'py-10 bg-base-200 min-h-screen w-full' >
157- < h1 className = 'text-center text-2xl md:text-3xl font-bold text-charter-blue-600 mt-8 mb-4' >
157+ < motion . div
158+ className = 'py-10 bg-base-200 min-h-screen w-full'
159+ initial = 'hidden'
160+ whileInView = 'visible'
161+ viewport = { { once : true , amount : 0.2 } }
162+ variants = { {
163+ hidden : { opacity : 0 , y : 20 } ,
164+ visible : { opacity : 1 , y : 0 , transition : { duration : 0.8 , staggerChildren : 0.2 } }
165+ } }
166+ >
167+ < motion . h1
168+ className = 'text-center text-2xl md:text-3xl font-bold text-charter-blue-600 mt-8 mb-4'
169+ variants = { {
170+ hidden : { opacity : 0 , y : 20 } ,
171+ visible : { opacity : 1 , y : 0 , transition : { duration : 0.6 } }
172+ } }
173+ >
158174 Deposit Rate Comparison
159- </ h1 >
160- < p className = 'text-center text-charter-blue text-lg md:text-xl mx-4 md:mx-20 lg:mx-36 mb-16' >
175+ </ motion . h1 >
176+ < motion . p
177+ className = 'text-center text-charter-blue text-lg md:text-xl mx-4 md:mx-20 lg:mx-36 mb-16'
178+ variants = { {
179+ hidden : { opacity : 0 , y : 20 } ,
180+ visible : { opacity : 1 , y : 0 , transition : { duration : 0.6 } }
181+ } }
182+ >
161183 Compare the deposit rates of different Indonesian banks based on the selected tenure and
162184 minimum balance. Select a tenure and minimum balance to see the corresponding rates.
163- </ p >
164- < div className = 'mb-8 flex flex-col md:flex-row space-y-4 md:space-y-0 md:space-x-4 justify-center items-center' >
185+ </ motion . p >
186+ < motion . div
187+ className = 'mb-8 flex flex-col md:flex-row space-y-4 md:space-y-0 md:space-x-4 justify-center items-center'
188+ variants = { {
189+ hidden : { opacity : 0 , y : 20 } ,
190+ visible : { opacity : 1 , y : 0 , transition : { duration : 0.6 } }
191+ } }
192+ >
165193 < div >
166194 < label
167195 htmlFor = 'tenure'
@@ -222,12 +250,26 @@ const DepositRateComparisonSection = () => {
222250 < option value = 'rate' > Rate</ option >
223251 </ select >
224252 </ div >
225- </ div >
253+ </ motion . div >
226254 { loading ? (
227- < p className = 'text-charter-blue' > Loading...</ p >
255+ < motion . p
256+ className = 'text-charter-blue'
257+ variants = { {
258+ hidden : { opacity : 0 } ,
259+ visible : { opacity : 1 , transition : { duration : 0.6 } }
260+ } }
261+ >
262+ Loading...
263+ </ motion . p >
228264 ) : (
229- < div className = 'mx-4 md:mx-20 lg:mx-36 mb-10' >
230- < ResponsiveContainer width = '100%' height = { 600 } className = { '' } >
265+ < motion . div
266+ className = 'mx-4 md:mx-20 lg:mx-36 mb-10'
267+ variants = { {
268+ hidden : { opacity : 0 , y : 20 } ,
269+ visible : { opacity : 1 , y : 0 , transition : { duration : 0.8 } }
270+ } }
271+ >
272+ < ResponsiveContainer width = '100%' height = { 600 } >
231273 < BarChart
232274 data = { data }
233275 layout = 'vertical'
@@ -236,7 +278,7 @@ const DepositRateComparisonSection = () => {
236278 < XAxis
237279 type = 'number'
238280 label = { { value : EMPTY_STRING } }
239- tick = { { fontSize : 14 , fontWeight : 'bold' , fill : CHARTER_BLUE , dy : 5 } }
281+ tick = { { fontSize : 14 , fontWeight : 'bold' , fill : CHARTER_BLUE , dy : 6 } }
240282 />
241283 < YAxis type = 'category' dataKey = 'bank' tick = { renderCustomYAxisTick } width = { 125 } />
242284 { /* eslint-disable-next-line @typescript-eslint/ban-ts-comment */ }
@@ -253,9 +295,9 @@ const DepositRateComparisonSection = () => {
253295 </ Bar >
254296 </ BarChart >
255297 </ ResponsiveContainer >
256- </ div >
298+ </ motion . div >
257299 ) }
258- </ div >
300+ </ motion . div >
259301 )
260302}
261303
0 commit comments