Skip to content

Commit

Permalink
fix: Fix popup's width when viewport changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Przeblysk committed Oct 16, 2024
1 parent a079d85 commit a565126
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Trans, useTranslation } from "react-i18next"
import { toast } from "sonner"
import { useOnClickOutside } from "usehooks-ts"

import { useViewport } from "~/atoms/hooks/viewport"
import { ActionButton, Button, IconButton } from "~/components/ui/button"
import { Kbd, KbdCombined } from "~/components/ui/kbd/Kbd"
import { RootPortal } from "~/components/ui/portal"
Expand Down Expand Up @@ -42,6 +43,10 @@ export const MarkAllReadWithOverlay = forwardRef<
useOnClickOutside({ current: popoverRef }, () => {
setShow(false)
})

// change popup's width when viewport changes.
useViewport((v) => v.w)

const renderPopup = () => {
const $parent = containerRef.current!
const rect = $parent.getBoundingClientRect()
Expand Down

0 comments on commit a565126

Please sign in to comment.