import React, { useEffect } from 'react' import styled from '@emotion/styled' import Link from 'next/link' import { EyeIcon, EyeOffIcon } from '@heroicons/react/outline' import Modal from './Modal' import useLocalStorageState from '../hooks/useLocalStorageState' import useMangoStore from '../stores/useMangoStore' import { LinkButton } from './Button' const StyledColumnHeader = styled.span` font-size: 0.6rem; ` const MarketsModal = ({ isOpen, markets, onClose, }: { isOpen: boolean markets: Array onClose?: (x?) => void }) => { const [hiddenMarkets, setHiddenMarkets] = useLocalStorageState( 'hiddenMarkets', [] ) const setMangoStore = useMangoStore((s) => s.set) useEffect(() => { setMangoStore((state) => { state.blurBackground = true }) }, []) const handleClose = () => { setMangoStore((state) => { state.blurBackground = false }) onClose() } const handleHideShowMarket = (asset) => { if (hiddenMarkets.includes(asset)) { setHiddenMarkets(hiddenMarkets.filter((m) => m !== asset)) } else { setHiddenMarkets(hiddenMarkets.concat(asset)) } } return (
Markets
setHiddenMarkets([])} > Show all in Nav
{markets.map((m) => (
{m.baseAsset}
{hiddenMarkets.includes(m.baseAsset) ? ( handleHideShowMarket(m.baseAsset)} /> ) : ( handleHideShowMarket(m.baseAsset)} /> )}
Market
Price 24h Change 24h Vol
{m.markets.map((m, i) => (
{m.name}
$10,000 +2.44% $233m
))}
))}
) } export default React.memo(MarketsModal)