|
@@ -482,27 +482,18 @@ export function ToolbarButtonComponent(props: ToolbarButtonComponent.IProps) {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- return (
|
|
|
- <Button
|
|
|
- className={
|
|
|
- props.className
|
|
|
- ? props.className + ' jp-ToolbarButtonComponent'
|
|
|
- : 'jp-ToolbarButtonComponent'
|
|
|
- }
|
|
|
- disabled={props.enabled === false}
|
|
|
- onMouseDown={handleMouseDown}
|
|
|
- onKeyDown={handleKeyDown}
|
|
|
- title={props.tooltip || props.iconLabel}
|
|
|
- minimal
|
|
|
- >
|
|
|
- {props.iconRenderer ? (
|
|
|
+ const Icon = () => {
|
|
|
+ if (props.iconRenderer) {
|
|
|
+ return (
|
|
|
<props.iconRenderer.react
|
|
|
className={classes(props.iconClass, 'jp-ToolbarButtonComponent-icon')}
|
|
|
tag="span"
|
|
|
justify="center"
|
|
|
kind="toolbarButton"
|
|
|
/>
|
|
|
- ) : (
|
|
|
+ );
|
|
|
+ } else if (props.iconClass) {
|
|
|
+ return (
|
|
|
<JLIcon.getReact
|
|
|
name={classes(props.iconClass, 'jp-Icon', 'jp-Icon-16')}
|
|
|
className="jp-ToolbarButtonComponent-icon"
|
|
@@ -510,7 +501,26 @@ export function ToolbarButtonComponent(props: ToolbarButtonComponent.IProps) {
|
|
|
justify="center"
|
|
|
kind="toolbarButton"
|
|
|
/>
|
|
|
- )}
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ return <></>;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ return (
|
|
|
+ <Button
|
|
|
+ className={
|
|
|
+ props.className
|
|
|
+ ? props.className + ' jp-ToolbarButtonComponent'
|
|
|
+ : 'jp-ToolbarButtonComponent'
|
|
|
+ }
|
|
|
+ disabled={props.enabled === false}
|
|
|
+ onMouseDown={handleMouseDown}
|
|
|
+ onKeyDown={handleKeyDown}
|
|
|
+ title={props.tooltip || props.iconLabel}
|
|
|
+ minimal
|
|
|
+ >
|
|
|
+ <Icon />
|
|
|
{props.label && (
|
|
|
<span className="jp-ToolbarButtonComponent-label">{props.label}</span>
|
|
|
)}
|