From 30c39d821a74a2b8c9965793eefaac8f62e1ad0b Mon Sep 17 00:00:00 2001 From: Mattias Andersson Date: Tue, 10 Oct 2023 08:55:19 +0200 Subject: [PATCH] - Add `floating` prop to Drawer. It creates a gap between Drawer and viewport, and adds round corners. - SearchFilterDrawer is now floating. - Header of SearchFilterDrawer is now sticky. --- .../components/SearchFilterDrawer.tsx | 7 +- .../components/SearchFilterPanelHeader.tsx | 8 +- .../stories/SearchFilter.stories.tsx | 315 +++++++++--------- .../src/components/drawer/Drawer.module.css | 5 + .../modal/src/components/drawer/Drawer.tsx | 13 +- 5 files changed, 187 insertions(+), 161 deletions(-) diff --git a/packages/filter/src/features/search-filter/components/SearchFilterDrawer.tsx b/packages/filter/src/features/search-filter/components/SearchFilterDrawer.tsx index f7452e9f7..1a64b81b8 100644 --- a/packages/filter/src/features/search-filter/components/SearchFilterDrawer.tsx +++ b/packages/filter/src/features/search-filter/components/SearchFilterDrawer.tsx @@ -31,7 +31,12 @@ export const SearchFilterDrawer: React.FC = ({ }, [actions, dispatch]); return ( - + void; @@ -13,7 +14,12 @@ export const SearchFilterPanelHeader: React.FC< SearchFilterPanelHeaderProps > = ({ onRequestClose, header = "Filter", contentRight }) => { return ( - + { return ( - - - - - - - - - - - + + + + + + + + + - + + }> { return ( - - - - App name - - - - - - - - - + + + App name + + + + + + + + - + + { return ( - - - - App name - - - - - - - - - + + + App name + + + + + + + + - + + }> { return ( - - - - App name - - - - - - - + + + App name + + + + + + - + + { background?: string; + + /** + * When true, there will be a gap between the drawer and the viewport. + */ + floating?: boolean; + zIndex?: number; onRequestClose?: () => void; /** @@ -55,6 +61,7 @@ export const Drawer: React.FC = ({ children, slideFrom = "left", portalTarget, + floating, ...reactModalProps }) => { const { height, width } = reactModalProps as FlattenUnion; @@ -69,7 +76,11 @@ export const Drawer: React.FC = ({ beforeClose: styles.beforeClose, }} className={{ - base: cx(styles.content, getClassNameForSlide(slideFrom)), + base: cx( + styles.content, + getClassNameForSlide(slideFrom), + floating && styles.floating + ), afterOpen: styles.afterOpen, beforeClose: styles.beforeClose, }}