/* * Copyright (c) Jupyter Development Team. * Distributed under the terms of the Modified BSD License. */ import { ITranslator } from '@jupyterlab/translation'; import { FilterBox } from '@jupyterlab/ui-components'; import * as React from 'react'; import { ShortcutTitleItem } from './ShortcutTitleItem'; import { IShortcutUI } from '../types'; export interface IAdvancedOptionsProps { toggleSelectors: IShortcutUI['toggleSelectors']; showSelectors: boolean; resetShortcuts: IShortcutUI['resetShortcuts']; translator: ITranslator; } export interface ISymbolsProps {} function Symbols(props: ISymbolsProps): JSX.Element { return (
Cmd ⌘ Ctrl ⌃
Alt ⌥ Shift ⇧
); } function AdvancedOptions(props: IAdvancedOptionsProps): JSX.Element { const trans = props.translator.load('jupyterlab'); return (
props.toggleSelectors()} > {props.showSelectors ? trans.__('Hide Selectors') : trans.__('Show Selectors')} props.resetShortcuts()} > {trans.__('Reset All')}
); } /** State for TopNav component */ export interface ITopNavProps { resetShortcuts: IShortcutUI['resetShortcuts']; updateSearchQuery: IShortcutUI['updateSearchQuery']; toggleSelectors: IShortcutUI['toggleSelectors']; showSelectors: boolean; updateSort: IShortcutUI['updateSort']; currentSort: string; width: number; translator: ITranslator; } /** React component for top navigation */ export class TopNav extends React.Component { constructor(props: ITopNavProps) { super(props); } getShortCutTitleItem(title: string, columnId: IShortcutUI.ColumnId) { return (
); } render() { const trans = this.props.translator.load('jupyterlab'); return (
this.props.updateSearchQuery(query ?? '') } placeholder={trans.__('Search…')} useFuzzyFilter={false} />
{this.getShortCutTitleItem(trans.__('Category'), 'category')} {this.getShortCutTitleItem(trans.__('Command'), 'command')}
{trans.__('Shortcut')}
{this.getShortCutTitleItem(trans.__('Source'), 'source')} {this.props.showSelectors && this.getShortCutTitleItem(trans.__('Selectors'), 'selector')}
); } }