Skip to content

Commit

Permalink
Merge pull request #6476 from ibdafna/inspector-description
Browse files Browse the repository at this point in the history
added default text to inspector module
  • Loading branch information
jasongrout committed Jun 6, 2019
2 parents ebadf8e + 2ddc59c commit eedff54
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
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;
}

0 comments on commit eedff54

Please sign in to comment.