Skip to content

Commit 7875f19

Browse files
wewoormumiao
authored andcommitted
feat: export the shadowClassName of contextView
1 parent c7269e8 commit 7875f19

File tree

5 files changed

+82
-1
lines changed

5 files changed

+82
-1
lines changed

src/components/contextView/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ enum ContextViewEvent {
3737
const contextViewClass = prefixClaName('context-view');
3838
const contentClassName = getBEMElement(contextViewClass, 'content');
3939
const blockClassName = getBEMElement(contextViewClass, 'block');
40-
const shadowClassName = getBEMModifier(contextViewClass, 'shadow');
40+
export const shadowClassName = getBEMModifier(contextViewClass, 'shadow');
4141

4242
const Emitter = new EventEmitter();
4343

src/controller/notification.ts

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import * as React from 'react';
2+
import { IStatusBarItem, StatusBarEvent } from 'mo';
3+
import { Controller } from 'mo/react/controller';
4+
import { statusBarService } from 'mo/services';
5+
import { singleton } from 'tsyringe';
6+
7+
export interface INotificationController {
8+
onClick?: (e: React.MouseEvent, item: IStatusBarItem) => void;
9+
}
10+
11+
@singleton()
12+
export class NotificationController
13+
extends Controller
14+
implements INotificationController {
15+
constructor() {
16+
super();
17+
this.initStatusBar();
18+
}
19+
20+
public onClick = (e: React.MouseEvent, item: IStatusBarItem) => {
21+
this.emit(StatusBarEvent.onClick, e, item);
22+
};
23+
24+
public notify() {
25+
console.log('service:', statusBarService);
26+
}
27+
28+
private initStatusBar() {
29+
}
30+
}

src/model/notification.tsx

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { Icon } from 'mo/components/icon';
2+
import * as React from 'react';
3+
import { injectable } from 'tsyringe';
4+
import { IStatusBarItem } from './workbench/statusBar';
5+
6+
export type NotificationStatusType = 'message' | 'normal';
7+
8+
export interface INotification<T = any> extends IStatusBarItem {
9+
data: T[];
10+
status: NotificationStatusType;
11+
}
12+
13+
@injectable()
14+
export class NotificationModel<T> implements INotification<T> {
15+
16+
static readonly ID = 'MO_NOTIFICATION';
17+
static readonly NAME = 'Notification';
18+
19+
public id: string;
20+
public name: string;
21+
public data: T[];
22+
public sortIndex: number;
23+
public render: () => ReactNode;
24+
public status: NotificationStatusType;
25+
26+
constructor(
27+
id: string = NotificationModel.ID,
28+
name: string = NotificationModel.NAME,
29+
data: T[] = [],
30+
sortIndex: number = 1,
31+
render: () => ReactNode = () => <Icon type="bell" />,
32+
status: NotificationStatusType = 'normal'
33+
) {
34+
this.id = id;
35+
this.name = name;
36+
this.sortIndex = sortIndex;
37+
this.render = render;
38+
this.status = status;
39+
this.data = data;
40+
}
41+
}

src/workbench/statusBar/notification/index.tsx

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import * as React from "react";
2+
import { Icon } from "mo/components/icon";
3+
import { INotification } from "mo/model/notification";
4+
import { INotificationController } from "mo/controller/notification";
5+
6+
export function Notification(props: INotification & INotificationController) {
7+
return (
8+
<Icon type="bell" />
9+
)
10+
}

0 commit comments

Comments
 (0)