diff --git a/src/app/page.tsx b/src/app/page.tsx index a84f4498..116866cb 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -29,9 +29,9 @@ function Home() {
-
- {!isWebDevice && ( -

+

+ {windowWidth < 768 && ( +

The Peninsula Humane Society & SPCA (PHS/SPCA) is a local, private, non-profit charitable organization dedicated to animal welfare. PHS/SPCA is truly an open admission shelter, not only accepting many @@ -43,7 +43,7 @@ function Home() { className="web:w-auto h-48 rounded-lg bg-mint-cream web:bg-ivory justify-center items-center mt-10 web:mt-0 m-2 inline-flex px-10 py-11 web:px-[4.59rem] py-[2.875rem]" > -

+

Peninsula Humane Society & SPCA guided by the humane ethics, builds healthy relationships between people and animals.

diff --git a/src/context/WindowWidthContext/WindowWidthContext.tsx b/src/context/WindowWidthContext/WindowWidthContext.tsx index f8330ce6..e69de29b 100644 --- a/src/context/WindowWidthContext/WindowWidthContext.tsx +++ b/src/context/WindowWidthContext/WindowWidthContext.tsx @@ -1,62 +0,0 @@ -'use client'; - -import React, { - createContext, - useState, - useEffect, - useContext, - useMemo, - useCallback, -} from 'react'; - -interface WindowWidthContextProps { - isWeb: boolean; -} - -const WindowWidthContext = createContext( - undefined, -); -/** - * - * @param root0 - Provider that checks window width and calculates if this is a web or mobile screen - * @param root0.children - Provider will give context to its children components. - * @returns The WindowWidthProvider component, should be wrapped across the whole project for - * responsive design, per the Progressive Web Application functionality. - * This provider is used in the root layout of the project such that we have global access to the window width - * and can conditionally render accordingly. - */ -export function WindowWidthProvider({ - children, -}: { - children: React.ReactNode; -}) { - const [isWeb, setIsWeb] = useState(false); - const handleResize = useCallback(() => { - setIsWeb(window.innerWidth >= 1024); - }, []); - - useEffect(() => { - handleResize(); - window.addEventListener('resize', handleResize); - return () => { - window.removeEventListener('resize', handleResize); - }; - }, [handleResize]); - - const windowWidthValue = useMemo(() => ({ isWeb }), [isWeb]); - - return ( - - {children} - - ); -} - -export const useWebDeviceDetection = () => { - const context = useContext(WindowWidthContext); - if (context === undefined) { - throw new Error('useIsWeb must be used within a WindowWidthProvider'); - } - - return context.isWeb; -};