diff --git a/web/src/components/Cart/Cart.tsx b/web/src/components/Cart/Cart.tsx index c5ff83d..af23d40 100644 --- a/web/src/components/Cart/Cart.tsx +++ b/web/src/components/Cart/Cart.tsx @@ -25,7 +25,7 @@ import LineItem from './LineItem' // ___________________________________________________________________ type Props = { - mainRef?: React.RefObject + mainRef: React.RefObject // isPortalOpen: boolean // setPortalOpen: (arg0: boolean) => void } @@ -108,59 +108,69 @@ const Cart: React.FC = ({ mainRef }) => { const [hasItems, quantity] = useQuantity() return ( <> - - - - {isCartOpen && ( - - <> - {/*
*/} -
- Your cart - - {/* */} - close - -
- - - - )} - - - + setCartOpen(false)} + scrollRef={scrollRef} + mainRef={mainRef} + exitRef={exitRef} + > + + + + {isCartOpen && ( + + <> + {/*
*/} +
+ Your cart + + {/* */} + close + +
+ + + + )} + + + + ) } diff --git a/web/src/components/Cart/LineItem/LineItem.tsx b/web/src/components/Cart/LineItem/LineItem.tsx index 1002410..c30e4fb 100644 --- a/web/src/components/Cart/LineItem/LineItem.tsx +++ b/web/src/components/Cart/LineItem/LineItem.tsx @@ -48,7 +48,7 @@ const LineItem: React.FC<{ item: LineItem }> = ({ item }) => { element.focus({ preventScroll: true }) - console.log('e clicked') + console.log('should focus input') } } diff --git a/web/src/components/Cart/styles.scss.tsx b/web/src/components/Cart/styles.scss.tsx index 567845c..f3a541a 100644 --- a/web/src/components/Cart/styles.scss.tsx +++ b/web/src/components/Cart/styles.scss.tsx @@ -23,24 +23,27 @@ export const Cart = styled(Box)` backdrop-filter: blur(9px); opacity: 0; visibility: hidden; - - position: fixed; - /* top: 0; */ + + position: absolute; + top: 0; right: 0; bottom: 0; z-index: 9999; transition: ${theme.transition.all}; - /* overflow: auto; - -webkit-overflow-scrolling: touch; */ + overflow: scroll; + -webkit-overflow-scrolling: touch; @media ${theme.mq.tablet} { border-left: ${theme.border}; opacity: 0; visibility: hidden; - left: auto; + position: fixed; + top: ${theme.headerHeight}; + right: 0; + bottom: 0; padding: ${theme.space[5]}; height: calc(100% - ${theme.headerHeight}); width: ${cartWidth}; diff --git a/web/src/components/Header/Header.tsx b/web/src/components/Header/Header.tsx index e6ddf88..4d918b8 100644 --- a/web/src/components/Header/Header.tsx +++ b/web/src/components/Header/Header.tsx @@ -142,7 +142,7 @@ const Header: React.FC = ({ mainRef }) => { - + ) } diff --git a/web/src/styles/global.ts b/web/src/styles/global.ts index 64238e8..911aea9 100644 --- a/web/src/styles/global.ts +++ b/web/src/styles/global.ts @@ -16,6 +16,14 @@ const GlobalStyles = createGlobalStyle` ${RootVars} ${Reset} ${Typography} + + html, + body { + height: 100%; + width: 100%; + overflow: auto; + -webkit-overflow-scrolling: auto + } body { background: ${theme.colors.secondary};