feat: new loader dot ui

This commit is contained in:
karishmas6
2024-10-19 21:29:28 +05:30
parent fabe57e6ce
commit 0ea2bfb827

View File

@@ -2,89 +2,72 @@ import styled from "styled-components";
import { Stack } from "@mui/material"; import { Stack } from "@mui/material";
interface LoaderProps { interface LoaderProps {
text: string text: string;
} }
export const Loader: React.FC<LoaderProps> = ({ text }) => { export const Loader: React.FC<LoaderProps> = ({ text }) => {
return ( return (
<Stack direction="column" sx={{ margin: "30px 0px 291px 0px" }}> <Stack direction="column" sx={{ margin: "30px 0px", alignItems: "center" }}>
<StyledLoader /> <DotsContainer>
<StyledParagraph> <Dot />
{text} <Dot />
</StyledParagraph> <Dot />
<Dot />
</DotsContainer>
<StyledParagraph>{text}</StyledParagraph>
</Stack> </Stack>
); );
} };
const StyledParagraph = styled.p` const StyledParagraph = styled.p`
font-size: x-large; font-size: large;
font-family: inherit; font-family: inherit;
color: black; color: #333;
display: grid; margin-top: 20px;
justify-content: center;
`; `;
const StyledLoader = styled.div` const DotsContainer = styled.div`
display: flex;
justify-content: center;
align-items: center;
gap: 15px; /* Space between dots */
`;
const Dot = styled.div`
width: 15px;
height: 15px;
background-color: #ff00c3;
border-radius: 50%; border-radius: 50%;
color: #ff00c3; animation: intensePulse 1.2s infinite ease-in-out both, bounceAndPulse 1.5s infinite ease-in-out;
font-size: 11px;
text-indent: -99999em; &:nth-child(1) {
margin: 55px auto; animation-delay: -0.3s;
position: relative;
width: 10em;
height: 10em;
box-shadow: inset 0 0 0 1em;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
&:before {
position: absolute;
content: '';
border-radius: 50%;
width: 5.2em;
height: 10.2em;
background: #ffffff;
border-radius: 10.2em 0 0 10.2em;
top: -0.1em;
left: -0.1em;
-webkit-transform-origin: 5.1em 5.1em;
transform-origin: 5.1em 5.1em;
-webkit-animation: load2 2s infinite ease 1.5s;
animation: load2 2s infinite ease 1.5s;
} }
&:after { &:nth-child(2) {
position: absolute; animation-delay: -0.2s;
content: '';
border-radius: 50%;
width: 5.2em;
height: 10.2em;
background: #ffffff;
border-radius: 0 10.2em 10.2em 0;
top: -0.1em;
left: 4.9em;
-webkit-transform-origin: 0.1em 5.1em;
transform-origin: 0.1em 5.1em;
-webkit-animation: load2 2s infinite ease;
animation: load2 2s infinite ease;
} }
@-webkit-keyframes load2 { &:nth-child(3) {
0% { animation-delay: -0.1s;
-webkit-transform: rotate(0deg); }
transform: rotate(0deg); &:nth-child(4) {
animation-delay: 0s;
}
@keyframes bounceAndPulse {
0%, 100% {
transform: translateY(0) scale(1);
} }
100% { 50% {
-webkit-transform: rotate(360deg); transform: translateY(-10px) scale(1.3);
transform: rotate(360deg);
} }
} }
@keyframes load2 {
0% { @keyframes intensePulse {
-webkit-transform: rotate(0deg); 0%, 100% {
transform: rotate(0deg); box-shadow: 0 0 0 0 rgba(255, 0, 195, 0.7);
} }
100% { 50% {
-webkit-transform: rotate(360deg); box-shadow: 0 0 15px 10px rgba(255, 0, 195, 0.3);
transform: rotate(360deg);
} }
} }
`; `;