A drawer component for React.
fix: prop typo (#33)
Telmen Munkhdalai792ddc30ce99
diff --git a/README.md b/README.mdindex 5c62e37..db2e7b9 100644--- a/README.md+++ b/README.md@@ -49,7 +49,7 @@ Can be controlled with the `value` and `onOpenChange` props. Can be opened by deAdditional props:-`closeTreshold`: Number between 0 and 1 that determines when the drawer should be closed. Example: `closeTreshold`` of 0.5 would close the drawer if the user swiped for 50% of the height of the drawer or more.+`closeThreshold`: Number between 0 and 1 that determines when the drawer should be closed. Example: `closeThreshold`` of 0.5 would close the drawer if the user swiped for 50% of the height of the drawer or more.`scrollLockTimeout`: Duration for which the drawer is not draggable after scrolling content inside of the drawer. Defaults to 1000msdiff --git a/src/index.tsx b/src/index.tsxindex 4626d3f..e983f58 100644--- a/src/index.tsx+++ b/src/index.tsx@@ -8,7 +8,9 @@ import './style.css';import { usePreventScroll, isInput } from './use-prevent-scroll';import { useComposedRefs } from './use-composed-refs';-const CLOSE_TRESHOLD = 0.25;++const CLOSE_THRESHOLD = 0.25;+const SCROLL_LOCK_TIMEOUT = 1000;const TRANSITIONS = {@@ -78,7 +80,7 @@ interface DialogProps {children?: React.ReactNode;open?: boolean;defaultOpen?: boolean;- closeTreshold?: number;+ closeThreshold?: number;onOpenChange?(open: boolean): void;shouldScaleBackground?: boolean;scrollLockTimeout?: number;@@ -95,7 +97,7 @@ function Root({shouldScaleBackground,onDrag: onDragProp,onRelease: onReleaseProp,- closeTreshold = CLOSE_TRESHOLD,+ closeThreshold = CLOSE_THRESHOLD,scrollLockTimeout = SCROLL_LOCK_TIMEOUT,dismissible = true,}: DialogProps) {@@ -375,9 +377,10 @@ function Root({return;}- const visibleDrawerHeight = Math.min(drawerRef.current?.getBoundingClientRect().height || 0, window.innerHeight);- if (swipeAmount >= visibleDrawerHeight * closeTreshold) {+ const visibleDrawerHeight = Math.min(drawerRef.current?.getBoundingClientRect().height || 0, window.innerHeight);++ if (swipeAmount >= visibleDrawerHeight * closeThreshold) {closeDrawer();onReleaseProp?.(event, false);return;