Skip to content

Commit

Permalink
fix: remove the warning in console (#529)
Browse files Browse the repository at this point in the history
* fix: remove the warning in console

* test: update snapshots
  • Loading branch information
mortalYoung authored Dec 2, 2021
1 parent 486182b commit 059016c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 23 deletions.
19 changes: 1 addition & 18 deletions src/provider/__tests__/__snapshots__/molecule.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ exports[`Test MoleculeProvider Match The MoleculeProvider snapshot 1`] = `
data-type="SplitPane"
>
<div
className={false}
className=""
style={
Object {
"WebkitBoxFlex": 0,
Expand Down Expand Up @@ -672,7 +672,6 @@ exports[`Test MoleculeProvider Match The MoleculeProvider snapshot 1`] = `
<div
className="mo-statusBar__item"
id="statusbar.problems.title"
sortIndex={1}
>
<a
onClick={[Function]}
Expand All @@ -698,23 +697,8 @@ exports[`Test MoleculeProvider Match The MoleculeProvider snapshot 1`] = `
className="mo-statusBar__right-items"
>
<div
actionBar={
Array [
Object {
"icon": "clear-all",
"id": "ClearAll",
"title": "Clear All Notifications",
},
Object {
"icon": "chevron-down",
"id": "HideNotifications",
"title": "Hide Notifications",
},
]
}
className="mo-statusBar__item"
id="MO_NOTIFICATION"
sortIndex={1}
>
<a
onClick={[Function]}
Expand Down Expand Up @@ -779,7 +763,6 @@ exports[`Test MoleculeProvider Match The MoleculeProvider snapshot 1`] = `
<div
className="mo-statusBar__item"
id="MoEditorInfo"
sortIndex={2}
>
<a
onClick={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ exports[`Test Workbench Component Match The WorkbenchView snapshot 1`] = `
data-type="SplitPane"
>
<div
class=""
style="display: -webkit-box,-moz-box,-ms-flexbox,-webkit-flex,flex; outline: none; min-width: 170px; max-width: calc(80% - 1px*0.8); flex-grow: 0; width: 300px;"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ exports[`The StatusBar Component Match Snapshot 1`] = `
<div
className="mo-statusBar__item"
id="MoEditorInfo"
sortIndex={2}
>
<a
onClick={[Function]}
Expand All @@ -28,7 +27,6 @@ exports[`The StatusBar Component Match Snapshot 1`] = `
<div
className="mo-statusBar__item"
id="MoEditorInfo"
sortIndex={2}
>
<a
onClick={[Function]}
Expand Down
25 changes: 23 additions & 2 deletions src/workbench/statusBar/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,39 @@ 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, ...extra } = props;
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} id={id.toString()} {...extra}>
<div
className={clsName}
style={style}
role={role}
title={title}
id={id.toString()}
{...attrProps}
>
<a tabIndex={-1} title={name} {...events}>
{render ? render(props) : name}
</a>
Expand Down
2 changes: 1 addition & 1 deletion src/workbench/workbench.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function WorkbenchView(props: IWorkbench & ILayout & ILayoutController) {
minSize="170px"
initialSize={splitPanePos[0]}
maxSize="80%"
className={sidebar.hidden && 'hidden'}
className={sidebar.hidden ? 'hidden' : ''}
>
<SidebarView />
</Pane>
Expand Down

0 comments on commit 059016c

Please sign in to comment.