Skip to content

Commit cc41ac7

Browse files
committed
support list semantic styles
1 parent 2384559 commit cc41ac7

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/NotificationList/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ export interface NotificationListConfig extends Omit<NotificationProps, 'prefixC
2424
}
2525

2626
export interface NotificationClassNames extends NoticeClassNames {
27+
list?: string;
2728
listContent?: string;
2829
}
2930

3031
export interface NotificationStyles extends NoticeStyles {
32+
list?: React.CSSProperties;
3133
listContent?: React.CSSProperties;
3234
}
3335

@@ -239,6 +241,7 @@ const NotificationList: React.FC<NotificationListProps> = (props) => {
239241
`${prefixCls}-${placement}`,
240242
contextClassNames?.list,
241243
className,
244+
classNames?.list,
242245
{
243246
[`${prefixCls}-stack`]: stackEnabled,
244247
[`${prefixCls}-stack-expanded`]: expanded,
@@ -251,7 +254,7 @@ const NotificationList: React.FC<NotificationListProps> = (props) => {
251254
onMouseLeave={() => {
252255
setListHovering(false);
253256
}}
254-
style={style}
257+
style={{ ...styles?.list, ...style }}
255258
>
256259
<Content
257260
listPrefixCls={listPrefixCls}

tests/index.test.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,12 +844,16 @@ describe('Notification.Basic', () => {
844844
expect(document.querySelector('.bamboo-topRight')).toBeTruthy();
845845
});
846846

847-
it('should listContent styles and classNames work', () => {
847+
it('should list and listContent styles and classNames work', () => {
848848
const { instance } = renderDemo({
849849
classNames: {
850+
list: 'root-list',
850851
listContent: 'bamboo',
851852
},
852853
styles: {
854+
list: {
855+
content: 'root-list',
856+
},
853857
listContent: {
854858
content: 'little',
855859
},
@@ -860,6 +864,10 @@ describe('Notification.Basic', () => {
860864
instance.open({});
861865
});
862866

867+
expect(document.querySelector('.rc-notification-list')).toHaveStyle({
868+
content: 'root-list',
869+
});
870+
expect(document.querySelector('.rc-notification-list')).toHaveClass('root-list');
863871
expect(document.querySelector('.rc-notification-list-content')).toHaveStyle({
864872
content: 'little',
865873
});

0 commit comments

Comments
 (0)