skyouc
7 天以前 b9d414bc2d61b4824ce6a019b1c10f526f71ced1
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
54
55
56
57
58
59
60
import * as React from 'react';
import { Paper, Typography, Box, Chip, Avatar } from '@mui/material';
import { teal, red } from '@mui/material/colors';
 
const PulseSignal = (props) => {
    const {
        flag = true,
        width = 8,
        negative = false,
        positiveColor = teal[400],
        negativeColor = red[400],
        ...rest
    } = props;
 
    return (
        <>
            {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,
                            },
                        },
                    }}
                />
            ) : (
                <Box
                    {...rest}
                    sx={{
                        width: width + width / 10,
                        height: width + width / 10,
                        borderRadius: '50%',
                        backgroundColor: negativeColor,
                        display: 'inline-block',
                    }}
                />
            )}
        </>
    )
 
}
 
export default PulseSignal;