From 1f14b4fbe17ffdc36fe9039cf0589e0fef88d6ec Mon Sep 17 00:00:00 2001 From: Sam Keen Date: Fri, 1 Apr 2022 15:20:23 +0100 Subject: [PATCH] Feat/48-mobile-experience (#194) * Mobile nav * Made the logo into a link to the home route * Bit of padding on transaction table cells to avoid smooshing --- apps/explorer/src/app/app.tsx | 31 +++++++++----- .../src/app/components/header/header.tsx | 32 ++++++++++----- .../src/app/components/main/index.tsx | 2 +- .../explorer/src/app/components/nav/index.tsx | 40 ++++++++++++------- .../src/app/components/search/search.tsx | 4 +- .../src/app/components/txs/txs-per-block.tsx | 4 +- 6 files changed, 75 insertions(+), 38 deletions(-) diff --git a/apps/explorer/src/app/app.tsx b/apps/explorer/src/app/app.tsx index 595caabdc..b4c694d23 100644 --- a/apps/explorer/src/app/app.tsx +++ b/apps/explorer/src/app/app.tsx @@ -1,3 +1,5 @@ +import { useState, useEffect, useMemo } from 'react'; +import { useLocation } from 'react-router'; import { ApolloProvider } from '@apollo/client'; import { ThemeContext } from '@vegaprotocol/react-helpers'; import { useThemeSwitcher } from '@vegaprotocol/react-helpers'; @@ -5,26 +7,37 @@ import { createClient } from './lib/apollo-client'; import { Nav } from './components/nav'; import { Header } from './components/header'; import { Main } from './components/main'; -import React from 'react'; import { DATA_SOURCES } from './config'; import { TendermintWebsocketProvider } from './contexts/websocket/tendermint-websocket-provider'; function App() { const [theme, toggleTheme] = useThemeSwitcher(); + const [menuOpen, setMenuOpen] = useState(false); - const client = React.useMemo( - () => createClient(DATA_SOURCES.dataNodeUrl), - [] - ); + const location = useLocation(); + + useEffect(() => { + setMenuOpen(false); + }, [location]); + + const client = useMemo(() => createClient(DATA_SOURCES.dataNodeUrl), []); return ( -
-
-