mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-02-02 22:53:36 +00:00
feat: create separate component for message
This commit is contained in:
parent
c7120820bf
commit
a6387398db
19
src/components/StatusIconText.tsx
Normal file
19
src/components/StatusIconText.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
import { GREEN_CHECKMARK_ICON, RED_CHECKMARK_ICON } from '../constants'
|
||||
import IconText from './IconText'
|
||||
|
||||
type StatusIconTextProps = {
|
||||
percentage: number
|
||||
threshold: number
|
||||
goodText: string
|
||||
badText: string
|
||||
}
|
||||
|
||||
const StatusIconText = ({ percentage, threshold, goodText, badText }: StatusIconTextProps) => {
|
||||
const isGood = percentage < threshold
|
||||
const icon = isGood ? GREEN_CHECKMARK_ICON : RED_CHECKMARK_ICON
|
||||
const text = isGood ? goodText : badText
|
||||
|
||||
return <IconText icon={icon}>{text}</IconText>
|
||||
}
|
||||
|
||||
export default StatusIconText
|
Loading…
x
Reference in New Issue
Block a user