diff --git a/components/mobile/BottomBar.tsx b/components/mobile/BottomBar.tsx new file mode 100644 index 00000000..a0895cf0 --- /dev/null +++ b/components/mobile/BottomBar.tsx @@ -0,0 +1,171 @@ +import { ReactNode, useState } from 'react' +import Link from 'next/link' +import { useRouter } from 'next/router' +import { ChartBarIcon, HomeIcon, MenuIcon, XIcon } from '@heroicons/react/solid' +import TradeIcon from '../icons/TradeIcon' +import { useTranslation } from 'next-i18next' +import { IconButton } from '../shared/Button' +import { + CashIcon, + ChevronRightIcon, + CurrencyDollarIcon as FeesIcon, + LightBulbIcon, +} from '@heroicons/react/solid' + +const StyledBarItemLabel = ({ + children, + ...props +}: { + children: ReactNode +}) => ( +
+ {children} +
+) + +const BottomBar = () => { + const { t } = useTranslation('common') + const { asPath } = useRouter() + const [showPanel, setShowPanel] = useState(false) + + return ( + <> +
+ + + + {t('portfolio')} + + + + + + {t('trade')} + + + + + + {t('stats')} + + + setShowPanel(!showPanel)} + > + + {t('more')} + +
+ + + ) +} + +export default BottomBar + +const MoreMenuPanel = ({ + showPanel, + setShowPanel, +}: { + showPanel: boolean + setShowPanel: (showPanel: boolean) => void +}) => { + const { t } = useTranslation('common') + return ( +
+
+ setShowPanel(false)} hideBg> + + +
+
setShowPanel(false)} + > + } + /> + } + /> + } + isExternal + /> +
+
+ ) +} + +const MoreMenuItem = ({ + title, + path, + icon, + isExternal, +}: { + title: string + path: string + icon: ReactNode + isExternal?: boolean +}) => { + const classNames = + 'default-transition flex w-full items-center justify-between border-t border-th-bkg-4 px-2 py-3 text-th-fgd-2 hover:text-th-fgd-1' + return isExternal ? ( + +
+ {icon} + {title} +
+ +
+ ) : ( + + +
+ {icon} + {title} +
+ +
+ + ) +} diff --git a/components/shared/Layout.tsx b/components/shared/Layout.tsx index b0fb88f7..40a7f53e 100644 --- a/components/shared/Layout.tsx +++ b/components/shared/Layout.tsx @@ -19,6 +19,7 @@ import MangoAccountSummary from '../account/MangoAccountSummary' import { HealthType, MangoAccount } from '@blockworks-foundation/mango-v4' import mangoStore from '../../store/state' import HealthHeart from '../account/HealthHeart' +import BottomBar from '../mobile/BottomBar' const Layout = ({ children }: { children: ReactNode }) => { const mangoAccount = mangoStore((s) => s.mangoAccount) @@ -26,9 +27,10 @@ const Layout = ({ children }: { children: ReactNode }) => { const { connected } = useWallet() const [isCollapsed, setIsCollapsed] = useState(false) const { width } = useViewport() + const isMobile = width ? width < breakpoints.md : false useEffect(() => { - const collapsed = width ? width < breakpoints.lg : false + const collapsed = width ? width < breakpoints.xl : false setIsCollapsed(collapsed) }, []) @@ -39,29 +41,39 @@ const Layout = ({ children }: { children: ReactNode }) => { }, 100) } + console.log(width) + return (
-
-
- -
- + {isMobile ? ( +
+ +
+ ) : ( +
+
+ +
+ +
-
+ )}
diff --git a/pages/_app.tsx b/pages/_app.tsx index 35f8a4d2..de8d67da 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -22,6 +22,7 @@ import { ThemeProvider } from 'next-themes' import { TOKEN_LIST_URL } from '@jup-ag/core' import { appWithTranslation } from 'next-i18next' import Layout from '../components/shared/Layout' +import { ViewportProvider } from '../hooks/useViewport' const hydrateStore = async () => { const actions = mangoStore.getState().actions @@ -79,9 +80,11 @@ function MyApp({ Component, pageProps }: AppProps) { - - - + + + + +