Skip to content

Commit

Permalink
feat: add overlayStyles prop to modal (#637)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsladerman authored Aug 21, 2024
1 parent d55d588 commit a27ad7a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/ModalWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
import * as Dialog from '@radix-ui/react-dialog'

import { type ReactNode, forwardRef } from 'react'
import styled, { useTheme } from 'styled-components'
import styled, { type CSSObject, useTheme } from 'styled-components'

const ANIMATION_SPEED = '150ms'

export type ModalWrapperProps = {
open: boolean
onOpenChange?: (open: boolean) => void
overlayStyles?: CSSObject
children?: ReactNode
} & Dialog.DialogContentProps

function ModalWrapperRef(
{ open, onOpenChange, children, ...props }: ModalWrapperProps,
{ open, onOpenChange, overlayStyles, children, ...props }: ModalWrapperProps,
ref: any
) {
const theme = useTheme()
Expand All @@ -25,7 +26,10 @@ function ModalWrapperRef(
onOpenChange={onOpenChange}
>
<Dialog.Portal container={portalElement}>
<OverlaySC onClick={(e) => e.stopPropagation()}>
<OverlaySC
onClick={(e) => e.stopPropagation()}
style={overlayStyles}
>
<ContentSC
ref={ref}
{...props}
Expand Down

0 comments on commit a27ad7a

Please sign in to comment.