Files
Checkmate/Client/src/Components/Animated/PulseDot.jsx
T

62 lines
1.4 KiB
React
Raw Normal View History

2024-08-22 12:24:56 -04:00
import PropTypes from "prop-types";
2024-08-22 12:23:52 -04:00
import { Box, Stack } from "@mui/material";
2024-08-22 12:24:56 -04:00
/**
* A component that renders a pulsating dot with a specified color.
*
* @component
* @example
* // Example usage:
* <PulseDot color="#f00" />
*
* @param {Object} props
* @param {string} props.color - The color of the dot.
* @returns {JSX.Element} The PulseDot component.
*/
2024-08-22 12:23:52 -04:00
const PulseDot = ({ color }) => {
return (
<Stack
width="26px"
height="24px"
alignItems="center"
justifyContent="center"
>
<Box
2024-08-22 19:36:48 -04:00
minWidth="18px"
minHeight="18px"
2024-08-22 12:23:52 -04:00
sx={{
position: "relative",
backgroundColor: color,
borderRadius: "50%",
"&::before": {
content: `""`,
position: "absolute",
width: "100%",
height: "100%",
backgroundColor: "inherit",
borderRadius: "50%",
animation: "ripple 1.8s ease-out infinite",
},
2024-08-22 14:21:19 -04:00
"&::after": {
content: `""`,
position: "absolute",
width: "6px",
height: "6px",
borderRadius: "50%",
backgroundColor: "white",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
},
2024-08-22 12:23:52 -04:00
}}
/>
</Stack>
);
};
2024-08-22 12:24:56 -04:00
PulseDot.propTypes = {
color: PropTypes.string.isRequired,
};
2024-08-22 12:23:52 -04:00
export default PulseDot;