Skip to content

Commit 2b539d5

Browse files
committed
feat: add Notification and NotificationList components
1 parent 2ea149b commit 2b539d5

2 files changed

Lines changed: 59 additions & 0 deletions

File tree

src/Notification.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import * as React from 'react';
2+
3+
export interface NotificationProps {
4+
children?: React.ReactNode;
5+
icon?: React.ReactNode;
6+
title?: React.ReactNode;
7+
content?: React.ReactNode;
8+
actions?: React.ReactNode;
9+
close?: React.ReactNode;
10+
}
11+
12+
const Notification = React.forwardRef<HTMLDivElement, NotificationProps>((props, ref) => {
13+
const { children, icon, title, content, actions, close, ...restProps } = props;
14+
return (
15+
<div ref={ref} {...restProps}>
16+
{icon && <div className="icon">{icon}</div>}
17+
{title && <div className="title">{title}</div>}
18+
{close && (
19+
<button className="close" aria-label="Close">
20+
{close}
21+
</button>
22+
)}
23+
{content && <div className="content">{content}</div>}
24+
{actions && <div className="actions">{actions}</div>}
25+
</div>
26+
);
27+
});
28+
29+
Notification.displayName = 'Notification';
30+
31+
export default Notification;

src/NotificationList.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import type { CSSMotionProps } from '@rc-component/motion';
2+
import * as React from 'react';
3+
4+
export type Placement = 'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight';
5+
6+
export type StackConfig =
7+
| boolean
8+
| {
9+
threshold?: number;
10+
offset?: number;
11+
gap?: number;
12+
};
13+
14+
export interface NotificationListProps {
15+
prefixCls?: string;
16+
getContainer?: () => HTMLElement | ShadowRoot;
17+
placement?: Placement;
18+
pauseOnHover?: boolean;
19+
stack?: StackConfig;
20+
maxCount?: number;
21+
motion?: CSSMotionProps | ((placement: Placement) => CSSMotionProps);
22+
}
23+
24+
const NotificationList: React.FC<NotificationListProps> = () => {
25+
return null;
26+
};
27+
28+
export default NotificationList;

0 commit comments

Comments
 (0)