Skip to content

Commit

Permalink
chore: replace ReactRemoveScroll with FloatingOverlay (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa authored Sep 24, 2023
1 parent cb94c0f commit fdd9c2d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 113 deletions.
1 change: 0 additions & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"@hiogawa/unocss-preset-antd": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-remove-scroll": "^2.5.5",
"react-router-dom": "^6.8.0",
"react-select": "^5.7.0"
},
Expand Down
9 changes: 3 additions & 6 deletions packages/app/src/components/drawer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
FloatingOverlay,
FloatingPortal,
useDismiss,
useFloating,
Expand All @@ -8,7 +9,6 @@ import {
import { Transition } from "@hiogawa/tiny-transition/dist/react";
import { tinyassert } from "@hiogawa/utils";
import type React from "react";
import { RemoveScroll } from "react-remove-scroll";

export function Drawer(props: {
open: boolean;
Expand Down Expand Up @@ -42,10 +42,7 @@ export function Drawer(props: {
leaveTo="opacity-0"
/>
{/* content */}
<RemoveScroll
className="fixed inset-0 overflow-hidden"
removeScrollBar={false}
>
<FloatingOverlay lockScroll>
<Transition
appear
show={props.open}
Expand All @@ -64,7 +61,7 @@ export function Drawer(props: {
{props.children}
</div>
</Transition>
</RemoveScroll>
</FloatingOverlay>
</Transition>
</FloatingPortal>
);
Expand Down
10 changes: 5 additions & 5 deletions packages/app/src/components/modal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
FloatingOverlay,
FloatingPortal,
useDismiss,
useFloating,
Expand All @@ -8,7 +9,6 @@ import {
import { Transition } from "@hiogawa/tiny-transition/dist/react";
import { tinyassert } from "@hiogawa/utils";
import React from "react";
import { RemoveScroll } from "react-remove-scroll";
import { cls } from "../utils/misc";

// copied from https://github.com/hi-ogawa/web-ext-tab-manager/blame/81710dead04859525b9c8be3a73a71926cae6da4/src/components/modal.tsx
Expand Down Expand Up @@ -47,9 +47,9 @@ function Modal(props: {
leaveTo="opacity-0"
/>
{/* content */}
<RemoveScroll
className="fixed inset-0 overflow-hidden flex justify-center items-center"
removeScrollBar={false}
<FloatingOverlay
lockScroll
className="flex justify-center items-center"
>
<Transition
appear
Expand All @@ -72,7 +72,7 @@ function Modal(props: {
{props.children}
</div>
</Transition>
</RemoveScroll>
</FloatingOverlay>
</Transition>
</FloatingPortal>
);
Expand Down
101 changes: 0 additions & 101 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fdd9c2d

Please sign in to comment.