UNPKG

@voila-dashboards/jupyterlab-gridstack

Version:

A gridstack-based template for [![voila-gridstack](assets/voila.png)](https://github.com/voila-dashboards/voila).

23 lines (22 loc) 878 B
import { ReactWidget, ToolbarButtonComponent } from '@jupyterlab/apputils'; import { launcherIcon } from '@jupyterlab/ui-components'; import { PageConfig } from '@jupyterlab/coreutils'; import * as React from 'react'; /** * A toolbar widget to launch Voila. */ export default class Voila extends ReactWidget { constructor(path) { super(); this._path = path; } render() { const onClick = () => { const baseUrl = PageConfig.getBaseUrl(); const conf = '?template=gridstack'; const win = window.open(`${baseUrl}voila/render/${this._path + conf}`, '_blank'); win === null || win === void 0 ? void 0 : win.focus(); }; return (React.createElement(ToolbarButtonComponent, { icon: launcherIcon, onClick: onClick, tooltip: 'Open with Voilà Gridstack in a New Browser Tab' })); } }