master
parent
180ee0ffc0
commit
f3df09dafb
4 changed files with 32 additions and 1 deletions
@ -0,0 +1,24 @@ |
|||||||
|
import React, { useEffect, useState } from "react"; |
||||||
|
|
||||||
|
const AnimatedProgressBar = ({rangeWidth, parentBg, childBg}) => { |
||||||
|
const [progressBar, setProgressBar] = useState(false); |
||||||
|
|
||||||
|
useEffect(() => { |
||||||
|
setTimeout(() => { |
||||||
|
setProgressBar(true); |
||||||
|
}, 1000); |
||||||
|
}, []); |
||||||
|
|
||||||
|
return ( |
||||||
|
<div className={`flex-row w-full rounded-full h-2 mt-4 ${parentBg}`} style={{direction: "ltr"}}> |
||||||
|
<div className={`h-2 rounded-full dark:bg-gray-300 duration-500 ${childBg}`} style={{ width: progressBar ? rangeWidth : 0}}></div> |
||||||
|
</div> ) |
||||||
|
} |
||||||
|
|
||||||
|
export default AnimatedProgressBar |
||||||
|
|
||||||
|
AnimatedProgressBar.defaultProps = { |
||||||
|
rangeWidth: "75%", |
||||||
|
parentBg: "bg-gray-200", |
||||||
|
childBg: "bg-gray-600", |
||||||
|
} |
Loading…
Reference in new issue