11import type { CSSProperties , FC } from 'react' ;
2- import React from 'react' ;
3- import classNames from 'classnames' ;
2+ import React , { useContext } from 'react' ;
3+ import clsx from 'classnames' ;
44import type { CSSMotionProps } from 'rc-motion' ;
55import { CSSMotionList } from 'rc-motion' ;
66import type { InnerOpenConfig , NoticeConfig , OpenConfig , Placement } from './interface' ;
77import Notice from './Notice' ;
8+ import { NotificationContext } from './NotificationProvider' ;
89
910export interface NoticeListProps {
1011 configList ?: OpenConfig [ ] ;
@@ -16,9 +17,6 @@ export interface NoticeListProps {
1617 onAllNoticeRemoved ?: ( placement : Placement ) => void ;
1718 onNoticeClose ?: ( key : React . Key ) => void ;
1819
19- // Hook Slots
20- useStyle ?: ( prefixCls : string ) => { notice ?: string ; list ?: string } ;
21-
2220 // Common
2321 className ?: string ;
2422 style ?: CSSProperties ;
@@ -31,13 +29,12 @@ const NoticeList: FC<NoticeListProps> = (props) => {
3129 prefixCls,
3230 className,
3331 style,
34- useStyle,
3532 motion,
3633 onAllNoticeRemoved,
3734 onNoticeClose,
3835 } = props ;
3936
40- const styles = useStyle ?. ( prefixCls ) ;
37+ const { classNames : ctxCls } = useContext ( NotificationContext ) ;
4138
4239 const keys = configList . map ( ( config ) => ( {
4340 config,
@@ -49,7 +46,7 @@ const NoticeList: FC<NoticeListProps> = (props) => {
4946 return (
5047 < CSSMotionList
5148 key = { placement }
52- className = { classNames ( prefixCls , `${ prefixCls } -${ placement } ` , styles ?. list , className ) }
49+ className = { clsx ( prefixCls , `${ prefixCls } -${ placement } ` , ctxCls ?. list , className ) }
5350 style = { style }
5451 keys = { keys }
5552 motionAppear
@@ -67,7 +64,7 @@ const NoticeList: FC<NoticeListProps> = (props) => {
6764 { ...config }
6865 ref = { nodeRef }
6966 prefixCls = { prefixCls }
70- className = { classNames ( motionClassName , configClassName , styles ?. notice ) }
67+ className = { clsx ( motionClassName , configClassName , ctxCls ?. notice ) }
7168 style = { {
7269 ...motionStyle ,
7370 ...configStyle ,
0 commit comments