Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove the warning in console #529

Merged
merged 2 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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