Skip to content

Commit

Permalink
Update styling for JupyterLab 4 (#262)
Browse files Browse the repository at this point in the history
* Update styling for JupyterLab 4

New in jl4, sidebar expects a LabIcon class to setup icon.
Else it will use a default icon.

* Remove top-of-the-file license
  • Loading branch information
mahendrapaipuri authored Jun 14, 2023
1 parent 99c4d2a commit 46ad958
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {

import { CodeEditor } from '@jupyterlab/codeeditor';

import { LabIcon } from '@jupyterlab/ui-components';

import { ConsolePanel, IConsoleTracker } from '@jupyterlab/console';

import { DocumentRegistry } from '@jupyterlab/docregistry';
Expand Down Expand Up @@ -44,6 +46,13 @@ import { DaskSidebar } from './sidebar';

import '../style/index.css';

import DaskSvgStr from '../style/dask.svg';

export const DaskIcon = new LabIcon({
name: 'dask:icon',
svgstr: DaskSvgStr
});

namespace CommandIDs {
/**
* Launch a dask dashboard panel in an iframe.
Expand Down Expand Up @@ -175,7 +184,8 @@ async function activate(
launchClusterId: CommandIDs.launchCluster
});
sidebar.id = id;
sidebar.title.iconClass = 'dask-DaskLogo jp-SideBar-tabIcon';
sidebar.title.icon = DaskIcon;
sidebar.title.iconClass = 'jp-SideBar-tabIcon';
sidebar.title.caption = 'Dask';

// An instance tracker which is used for state restoration.
Expand Down Expand Up @@ -431,7 +441,7 @@ async function activate(
dashboard.active = active;
dashboard.id = `dask-dashboard-${Private.id++}`;
dashboard.title.label = `${dashboardItem.label}`;
dashboard.title.icon = 'dask-DaskLogo';
dashboard.title.icon = DaskIcon;

labShell.add(dashboard, 'main', addOptions);
void tracker.add(dashboard); // no need to wait on this
Expand Down
4 changes: 4 additions & 0 deletions src/svg.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svg' {
const image: string;
export default image;
}

0 comments on commit 46ad958

Please # to comment.