mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-25 13:59:52 +00:00
fixed SVG icons in tab headers - fixes #5926
This commit is contained in:
parent
d4fb56b30b
commit
90becada86
9
tabby-core/src/components/profileIcon.component.pug
Normal file
9
tabby-core/src/components/profileIcon.component.pug
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
i.icon(
|
||||||
|
class='fa-fw {{icon}}',
|
||||||
|
[style.color]='color',
|
||||||
|
*ngIf='!isHTML'
|
||||||
|
)
|
||||||
|
.icon(
|
||||||
|
[fastHtmlBind]='icon',
|
||||||
|
*ngIf='isHTML'
|
||||||
|
)
|
10
tabby-core/src/components/profileIcon.component.scss
Normal file
10
tabby-core/src/components/profileIcon.component.scss
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
:host {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
max-width: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep img {
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
18
tabby-core/src/components/profileIcon.component.ts
Normal file
18
tabby-core/src/components/profileIcon.component.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
import { Component, Input } from '@angular/core'
|
||||||
|
import { BaseComponent } from './base.component'
|
||||||
|
|
||||||
|
/** @hidden */
|
||||||
|
@Component({
|
||||||
|
selector: 'profile-icon',
|
||||||
|
template: require('./profileIcon.component.pug'),
|
||||||
|
styles: [require('./profileIcon.component.scss')],
|
||||||
|
})
|
||||||
|
export class ProfileIconComponent extends BaseComponent {
|
||||||
|
@Input() icon?: string
|
||||||
|
@Input() color?: string
|
||||||
|
|
||||||
|
get isHTML (): boolean {
|
||||||
|
return this.icon?.startsWith('<') ?? false
|
||||||
|
}
|
||||||
|
}
|
@ -17,15 +17,9 @@
|
|||||||
(click)='selectOption(option)',
|
(click)='selectOption(option)',
|
||||||
[class.active]='selectedIndex == i'
|
[class.active]='selectedIndex == i'
|
||||||
)
|
)
|
||||||
i.icon(
|
profile-icon(
|
||||||
class='fa-fw {{option.icon}}',
|
[icon]='option.icon',
|
||||||
style='color: {{option.color}}',
|
[color]='option.color'
|
||||||
*ngIf='!iconIsSVG(option.icon)'
|
|
||||||
)
|
|
||||||
.icon(
|
|
||||||
[fastHtmlBind]='option.icon',
|
|
||||||
style='color: {{option.color}}',
|
|
||||||
*ngIf='iconIsSVG(option.icon)'
|
|
||||||
)
|
)
|
||||||
.title.mr-2 {{getOptionText(option)}}
|
.title.mr-2 {{getOptionText(option)}}
|
||||||
.description.no-wrap.text-muted {{option.description}}
|
.description.no-wrap.text-muted {{option.description}}
|
||||||
|
@ -84,8 +84,4 @@ export class SelectorModalComponent<T> {
|
|||||||
close (): void {
|
close (): void {
|
||||||
this.modalInstance.dismiss()
|
this.modalInstance.dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
iconIsSVG (icon?: string): boolean {
|
|
||||||
return icon?.startsWith('<') ?? false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
.index(*ngIf='!config.store.terminal.hideTabIndex && hostApp.platform === Platform.macOS', cdkDragHandle) {{index + 1}}
|
.index(*ngIf='!config.store.terminal.hideTabIndex && hostApp.platform === Platform.macOS', cdkDragHandle) {{index + 1}}
|
||||||
.index(*ngIf='!config.store.terminal.hideTabIndex && hostApp.platform !== Platform.macOS') {{index + 1}}
|
.index(*ngIf='!config.store.terminal.hideTabIndex && hostApp.platform !== Platform.macOS') {{index + 1}}
|
||||||
|
|
||||||
.icon(
|
profile-icon(
|
||||||
*ngIf='config.store.terminal.showTabProfileIcon && tab.icon',
|
*ngIf='config.store.terminal.showTabProfileIcon && tab.icon',
|
||||||
[ngClass]='tab.icon',
|
[icon]='tab.icon',
|
||||||
[style.color]='tab.color'
|
[color]='tab.color'
|
||||||
)
|
)
|
||||||
|
|
||||||
.name(
|
.name(
|
||||||
|
@ -26,8 +26,7 @@ $tabs-height: 38px;
|
|||||||
height: $tabs-height;
|
height: $tabs-height;
|
||||||
}
|
}
|
||||||
|
|
||||||
.index,
|
.index {
|
||||||
.icon {
|
|
||||||
flex: none;
|
flex: none;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
-webkit-app-region: no-drag;
|
-webkit-app-region: no-drag;
|
||||||
@ -41,7 +40,7 @@ $tabs-height: 38px;
|
|||||||
margin-top: 1px;
|
margin-top: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
profile-icon {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
margin: 1px 4px 0 0;
|
margin: 1px 4px 0 0;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import { SplitTabPaneLabelComponent } from './components/splitTabPaneLabel.compo
|
|||||||
import { UnlockVaultModalComponent } from './components/unlockVaultModal.component'
|
import { UnlockVaultModalComponent } from './components/unlockVaultModal.component'
|
||||||
import { WelcomeTabComponent } from './components/welcomeTab.component'
|
import { WelcomeTabComponent } from './components/welcomeTab.component'
|
||||||
import { TransfersMenuComponent } from './components/transfersMenu.component'
|
import { TransfersMenuComponent } from './components/transfersMenu.component'
|
||||||
|
import { ProfileIconComponent } from './components/profileIcon.component'
|
||||||
|
|
||||||
import { AutofocusDirective } from './directives/autofocus.directive'
|
import { AutofocusDirective } from './directives/autofocus.directive'
|
||||||
import { AlwaysVisibleTypeaheadDirective } from './directives/alwaysVisibleTypeahead.directive'
|
import { AlwaysVisibleTypeaheadDirective } from './directives/alwaysVisibleTypeahead.directive'
|
||||||
@ -128,6 +129,7 @@ const PROVIDERS = [
|
|||||||
TransfersMenuComponent,
|
TransfersMenuComponent,
|
||||||
DropZoneDirective,
|
DropZoneDirective,
|
||||||
CdkAutoDropGroup,
|
CdkAutoDropGroup,
|
||||||
|
ProfileIconComponent,
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
PromptModalComponent,
|
PromptModalComponent,
|
||||||
@ -150,6 +152,7 @@ const PROVIDERS = [
|
|||||||
DragDropModule,
|
DragDropModule,
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
CdkAutoDropGroup,
|
CdkAutoDropGroup,
|
||||||
|
ProfileIconComponent,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export default class AppModule { // eslint-disable-line @typescript-eslint/no-extraneous-class
|
export default class AppModule { // eslint-disable-line @typescript-eslint/no-extraneous-class
|
||||||
|
@ -40,7 +40,10 @@
|
|||||||
)
|
)
|
||||||
.input-group-append
|
.input-group-append
|
||||||
.input-group-text
|
.input-group-text
|
||||||
i([class]='"fa-fw " + profile.icon')
|
profile-icon(
|
||||||
|
[icon]='profile.icon',
|
||||||
|
[color]='profile.color'
|
||||||
|
)
|
||||||
|
|
||||||
ng-template(#rt,let-r='result',let-t='term')
|
ng-template(#rt,let-r='result',let-t='term')
|
||||||
i([class]='"fa-fw " + r')
|
i([class]='"fa-fw " + r')
|
||||||
|
@ -58,14 +58,9 @@ ul.nav-tabs(ngbNav, #nav='ngbNav')
|
|||||||
[class.list-group-item-action]='!profile.isBuiltin',
|
[class.list-group-item-action]='!profile.isBuiltin',
|
||||||
(click)='profile.isBuiltin ? null : editProfile(profile)'
|
(click)='profile.isBuiltin ? null : editProfile(profile)'
|
||||||
)
|
)
|
||||||
i.icon(
|
profile-icon(
|
||||||
class='fa-fw {{profile.icon}}',
|
[icon]='profile.icon',
|
||||||
[style.color]='profile.color',
|
[color]='profile.color'
|
||||||
*ngIf='!iconIsSVG(profile.icon)'
|
|
||||||
)
|
|
||||||
.icon(
|
|
||||||
[fastHtmlBind]='profile.icon',
|
|
||||||
*ngIf='iconIsSVG(profile.icon)'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
.no-wrap {{profile.name}}
|
.no-wrap {{profile.name}}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
.icon {
|
profile-icon {
|
||||||
width: 1.25rem;
|
width: 1.25rem;
|
||||||
margin-right: 0.25rem;
|
margin-right: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon + * {
|
profile-icon + * {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
@ -225,10 +225,6 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
|
|||||||
return !this.filter || (profile.name + '$' + (this.getDescription(profile) ?? '')).toLowerCase().includes(this.filter.toLowerCase())
|
return !this.filter || (profile.name + '$' + (this.getDescription(profile) ?? '')).toLowerCase().includes(this.filter.toLowerCase())
|
||||||
}
|
}
|
||||||
|
|
||||||
iconIsSVG (icon?: string): boolean {
|
|
||||||
return icon?.startsWith('<') ?? false
|
|
||||||
}
|
|
||||||
|
|
||||||
getDescription (profile: PartialProfile<Profile>): string|null {
|
getDescription (profile: PartialProfile<Profile>): string|null {
|
||||||
return this.profilesService.getDescription(profile)
|
return this.profilesService.getDescription(profile)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user