5d0fbf705d
* feat: make some check optional (e.g. connected peers > 0 or funded chequebook) * fix: alter setup step text to better describe what needs to be done * refactor: rename isOk from boolean value to checkState enum * fix: add checking for any error
46 lines
1022 B
TypeScript
46 lines
1022 B
TypeScript
import type { ReactElement } from 'react'
|
|
import { CircularProgress } from '@material-ui/core'
|
|
import { CheckState } from '../providers/Bee'
|
|
|
|
interface Props {
|
|
checkState: CheckState
|
|
isLoading?: boolean
|
|
size?: number | string
|
|
className?: string
|
|
}
|
|
|
|
export default function StatusIcon({ checkState, size, className, isLoading }: Props): ReactElement {
|
|
const s = size || '1rem'
|
|
|
|
if (isLoading) return <CircularProgress size={s} className={className} />
|
|
|
|
let backgroundColor: string
|
|
switch (checkState) {
|
|
case CheckState.OK:
|
|
backgroundColor = '#1de600'
|
|
break
|
|
case CheckState.WARNING:
|
|
backgroundColor = 'orange'
|
|
break
|
|
case CheckState.ERROR:
|
|
backgroundColor = '#ff3a52'
|
|
break
|
|
default:
|
|
// Default is error
|
|
backgroundColor = '#ff3a52'
|
|
}
|
|
|
|
return (
|
|
<span
|
|
className={className}
|
|
style={{
|
|
backgroundColor,
|
|
height: s,
|
|
width: s,
|
|
borderRadius: '50%',
|
|
display: 'inline-block',
|
|
}}
|
|
/>
|
|
)
|
|
}
|