From d24a8277b213c544e61e5fbcf6f9bdf8bc5c1d5d Mon Sep 17 00:00:00 2001 From: Pete Watters <2938440+pete-watters@users.noreply.github.com> Date: Fri, 2 Feb 2024 17:05:08 +0000 Subject: [PATCH] chore: deprecate use-media-query and fix lint errors --- src/app/common/hooks/use-media-query.ts | 23 ------------------- src/app/features/container/container.tsx | 6 ++--- .../{getOnClose.ts => get-on-close.ts} | 0 ...{getPopupHeader.ts => get-popup-header.ts} | 0 ...tTitleFromUrl.ts => get-title-from-url.ts} | 0 5 files changed, 3 insertions(+), 26 deletions(-) delete mode 100644 src/app/common/hooks/use-media-query.ts rename src/app/features/container/{getOnClose.ts => get-on-close.ts} (100%) rename src/app/features/container/{getPopupHeader.ts => get-popup-header.ts} (100%) rename src/app/features/container/{getTitleFromUrl.ts => get-title-from-url.ts} (100%) diff --git a/src/app/common/hooks/use-media-query.ts b/src/app/common/hooks/use-media-query.ts deleted file mode 100644 index 1d9249726cc..00000000000 --- a/src/app/common/hooks/use-media-query.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { useEffect, useState } from 'react'; - -import { BreakpointToken, token } from 'leather-styles/tokens'; - -function useMediaQuery(query: string) { - const [matches, setMatches] = useState(false); - - useEffect(() => { - const media = window.matchMedia(query); - if (media.matches !== matches) { - setMatches(media.matches); - } - const listener = () => setMatches(media.matches); - window.addEventListener('resize', listener); - return () => window.removeEventListener('resize', listener); - }, [matches, query]); - - return matches; -} - -export function useViewportMinWidth(viewport: BreakpointToken) { - return useMediaQuery(`(min-width: ${token(`breakpoints.${viewport}`)})`); -} diff --git a/src/app/features/container/container.tsx b/src/app/features/container/container.tsx index 64e76a0b947..05707dd979c 100644 --- a/src/app/features/container/container.tsx +++ b/src/app/features/container/container.tsx @@ -25,9 +25,9 @@ import { ContainerLayout } from '../../ui/components/containers/container.layout import { SwitchAccountDialog } from '../dialogs/switch-account-dialog/switch-account-dialog'; import { useRestoreFormState } from '../popup-send-form-restoration/use-restore-form-state'; import { SettingsDropdown } from '../settings-dropdown/settings-dropdown'; -import { getOnClose } from './getOnClose'; -import { getDisplayAddresssBalanceOf, isKnownPopup, showAccountInfo } from './getPopupHeader'; -import { getTitleFromUrl } from './getTitleFromUrl'; +import { getOnClose } from './get-on-close'; +import { getDisplayAddresssBalanceOf, isKnownPopup, showAccountInfo } from './get-popup-header'; +import { getTitleFromUrl } from './get-title-from-url'; import { TotalBalance } from './total-balance'; export function Container() { diff --git a/src/app/features/container/getOnClose.ts b/src/app/features/container/get-on-close.ts similarity index 100% rename from src/app/features/container/getOnClose.ts rename to src/app/features/container/get-on-close.ts diff --git a/src/app/features/container/getPopupHeader.ts b/src/app/features/container/get-popup-header.ts similarity index 100% rename from src/app/features/container/getPopupHeader.ts rename to src/app/features/container/get-popup-header.ts diff --git a/src/app/features/container/getTitleFromUrl.ts b/src/app/features/container/get-title-from-url.ts similarity index 100% rename from src/app/features/container/getTitleFromUrl.ts rename to src/app/features/container/get-title-from-url.ts