Remove placeholder in keymap-tab

This commit is contained in:
Farkas József
2016-11-20 21:58:07 +01:00
committed by József Farkas
parent 34eb09ee9c
commit 064d2eb29a
3 changed files with 28 additions and 25 deletions
@@ -1,4 +1,8 @@
<div> <template [ngIf]="keymapOptions.length === 0">
<span> No keymaps are available to choose from. Create a keymap first! </span>
</template>
<template [ngIf]="keymapOptions.length > 0">
<div>
<b>Switch to keymap:</b> <b>Switch to keymap:</b>
<select2 <select2
[data]="keymapOptions" [data]="keymapOptions"
@@ -6,12 +10,13 @@
(valueChanged)="onChange($event)" (valueChanged)="onChange($event)"
[width]="'100%'" [width]="'100%'"
></select2> ></select2>
</div> </div>
<div> <div>
<div class="empty" *ngIf="!selectedKeymap?.abbreviation"> <div class="empty" *ngIf="!selectedKeymap?.abbreviation">
<img src="./images/base-layer--blank.svg"> <img src="./images/base-layer--blank.svg">
</div> </div>
<svg-keyboard *ngIf="selectedKeymap?.abbreviation" <svg-keyboard *ngIf="selectedKeymap?.abbreviation"
[moduleConfig]="selectedKeymap.layers[0].modules"> [moduleConfig]="selectedKeymap.layers[0].modules">
</svg-keyboard> </svg-keyboard>
</div> </div>
</template>
@@ -2,6 +2,10 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
> span {
text-align: center;
}
> div { > div {
display: flex; display: flex;
margin-top: 2px; margin-top: 2px;
@@ -31,15 +31,9 @@ export class KeymapTabComponent implements OnInit, Tab {
text: keymap.name text: keymap.name
}; };
}); });
if (this.keymaps.length > 0) {
this.keymapOptions = [ this.selectedKeymap = this.keymaps[0];
{ }
id: '-1',
text: 'Switch to keymap'
},
...this.keymapOptions
];
this.fromKeyAction(this.defaultKeyAction); this.fromKeyAction(this.defaultKeyAction);
} }