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

added default text to inspector module #6476

Merged
merged 1 commit into from Jun 6, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 24 additions & 9 deletions packages/inspector/src/inspector.ts
Expand Up @@ -17,6 +17,11 @@ const PANEL_CLASS = 'jp-Inspector';
*/
const CONTENT_CLASS = 'jp-Inspector-content';

/**
* The class name added to default inspector content.
*/
const DEFAULT_CONTENT_CLASS = 'jp-Inspector-default-content';

/**
* A panel which contains a set of inspectors.
*/
Expand All @@ -28,6 +33,7 @@ export class InspectorPanel extends Panel
constructor() {
super();
this.addClass(PANEL_CLASS);
(this.layout as PanelLayout).addWidget(this._content);
}

/**
Expand Down Expand Up @@ -92,17 +98,14 @@ export class InspectorPanel extends Panel
const { content } = args;

// Update the content of the inspector widget.
if (content === this._content) {
if (!content || content === this._content) {
return;
}
if (this._content) {
this._content.dispose();
}
this._content.dispose();

this._content = content;
if (content) {
content.addClass(CONTENT_CLASS);
(this.layout as PanelLayout).addWidget(content);
}
content.addClass(CONTENT_CLASS);
(this.layout as PanelLayout).addWidget(content);
}

/**
Expand All @@ -112,6 +115,18 @@ export class InspectorPanel extends Panel
this.source = null;
}

private _content: Widget | null = null;
private _content: Widget = Private.defaultContent();
private _source: IInspector.IInspectable | null = null;
}

namespace Private {
export function defaultContent() {
const defaultContent = new Widget();
defaultContent.node.innerHTML =
'<p>Click on a function to see documentation.</p>';
defaultContent.addClass(CONTENT_CLASS);
defaultContent.addClass(DEFAULT_CONTENT_CLASS);

return defaultContent;
}
}
8 changes: 8 additions & 0 deletions packages/inspector/style/index.css
Expand Up @@ -46,3 +46,11 @@
background-image: var(--jp-icon-inspector);
transform: scaleX(-1);
}

.jp-Inspector-default-content {
align-items: center;
justify-content: center;
font-size: xx-large;
font-style: italic;
color: darkgray;
}