#
luxiaotao1123
2024-09-25 e5fb24c1fbfef2a7562963ab6df69090410c89b5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import * as React from 'react';
import { Paper, Typography, Box, Chip, Avatar } from '@mui/material';
import { teal } from '@mui/material/colors';
 
const PulseSignal = (props) => {
    const { flag = true, width = 8, negative = false, ...rest } = props;
 
    return (
        <>
            {flag ? (
                <Box
                    {...rest}
                    sx={{
                        width: width,
                        height: width,
                        borderRadius: '50%',
                        backgroundColor: `${teal[400]}`,
                        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,
                            },
                        },
                    }}
                />
            ) : (
                <Box
                    {...rest}
                    sx={{
                        width: width + width / 10,
                        height: width + width / 10,
                        borderRadius: '50%',
                        backgroundColor: '#f44336',
                        display: 'inline-block',
                    }}
                />
            )}
        </>
    )
 
}
 
export default PulseSignal;