Files
parcer/src/components/ui/Loader.tsx

81 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-06-15 21:03:38 +05:30
import styled from "styled-components";
import { Stack } from "@mui/material";
2024-11-09 11:46:21 +05:30
import { useThemeMode } from "../../context/theme-provider";
2024-10-19 20:58:30 +05:30
interface LoaderProps {
2024-10-19 21:29:28 +05:30
text: string;
2024-10-19 20:58:30 +05:30
}
export const Loader: React.FC<LoaderProps> = ({ text }) => {
2024-11-09 11:46:21 +05:30
const { darkMode } = useThemeMode();
2024-06-15 21:03:38 +05:30
return (
2024-10-19 21:29:28 +05:30
<Stack direction="column" sx={{ margin: "30px 0px", alignItems: "center" }}>
<DotsContainer>
<Dot />
<Dot />
<Dot />
<Dot />
</DotsContainer>
2024-11-09 11:46:21 +05:30
<StyledParagraph darkMode={darkMode}>{text}</StyledParagraph>
2024-06-15 21:03:38 +05:30
</Stack>
);
2024-10-19 21:29:28 +05:30
};
2024-06-15 21:03:38 +05:30
2024-11-09 11:46:21 +05:30
interface StyledParagraphProps {
darkMode: boolean;
}
const StyledParagraph = styled.p<StyledParagraphProps>`
font-size: large;
2024-06-15 21:03:38 +05:30
font-family: inherit;
color: ${({ darkMode }) => (darkMode ? 'white' : '#333')};
2024-10-19 21:29:28 +05:30
margin-top: 20px;
`;
const DotsContainer = styled.div`
display: flex;
2024-06-15 21:03:38 +05:30
justify-content: center;
2024-10-19 21:29:28 +05:30
align-items: center;
gap: 15px; /* Space between dots */
2024-06-15 21:03:38 +05:30
`;
2024-10-19 21:29:28 +05:30
const Dot = styled.div`
width: 15px;
height: 15px;
background-color: #ff00c3;
2024-06-15 21:03:38 +05:30
border-radius: 50%;
2024-10-19 21:29:28 +05:30
animation: intensePulse 1.2s infinite ease-in-out both, bounceAndPulse 1.5s infinite ease-in-out;
&:nth-child(1) {
animation-delay: -0.3s;
2024-06-15 21:03:38 +05:30
}
2024-10-19 21:29:28 +05:30
&:nth-child(2) {
animation-delay: -0.2s;
2024-06-15 21:03:38 +05:30
}
2024-10-19 21:29:28 +05:30
&:nth-child(3) {
animation-delay: -0.1s;
}
&:nth-child(4) {
animation-delay: 0s;
}
@keyframes bounceAndPulse {
0%, 100% {
transform: translateY(0) scale(1);
2024-06-15 21:03:38 +05:30
}
2024-10-19 21:29:28 +05:30
50% {
transform: translateY(-10px) scale(1.3);
2024-06-15 21:03:38 +05:30
}
}
2024-10-19 21:29:28 +05:30
@keyframes intensePulse {
0%, 100% {
box-shadow: 0 0 0 0 rgba(255, 0, 195, 0.7);
2024-06-15 21:03:38 +05:30
}
2024-10-19 21:29:28 +05:30
50% {
box-shadow: 0 0 15px 10px rgba(255, 0, 195, 0.3);
2024-06-15 21:03:38 +05:30
}
}
`;