Skip to content

Commit

Permalink
fixed override method
Browse files Browse the repository at this point in the history
  • Loading branch information
telamonian committed Jun 4, 2019
1 parent 80b24ec commit e6f5f2d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
2 changes: 2 additions & 0 deletions packages/application/package.json
Expand Up @@ -38,6 +38,7 @@
"@jupyterlab/rendermime": "^1.0.0-alpha.6",
"@jupyterlab/rendermime-interfaces": "^1.3.0-alpha.6",
"@jupyterlab/services": "^4.0.0-alpha.6",
"@jupyterlab/ui-components": "^1.0.0-alpha.6",
"@phosphor/algorithm": "^1.1.2",
"@phosphor/application": "^1.6.0",
"@phosphor/commands": "^1.6.1",
Expand All @@ -46,6 +47,7 @@
"@phosphor/messaging": "^1.2.2",
"@phosphor/properties": "^1.1.2",
"@phosphor/signaling": "^1.2.2",
"@phosphor/virtualdom": "^1.1.2",
"@phosphor/widgets": "^1.6.0",
"font-awesome": "~4.7.0"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/application/tsconfig.json
Expand Up @@ -23,6 +23,9 @@
},
{
"path": "../services"
},
{
"path": "../ui-components"
}
]
}
19 changes: 7 additions & 12 deletions packages/filebrowser/src/listing.ts
Expand Up @@ -1756,18 +1756,13 @@ export namespace DirListing {
kind: 'listing'
});

// filthy hack to get the tab icons
for (let iconNode of document.getElementsByClassName(
['p-TabBar-tabIcon', fileType.iconClass].join(' ')
) as HTMLCollectionOf<HTMLElement>) {
defaultIconRegistry.icon({
name: fileType.iconName,
title: fileType.iconLabel,
container: iconNode,
center: true,
kind: 'tab'
});
}
// filthy hack to get the topbar tab icons
defaultIconRegistry.override({
name: fileType.iconName,
className: ['p-TabBar-tabIcon', fileType.iconClass].join(' '),
center: true,
kind: 'tab'
});
} else {
// add icon as CSS background image. Can't be styled using CSS
icon.textContent = fileType.iconLabel || '';
Expand Down
9 changes: 6 additions & 3 deletions packages/ui-components/src/icon/icon.tsx
Expand Up @@ -129,14 +129,17 @@ export class IconRegistry {
);
}

override(props: { name: string; className: string } & IIconStyle) {
const { name, className, ...propsStyle } = props;
override(
props: { name: string; className: string; title?: string } & IIconStyle
) {
const { name, className, title, ...propsStyle } = props;

for (let container of document.getElementsByClassName(
className
) as HTMLCollectionOf<HTMLElement>) {
defaultIconRegistry.icon({
this.icon({
name: name,
title: title,
container: container,
...propsStyle
});
Expand Down

0 comments on commit e6f5f2d

Please sign in to comment.