mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
refactor: add hook use-is-mobile for use-window-width calls
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import useWindowWidth from './use-window-width';
|
||||
|
||||
const useIsMobile = () => {
|
||||
const windowWidth = useWindowWidth();
|
||||
return windowWidth < 640;
|
||||
};
|
||||
|
||||
export default useIsMobile;
|
||||
@@ -1,12 +1,12 @@
|
||||
import { useState, useCallback } from 'react';
|
||||
import useWindowWidth from './use-window-width';
|
||||
import useIsMobile from './use-is-mobile';
|
||||
|
||||
const useReplyModal = () => {
|
||||
const [showReplyModal, setShowReplyModal] = useState(false);
|
||||
const [activeCid, setActiveCid] = useState<string | null>(null);
|
||||
|
||||
// on mobile, the position is absolute instead of fixed, so we need to calculate the top position
|
||||
const isMobile = useWindowWidth() < 640;
|
||||
const isMobile = useIsMobile();
|
||||
const [scrollY, setScrollY] = useState<number>(0);
|
||||
|
||||
const closeModal = useCallback(() => {
|
||||
|
||||
Reference in New Issue
Block a user