File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed
Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 8484 }
8585 }
8686 }
87+
88+ &-stack {
89+ & :not (.@{notificationPrefixCls} -stack-expanded ) {
90+ .@{notificationPrefixCls} -list-item :nth- last- child(n + 4 ) {
91+ opacity : 0 ;
92+ pointer-events : none ;
93+ }
94+ }
95+ }
8796}
8897
8998.notification-fade {
Original file line number Diff line number Diff line change @@ -4,14 +4,14 @@ import { clsx } from 'clsx';
44import * as React from 'react' ;
55import type { StackConfig } from './interface' ;
66import { NotificationContext } from './legacy/NotificationProvider' ;
7- import useStack from './legacy/hooks/useStack' ;
87import Notification , {
98 type NotificationClassNames ,
109 type NotificationProps ,
1110 type NotificationStyles ,
1211} from './Notification' ;
1312import useListPosition from './hooks/useListPosition' ;
1413import useListScroll from './hooks/useListScroll' ;
14+ import useStack from './hooks/useStack' ;
1515
1616export type Placement = 'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight' ;
1717export type { StackConfig } from './interface' ;
Original file line number Diff line number Diff line change 1+ import type { StackConfig } from '../interface' ;
2+
3+ const DEFAULT_OFFSET = 8 ;
4+ const DEFAULT_THRESHOLD = 3 ;
5+
6+ type StackParams = Required < StackConfig > ;
7+
8+ type UseStack = ( config ?: boolean | StackConfig ) => [ boolean , StackParams ] ;
9+
10+ const useStack : UseStack = ( config ) => {
11+ const result : StackParams = {
12+ offset : DEFAULT_OFFSET ,
13+ threshold : DEFAULT_THRESHOLD ,
14+ } ;
15+
16+ if ( config && typeof config === 'object' ) {
17+ result . offset = config . offset ?? DEFAULT_OFFSET ;
18+ result . threshold = config . threshold ?? DEFAULT_THRESHOLD ;
19+ }
20+
21+ return [ ! ! config , result ] ;
22+ } ;
23+
24+ export default useStack ;
You can’t perform that action at this time.
0 commit comments