/
item.tsx
44 lines (41 loc) · 1.13 KB
/
item.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import React from 'react';
import { classNames } from 'mo/common/className';
import { IStatusBarItem } from 'mo/model/workbench/statusBar';
import { IStatusBarController } from 'mo/controller/statusBar';
import { itemClassName } from './base';
import { getDataAttributionsFromProps } from 'mo/common/dom';
export function StatusItem(props: IStatusBarItem & IStatusBarController) {
const {
className,
onClick,
id,
name,
data,
render,
style,
role,
title,
...restProps
} = props;
const clsName = classNames(itemClassName, className);
const events = {
onClick: function (e: React.MouseEvent) {
onClick?.(e, props);
},
};
const attrProps = getDataAttributionsFromProps(restProps);
return (
<div
className={clsName}
style={style}
role={role}
title={title}
id={id.toString()}
{...attrProps}
>
<a tabIndex={-1} title={name} {...events}>
{render ? render(props) : name}
</a>
</div>
);
}