diff --git a/.env.template b/.env.template index cab0ea9e..426dada3 100644 --- a/.env.template +++ b/.env.template @@ -1,3 +1,4 @@ +NODE_ENV="development" # Shopify SESSION_SECRET="foobar" PUBLIC_STORE_DOMAIN="headless-journey.myshopify.com" diff --git a/app/components/layout/CartDrawer.tsx b/app/components/layout/CartDrawer.tsx index 5214778e..230e5aa9 100644 --- a/app/components/layout/CartDrawer.tsx +++ b/app/components/layout/CartDrawer.tsx @@ -4,7 +4,6 @@ import {Await, Link} from '@remix-run/react'; import {CartForm} from '@shopify/hydrogen'; import {cx} from 'class-variance-authority'; import {Suspense, useCallback, useEffect, useMemo, useState} from 'react'; -import {useWindowSize} from 'react-use'; import {useCartFetchers} from '~/hooks/useCartFetchers'; import {useIsHydrated} from '~/hooks/useIsHydrated'; @@ -12,6 +11,7 @@ import {useLocalePath} from '~/hooks/useLocalePath'; import {useRootLoaderData} from '~/hooks/useRootLoaderData'; import {useSanityThemeContent} from '~/hooks/useSanityThemeContent'; +import {useDevice} from '../../hooks/useDevice'; import {Cart} from '../cart/Cart'; import {IconBag} from '../icons/IconBag'; import {IconLoader} from '../icons/IconLoader'; @@ -88,7 +88,7 @@ function Badge(props: {cart?: CartType | null; count: number}) { const buttonClass = cx([ 'relative flex size-8 items-center justify-center', - count > 0 && 'mr-3 md:mr-0', + count > 0 && 'mr-3 lg:mr-0', ]); return isHydrated ? ( @@ -99,7 +99,7 @@ function Badge(props: {cart?: CartType | null; count: number}) { > {BadgeCounter} e.preventDefault()} onOpenAutoFocus={(e) => e.preventDefault()} > @@ -118,17 +118,3 @@ function Badge(props: {cart?: CartType | null; count: number}) { ); } - -function useDevice() { - const windowSize = useWindowSize(); - const device = useMemo(() => { - if (windowSize.width < 640) { - return 'mobile'; - } else if (windowSize.width < 728) { - return 'tablet'; - } - return 'desktop'; - }, [windowSize]); - - return device; -} diff --git a/app/components/layout/Header.tsx b/app/components/layout/Header.tsx index c8c249d0..6ac875cc 100644 --- a/app/components/layout/Header.tsx +++ b/app/components/layout/Header.tsx @@ -33,11 +33,11 @@ export function Header() { return (