Remove placeholder in keymap-tab

This commit is contained in:
Farkas József
2016-11-20 21:04:39 +01:00
committed by József Farkas
parent 34eb09ee9c
commit 064d2eb29a
3 changed files with 28 additions and 25 deletions

View File

@@ -1,17 +1,22 @@
<div> <template [ngIf]="keymapOptions.length === 0">
<b>Switch to keymap:</b> <span> No keymaps are available to choose from. Create a keymap first! </span>
<select2 </template>
[data]="keymapOptions" <template [ngIf]="keymapOptions.length > 0">
[value]="selectedKeymap?.abbreviation || -1" <div>
(valueChanged)="onChange($event)" <b>Switch to keymap:</b>
[width]="'100%'" <select2
></select2> [data]="keymapOptions"
</div> [value]="selectedKeymap?.abbreviation || -1"
<div> (valueChanged)="onChange($event)"
<div class="empty" *ngIf="!selectedKeymap?.abbreviation"> [width]="'100%'"
<img src="./images/base-layer--blank.svg"> ></select2>
</div> </div>
<svg-keyboard *ngIf="selectedKeymap?.abbreviation" <div>
[moduleConfig]="selectedKeymap.layers[0].modules"> <div class="empty" *ngIf="!selectedKeymap?.abbreviation">
</svg-keyboard> <img src="./images/base-layer--blank.svg">
</div> </div>
<svg-keyboard *ngIf="selectedKeymap?.abbreviation"
[moduleConfig]="selectedKeymap.layers[0].modules">
</svg-keyboard>
</div>
</template>

View File

@@ -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;

View File

@@ -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);
} }