2021-11-17 20:26:26 +08:00
|
|
|
import React from 'react';
|
2021-11-09 04:49:51 +08:00
|
|
|
import Styled from './styles';
|
2021-04-23 09:07:48 +08:00
|
|
|
|
|
|
|
const STATS = {
|
|
|
|
critical: {
|
2021-11-09 04:49:51 +08:00
|
|
|
bars: 1,
|
2021-04-23 09:07:48 +08:00
|
|
|
},
|
|
|
|
danger: {
|
2021-11-09 04:49:51 +08:00
|
|
|
bars: 2,
|
2021-04-23 09:07:48 +08:00
|
|
|
},
|
|
|
|
warning: {
|
2021-11-09 04:49:51 +08:00
|
|
|
bars: 3,
|
2021-04-23 09:07:48 +08:00
|
|
|
},
|
|
|
|
normal: {
|
2021-11-09 04:49:51 +08:00
|
|
|
bars: 4,
|
2021-04-23 09:07:48 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-11-09 04:49:51 +08:00
|
|
|
const Icon = ({ level, grayscale }) => (
|
|
|
|
<>
|
2022-04-09 03:05:29 +08:00
|
|
|
<Styled.SignalBars id="connectionBars" level={level} grayscale={grayscale}>
|
2021-11-09 04:49:51 +08:00
|
|
|
<Styled.FirstBar />
|
|
|
|
<Styled.SecondBar active={STATS[level].bars >= 2} />
|
|
|
|
<Styled.ThirdBar active={STATS[level].bars >= 3} />
|
|
|
|
<Styled.FourthBar active={STATS[level].bars >= 4} />
|
|
|
|
</Styled.SignalBars>
|
|
|
|
</>
|
|
|
|
);
|
2021-04-23 09:07:48 +08:00
|
|
|
|
|
|
|
export default Icon;
|