pulse health bar and heart when health < 10

This commit is contained in:
saml33 2023-02-10 10:35:39 +11:00
parent 73162e5544
commit 97e93faf78
3 changed files with 6 additions and 9 deletions

View File

@ -167,7 +167,7 @@ const SideNav = ({ collapsed }: { collapsed: boolean }) => {
health={ health={
group && mangoAccount group && mangoAccount
? mangoAccount.getHealthRatioUi(group, HealthType.maint) ? mangoAccount.getHealthRatioUi(group, HealthType.maint)
: undefined : 0
} }
size={32} size={32}
/> />

View File

@ -32,7 +32,9 @@ const HealthBar = ({ health }: { health: number }) => {
...sharedStyles, ...sharedStyles,
width: `${barWidths[0]}%`, width: `${barWidths[0]}%`,
}} }}
className={`flex rounded-full`} className={`flex rounded-full ${
health && health < 10 ? 'animate-pulse' : ''
}`}
/> />
</div> </div>
<div className="col-span-1 flex h-1 rounded-full bg-th-bkg-3"> <div className="col-span-1 flex h-1 rounded-full bg-th-bkg-3">

View File

@ -1,12 +1,6 @@
import { useMemo } from 'react' import { useMemo } from 'react'
const HealthHeart = ({ const HealthHeart = ({ health, size }: { health: number; size: number }) => {
health,
size,
}: {
health: number | undefined
size: number
}) => {
const fillColor = useMemo(() => { const fillColor = useMemo(() => {
if (!health) return 'var(--fgd-4)' if (!health) return 'var(--fgd-4)'
if (health <= 25) { if (health <= 25) {
@ -30,6 +24,7 @@ const HealthHeart = ({
return ( return (
<svg <svg
className={health && health < 10 ? 'animate-pulse' : ''}
id="account-step-eleven" id="account-step-eleven"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
style={styles} style={styles}