Created
November 16, 2022 03:37
-
-
Save Codennnn/23d41084779b90f3e25d8ad67f179479 to your computer and use it in GitHub Desktop.
react loading bar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface LoadingBarProps { | |
className?: string | |
loading?: boolean | |
} | |
export default function LoadingBar(props: LoadingBarProps) { | |
return ( | |
<div className={`relative min-h-[0.25rem] ${props.className ?? ''}`}> | |
<div | |
className={`absolute inset-x-0 bottom-0 z-20 h-1 overflow-hidden py-[1px] ${ | |
props.loading ? '' : 'hidden' | |
}`} | |
> | |
<div className="animate-slide absolute h-full w-1/3 bg-gradient-to-l from-main-200" /> | |
</div> | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment