Skip to content

Commit

Permalink
remove redundant body lock from modal
Browse files Browse the repository at this point in the history
  • Loading branch information
jsladerman committed Sep 17, 2024
1 parent 065a984 commit 05d2e06
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/components/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// this is just styling, actual modal logic is in ModalWrapper

import {
type ReactNode,
type Ref,
forwardRef,
useCallback,
useEffect,
} from 'react'
import { type ReactNode, type Ref, forwardRef, useCallback } from 'react'

import styled, {
type StyledComponentPropsWithRef,
Expand All @@ -19,15 +13,13 @@ import * as Dialog from '@radix-ui/react-dialog'

import { type ColorKey, type Nullable, type SeverityExt } from '../types'

import useLockedBody from '../hooks/useLockedBody'

import Card from './Card'
import CheckRoundedIcon from './icons/CheckRoundedIcon'
import type createIcon from './icons/createIcon'
import ErrorIcon from './icons/ErrorIcon'
import InfoIcon from './icons/InfoIcon'
import WarningIcon from './icons/WarningIcon'
import { ModalWrapper, type ModalWrapperProps } from './ModalWrapper'
import Card from './Card'

export const SEVERITIES = [
'info',
Expand All @@ -49,7 +41,6 @@ type ModalPropsType = ModalWrapperProps & {
header?: ReactNode
actions?: ReactNode
severity?: ModalSeverity
lockBody?: boolean
asForm?: boolean
formProps?: StyledComponentPropsWithRef<'form'>
}
Expand Down Expand Up @@ -151,7 +142,6 @@ function ModalRef(
size = form ? 'large' : 'medium',
onClose,
severity,
lockBody = true,
asForm = false,
formProps = {},
scrollable = true,
Expand All @@ -163,12 +153,6 @@ function ModalRef(
const HeaderIcon = severityToIcon[severity ?? 'default']
const iconColorKey = severityToIconColorKey[severity ?? 'default']

const [, setBodyLocked] = useLockedBody(open && lockBody)

useEffect(() => {
setBodyLocked(lockBody && open)
}, [lockBody, open, setBodyLocked])

const triggerClose = useCallback(
(open: boolean) => {
if (!open) onClose?.()
Expand Down

0 comments on commit 05d2e06

Please sign in to comment.