Pārlūkot izejas kodu

tabs.css: Unify Landscape and portrait TabIcon

The TabIcon had 2 different styles for Landscape and Portrait. Unify
them into a single one. The earlier style was not vertical aligned
correctly and the current unified style handles this properly.
AbdealiJK 8 gadi atpakaļ
vecāks
revīzija
8625bda1a8

+ 9 - 2
src/application/tabs.css

@@ -143,10 +143,17 @@
 }
 
 
-.p-DockPanel-tabBar .p-TabBar-tabIcon {
+.p-DockPanel-tabBar .p-TabBar-tab .p-TabBar-tabIcon {
   width: 14px;
-  margin-top: 2px;
+  background-position: left center;
+  background-repeat: no-repeat;
+  margin-right: 2px;
+}
+
+.p-DockPanel-tabBar .p-TabBar-tab.p-mod-current .p-TabBar-tabIcon {
+  margin-bottom: var(--jp-border-width);
 }
+
 .p-TabBar-WindowTabLabel {
   margin-top: 4px;
 }

+ 1 - 6
src/console/plugin.ts

@@ -107,11 +107,6 @@ const plugins: JupyterLabPlugin<any>[] = [contentFactoryPlugin, trackerPlugin];
 export default plugins;
 
 
-/**
- * The class name for all main area landscape tab icons.
- */
-const LANDSCAPE_ICON_CLASS = 'jp-MainAreaLandscapeIcon';
-
 /**
  * The class name for the console icon from the default theme.
  */
@@ -401,7 +396,7 @@ function activateConsole(app: JupyterLab, services: IServiceManager, rendermime:
     panel.id = panel.id || `console-${++id}`;
     panel.title.label = name;
     panel.title.caption = Private.caption(captionOptions);
-    panel.title.icon = `${LANDSCAPE_ICON_CLASS} ${CONSOLE_ICON_CLASS}`;
+    panel.title.icon = CONSOLE_ICON_CLASS;
     panel.title.closable = true;
     // Update the caption of the tab with the last execution time.
     panel.console.executed.connect((sender, executed) => {

+ 1 - 6
src/editorwidget/plugin.ts

@@ -26,11 +26,6 @@ import {
 } from './';
 
 
-/**
- * The class name for all main area portrait tab icons.
- */
-const PORTRAIT_ICON_CLASS = 'jp-MainAreaPortraitIcon';
-
 /**
  * The class name for the text editor icon from the default theme.
  */
@@ -85,7 +80,7 @@ function activate(app: JupyterLab, registry: IDocumentRegistry, restorer: IInsta
   });
 
   factory.widgetCreated.connect((sender, widget) => {
-    widget.title.icon = `${PORTRAIT_ICON_CLASS} ${EDITOR_ICON_CLASS}`;
+    widget.title.icon = EDITOR_ICON_CLASS;
     // Notify the instance tracker if restore data needs to update.
     widget.context.pathChanged.connect(() => { tracker.save(widget); });
     tracker.add(widget);

+ 1 - 7
src/markdownwidget/plugin.ts

@@ -26,11 +26,6 @@ import {
 } from './widget';
 
 
-/**
- * The class name for all main area portrait tab icons.
- */
-const PORTRAIT_ICON_CLASS = 'jp-MainAreaPortraitIcon';
-
 /**
  * The class name for the text editor icon from the default theme.
  */
@@ -65,7 +60,6 @@ function activate(app: JupyterLab, registry: IDocumentRegistry, rendermime: IRen
     const shell = app.shell;
     const namespace = 'rendered-markdown';
     const tracker = new InstanceTracker<MarkdownWidget>({ namespace, shell });
-    let icon = `${PORTRAIT_ICON_CLASS} ${TEXTEDITOR_ICON_CLASS}`;
 
     // Handle state restoration.
     restorer.restore(tracker, {
@@ -75,7 +69,7 @@ function activate(app: JupyterLab, registry: IDocumentRegistry, rendermime: IRen
     });
 
     factory.widgetCreated.connect((sender, widget) => {
-      widget.title.icon = icon;
+      widget.title.icon = TEXTEDITOR_ICON_CLASS;
       // Notify the instance tracker if restore data needs to update.
       widget.context.pathChanged.connect(() => { tracker.save(widget); });
       tracker.add(widget);

+ 1 - 6
src/notebook/plugin.ts

@@ -56,11 +56,6 @@ import {
 } from './';
 
 
-/**
- * The class name for all main area portrait tab icons.
- */
-const PORTRAIT_ICON_CLASS = 'jp-MainAreaPortraitIcon';
-
 /**
  * The class name for the notebook icon from the default theme.
  */
@@ -208,7 +203,7 @@ function activateNotebookHandler(app: JupyterLab, registry: IDocumentRegistry, s
   factory.widgetCreated.connect((sender, widget) => {
     // If the notebook panel does not have an ID, assign it one.
     widget.id = widget.id || `notebook-${++id}`;
-    widget.title.icon = `${PORTRAIT_ICON_CLASS} ${NOTEBOOK_ICON_CLASS}`;
+    widget.title.icon = NOTEBOOK_ICON_CLASS;
     // Notify the instance tracker if restore data needs to update.
     widget.context.pathChanged.connect(() => { tracker.save(widget); });
     // Add the notebook panel to the tracker.

+ 1 - 6
src/terminal/plugin.ts

@@ -31,11 +31,6 @@ import {
 } from './';
 
 
-/**
- * The class name for all main area landscape tab icons.
- */
-const LANDSCAPE_ICON_CLASS = 'jp-MainAreaLandscapeIcon';
-
 /**
  * The class name for the terminal icon in the default theme.
  */
@@ -94,7 +89,7 @@ function activate(app: JupyterLab, services: IServiceManager, mainMenu: IMainMen
       let name = args ? args['name'] as string : '';
       let term = new TerminalWidget();
       term.title.closable = true;
-      term.title.icon = `${LANDSCAPE_ICON_CLASS} ${TERMINAL_ICON_CLASS}`;
+      term.title.icon = TERMINAL_ICON_CLASS;
       tracker.add(term);
       shell.addToMainArea(term);
       tracker.activate(term);