From ef1b074b4194340eae982e9e165c4ce3f37ce914 Mon Sep 17 00:00:00 2001 From: Piotr Rogowski Date: Mon, 7 Feb 2022 22:12:26 +0100 Subject: [PATCH] Fix TopBar responsiveness --- src/components/TopBar.tsx | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/components/TopBar.tsx b/src/components/TopBar.tsx index a99cc43..95cc87a 100644 --- a/src/components/TopBar.tsx +++ b/src/components/TopBar.tsx @@ -1,6 +1,7 @@ import { useCallback, useEffect, + useMemo, } from 'react'; import { useLocation, @@ -107,8 +108,8 @@ const TopBar = ({ tuneId }: { tuneId: string | null }) => { return () => document.removeEventListener('keydown', handleGlobalKeyboard); }); - const tabs = ( - + const tabs = useMemo(() => ( + { - ); + ), [buildTuneUrl, lg, navigate, pathname, rootPathMatch?.pathname, tabMatch?.pathname, tuneRootMatch?.pathname, tuneTuneMatch?.pathnameBase]); const rightMenuColProps = tuneId ? { - span: 10, + span: 8, md: 8, sm: 8, } : { @@ -160,6 +161,20 @@ const TopBar = ({ tuneId }: { tuneId: string | null }) => { sm: 8, }; + const downloadButton = useMemo(() => { + const list = []; + + if (lg) { + list.push('Download'); + } + + if (sm) { + list.push(); + } + + return list.length ? list : null; + }, [lg, sm]); + return (
@@ -217,8 +232,7 @@ const TopBar = ({ tuneId }: { tuneId: string | null }) => { trigger={['click']} >