Skip to content

Commit 39a14a6

Browse files
committed
fix: improve icon rendering logic in BottomNavigation component
1 parent 907c8a3 commit 39a14a6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/components/Elements/BottomNavigation/BottomNavigation.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react'
12
import { BsRssFill } from 'react-icons/bs'
23
import { SUPPORTED_CARDS } from 'src/config/supportedCards'
34
import { useUserPreferences } from 'src/stores/preferences'
@@ -23,9 +24,13 @@ export const BottomNavigation = ({ selectedCard, setSelectedCard }: BottomNaviga
2324
'navigationItem ' + (selectedCard && selectedCard.name === card.name ? 'active' : '')
2425
}
2526
onClick={() => setSelectedCard(card)}>
26-
{card.type === 'supported'
27-
? constantCard?.icon
28-
: <img src={constantCard?.icon} alt="" /> || <BsRssFill className="rss" />}
27+
{React.isValidElement(constantCard?.icon) ? (
28+
constantCard.icon
29+
) : typeof constantCard?.icon === 'string' ? (
30+
<img src={constantCard.icon} alt="" />
31+
) : (
32+
<BsRssFill className="rss" />
33+
)}
2934
</button>
3035
)
3136
})}

0 commit comments

Comments
 (0)