From 1fd685f39652223583e7f1a7044b8b7d6fb7f799 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 04 十一月 2024 09:21:17 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/page/components/PulseSignal.jsx | 72 +++++++++++++++++++++++-------------
1 files changed, 46 insertions(+), 26 deletions(-)
diff --git a/zy-acs-flow/src/page/components/PulseSignal.jsx b/zy-acs-flow/src/page/components/PulseSignal.jsx
index 1b98d49..c1d33c5 100644
--- a/zy-acs-flow/src/page/components/PulseSignal.jsx
+++ b/zy-acs-flow/src/page/components/PulseSignal.jsx
@@ -1,37 +1,57 @@
import * as React from 'react';
import { Paper, Typography, Box, Chip, Avatar } from '@mui/material';
-import { teal } from '@mui/material/colors';
+import { teal, red } from '@mui/material/colors';
const PulseSignal = (props) => {
- const { flag = true, width = 8, ...rest } = props;
+ const {
+ flag = true,
+ width = 8,
+ negative = false,
+ positiveColor = teal[400],
+ negativeColor = red[400],
+ ...rest
+ } = props;
return (
<>
- <Box
- {...rest}
- sx={{
- width: width,
- height: width,
- borderRadius: '50%',
- backgroundColor: flag ? `${teal[400]}` : '#f44336',
- display: 'inline-block',
- animation: 'pulse 1.2s infinite',
- '@keyframes pulse': {
- '0%': {
- transform: 'scale(1)',
- opacity: 1,
+ {flag ? (
+ <Box
+ {...rest}
+ sx={{
+ width: width,
+ height: width,
+ borderRadius: '50%',
+ backgroundColor: positiveColor,
+ display: 'inline-block',
+ animation: `pulse ${negative ? '2' : '1.2'}s infinite`,
+ '@keyframes pulse': {
+ '0%': {
+ transform: 'scale(1)',
+ opacity: 1,
+ },
+ '50%': {
+ transform: 'scale(1.3)',
+ opacity: 0.7,
+ },
+ '100%': {
+ transform: 'scale(1)',
+ opacity: 1,
+ },
},
- '50%': {
- transform: 'scale(1.2)',
- opacity: 0.7,
- },
- '100%': {
- transform: 'scale(1)',
- opacity: 1,
- },
- },
- }}
- />
+ }}
+ />
+ ) : (
+ <Box
+ {...rest}
+ sx={{
+ width: width + width / 10,
+ height: width + width / 10,
+ borderRadius: '50%',
+ backgroundColor: negativeColor,
+ display: 'inline-block',
+ }}
+ />
+ )}
</>
)
--
Gitblit v1.9.1