stacker.news/components/wallet-image.js
ekzyis cb9947e4f2
refactor: Check darkmode in useWallets (#1640)
* Check darkmode in useWallets

* Check darkmode in useWalletImage
2024-11-23 17:59:59 -06:00

15 lines
363 B
JavaScript

import useDarkMode from '@/components/dark-mode'
export function useWalletImage (wallet) {
const [darkMode] = useDarkMode()
const { title, image } = wallet.def.card
if (!image) return null
// wallet.png <-> wallet-dark.png
const src = darkMode ? image?.src.replace(/\.([a-z]{3})$/, '-dark.$1') : image?.src
return { ...image, alt: title, src }
}