diff --git a/components/Sidebar.tsx b/components/Sidebar.tsx index 1cee383..4e3389e 100644 --- a/components/Sidebar.tsx +++ b/components/Sidebar.tsx @@ -8,7 +8,7 @@ import { setTimezone } from 'contexts/globalSettings' import { setLogItemList, useLogStore } from 'contexts/log' import Link from 'next/link' import { useRouter } from 'next/router' -import { useEffect } from 'react' +import { useEffect, useState } from 'react' import { FaCog } from 'react-icons/fa' // import BrandText from 'public/brand/brand-text.svg' import { footerLinks, socialsLinks } from 'utils/links' @@ -26,6 +26,7 @@ export const Sidebar = () => { const router = useRouter() const wallet = useWallet() const logs = useLogStore() + const [isTallWindow, setIsTallWindow] = useState(false) useEffect(() => { if (logs.itemList.length === 0) return @@ -43,6 +44,18 @@ export const Sidebar = () => { ) }, []) + const handleResize = () => { + setIsTallWindow(window.innerHeight > 640) + } + + useEffect(() => { + handleResize() + window.addEventListener('resize', handleResize) + // return () => { + // window.removeEventListener('resize', handleResize) + // } + }, []) + return ( {/* Stargaze brand as home button */} @@ -53,7 +66,7 @@ export const Sidebar = () => { {/* main navigation routes */} -
+
  • {
    -
    - + {isTallWindow && ( +
    + - -
    + +
    + )} {/* Stargaze network status */} -
    Network: {wallet.chain.pretty_name}
    + {isTallWindow &&
    Network: {wallet.chain.pretty_name}
    } {/* footer reference links */}
      - {footerLinks.map(({ href, text }) => ( -
    • - - {text} - -
    • - ))} + {isTallWindow && + footerLinks.map(({ href, text }) => ( +
    • + + {text} + +
    • + ))}
    {/* footer attribution */} @@ -302,6 +318,7 @@ export const Sidebar = () => {
    {/* footer social links */} +
    {socialsLinks.map(({ Icon, href, text }) => (