-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed check mark icons in CommandPaletteSvg
- Loading branch information
1 parent
821537c
commit 83c39a6
Showing
8 changed files
with
89 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
|
||
import { h, VirtualElement } from '@lumino/virtualdom'; | ||
import { CommandPalette } from '@lumino/widgets'; | ||
|
||
import { checkIcon } from './iconimports'; | ||
import { iconStyle } from '../style'; | ||
import { classes } from '../utils'; | ||
|
||
// const submenuIcon = caretRightIcon.bindprops({ | ||
// justify: 'center', | ||
// kind: 'menuItem' | ||
// }); | ||
|
||
export namespace CommandPaletteSvg { | ||
/** | ||
* a modified implementation of the CommandPalette Renderer | ||
*/ | ||
export class Renderer extends CommandPalette.Renderer { | ||
/** | ||
* Render the icon for a command palette item. | ||
* | ||
* @param data - The data to use for rendering the icon. | ||
* | ||
* @returns A virtual element representing the icon. | ||
*/ | ||
renderItemIcon(data: CommandPalette.IItemRenderData): VirtualElement { | ||
let className = this.createIconClass(data); | ||
|
||
if (data.item.isToggled) { | ||
// check mark icon takes precedence | ||
return h.div({ className }, checkIcon, data.item.iconLabel); | ||
} | ||
|
||
/* <DEPRECATED> */ | ||
if (typeof data.item.icon === 'string') { | ||
return h.div({ className }, data.item.iconLabel); | ||
} | ||
/* </DEPRECATED> */ | ||
|
||
// if data.item.icon is undefined, it will be ignored | ||
return h.div({ className }, data.item.icon!, data.item.iconLabel); | ||
} | ||
|
||
/** | ||
* Create the class name for the command item icon. | ||
* | ||
* @param data - The data to use for the class name. | ||
* | ||
* @returns The full class name for the item icon. | ||
*/ | ||
createIconClass(data: CommandPalette.IItemRenderData): string { | ||
let name = 'lm-CommandPalette-itemIcon'; | ||
/* <DEPRECATED> */ | ||
name += ' p-CommandPalette-itemIcon'; | ||
/* </DEPRECATED> */ | ||
|
||
return classes( | ||
iconStyle({ justify: 'center', kind: 'commandPaletteItem' }), | ||
data.item.iconClass, | ||
name | ||
); | ||
} | ||
} | ||
|
||
export const defaultRenderer = new Renderer(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters