Skip to content

Commit

Permalink
refactor: use useMedia instead of window.matchMedia
Browse files Browse the repository at this point in the history
  • Loading branch information
fabryscript committed Jan 10, 2025
1 parent 4be0212 commit ee2efe1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/web/integrations/moonpay/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { apiClient } from "@osmosis-labs/utils";
import { observer } from "mobx-react-lite";
import dynamic from "next/dynamic";
import { FunctionComponent, useMemo } from "react";
import { FunctionComponent } from "react";
import { useMedia } from "react-use";

import { MoonpaySignUrlResponse } from "~/integrations/moonpay/types";
import { ModalBaseProps } from "~/modals";
Expand Down Expand Up @@ -31,10 +32,7 @@ export const Moonpay: FunctionComponent<
> = observer(({ assetKey, isOpen }) => {
const { chainStore, accountStore } = useStore();

const prefersDark = useMemo(
() => window.matchMedia("(prefers-color-scheme: dark)").matches,
[]
);
const prefersDark = useMedia("(prefers-color-scheme: dark)");

const account = accountStore.getWallet(chainStore.osmosis.chainId);

Expand Down

0 comments on commit ee2efe1

Please sign in to comment.