From 8e7872e2c9e427278ed1ad77df692a54b3f0923c Mon Sep 17 00:00:00 2001 From: dzucconi Date: Wed, 27 May 2020 16:11:41 -0400 Subject: [PATCH] Utilizes ModalBase for mobile action sheet; tapping on "Filter" scrolls to top --- .../ArtworkFilterMobileActionSheet.tsx | 59 +++++++++++-------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/src/v2/Components/v2/ArtworkFilter/ArtworkFilterMobileActionSheet.tsx b/src/v2/Components/v2/ArtworkFilter/ArtworkFilterMobileActionSheet.tsx index 42949353609..ebedd57b960 100644 --- a/src/v2/Components/v2/ArtworkFilter/ArtworkFilterMobileActionSheet.tsx +++ b/src/v2/Components/v2/ArtworkFilter/ArtworkFilterMobileActionSheet.tsx @@ -1,5 +1,13 @@ -import { Box, Button, Flex, Sans, color } from "@artsy/palette" -import React, { SFC } from "react" +import { + Box, + Button, + Clickable, + Flex, + ModalBase, + Sans, + color, +} from "@artsy/palette" +import React, { SFC, useRef } from "react" import styled from "styled-components" import { initialArtworkFilterState, @@ -13,22 +21,42 @@ export const ArtworkFilterMobileActionSheet: SFC<{ }> = ({ children, onClose }) => { const filterContext = useArtworkFilterContext() + const contentRef = useRef(null) + // This reflects our zero state for this UI which doesn't include the keyword const isReset = isEqual( omit(filterContext.filters, "reset", "keyword"), initialArtworkFilterState ) + const handleScrollToTop = () => { + if (!contentRef.current) return + contentRef.current.scrollTop = 0 + } + return ( - +
- - Filter - + {/* TODO: This extraneous Flex is not necessary, Clickable (and Box) should have Flex props*/} + + + + Filter + + +
- + {children} @@ -51,25 +79,10 @@ export const ArtworkFilterMobileActionSheet: SFC<{ Apply -
+ ) } -const Container = styled(Box)` - position: fixed; - - /* The z-index after Force's mobile top-nav header */ - z-index: 971; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: white; - display: flex; - flex-direction: column; - overflow: hidden; -` - const Header = styled(Flex)` width: 100%; align-items: center;