1+ import { animated , useSpring } from '@react-spring/web'
2+ import { useDrag } from '@use-gesture/react'
3+ import { useIsomorphicLayoutEffect , useUnmountedRef } from 'ahooks'
14import classNames from 'classnames'
2- import React , { useState , useRef } from 'react'
35import type { FC , PropsWithChildren } from 'react'
4- import { useIsomorphicLayoutEffect , useUnmountedRef } from 'ahooks '
6+ import React , { useRef , useState } from 'react '
57import { NativeProps , withNativeProps } from '../../utils/native-props'
6- import { mergeProps } from '../../utils/with-default-props'
7- import Mask from '../mask'
8- import { useLockScroll } from '../../utils/use-lock-scroll'
98import { renderToContainer } from '../../utils/render-to-container'
10- import { useSpring , animated } from '@react-spring/web'
11- import { withStopPropagation } from '../../utils/with-stop-propagation'
129import { ShouldRender } from '../../utils/should-render'
13- import { defaultPopupBaseProps , PopupBaseProps } from './popup-base-props'
1410import { useInnerVisible } from '../../utils/use-inner-visible'
11+ import { useLockScroll } from '../../utils/use-lock-scroll'
12+ import { mergeProps } from '../../utils/with-default-props'
13+ import { withStopPropagation } from '../../utils/with-stop-propagation'
1514import { useConfig } from '../config-provider'
16- import { useDrag } from '@use-gesture/react'
17-
18- const classPrefix = `adm-popup`
15+ import Mask from '../mask'
16+ import { defaultPopupBaseProps , PopupBaseProps } from './popup-base-props'
1917
2018export type PopupProps = PopupBaseProps &
2119 PropsWithChildren < {
@@ -31,13 +29,13 @@ const defaultProps = {
3129}
3230
3331export const Popup : FC < PopupProps > = p => {
34- const { locale, popup : componentConfig = { } } = useConfig ( )
32+ const { locale, popup : componentConfig = { } , getPrefixCls } = useConfig ( )
3533 const props = mergeProps ( defaultProps , componentConfig , p )
36-
34+ const prefixCls = getPrefixCls ( 'popup' , props . prefixCls )
3735 const bodyCls = classNames (
38- `${ classPrefix } -body` ,
36+ `${ prefixCls } -body` ,
3937 props . bodyClassName ,
40- `${ classPrefix } -body-position-${ props . position } `
38+ `${ prefixCls } -body-position-${ props . position } `
4139 )
4240
4341 const [ active , setActive ] = useState ( props . visible )
@@ -93,7 +91,7 @@ export const Popup: FC<PopupProps> = p => {
9391 withNativeProps (
9492 props ,
9593 < div
96- className = { classPrefix }
94+ className = { prefixCls }
9795 onClick = { props . onClick }
9896 style = { {
9997 display : active ? undefined : 'none' ,
@@ -146,7 +144,7 @@ export const Popup: FC<PopupProps> = p => {
146144 { props . showCloseButton && (
147145 < a
148146 className = { classNames (
149- `${ classPrefix } -close-icon` ,
147+ `${ prefixCls } -close-icon` ,
150148 'adm-plain-anchor'
151149 ) }
152150 onClick = { ( ) => {
0 commit comments