Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add overlayStyles prop to modal #637

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading