Skip to content

Commit

Permalink
feat: optimize in-line editable command action for horizontal space (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ert78gb authored Oct 21, 2023
1 parent 57b4b3f commit a4a4002
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,18 @@
</ng-container>

<div *ngIf="isCommand && !editing" class="macro-command-item">
<div>
<div>
<fa-icon *ngIf="movable"
[icon]="faGripLinesVertical"
class="action--movable"
aria-hidden="true"></fa-icon>
<span class="pr-1">Command:</span>
</div>
<button class="btn btn-primary btn-sm btn-change-macro-action"
*ngIf="editable"
(click)="editAction()"
>Change action
</button>
<div class="macro-command-item-header">
<fa-icon *ngIf="movable"
[icon]="faGripLinesVertical"
class="action--movable"
aria-hidden="true"></fa-icon>
<fa-icon [icon]="faCode"
aria-hidden="true"></fa-icon>

<span class="pr-1 mr-auto">Command:</span>

<icon *ngIf="editable" name="pencil" (click)="editAction()"></icon>
<icon *ngIf="deletable" name="trash" (click)="deleteAction()"></icon>
</div>
<div class="macro-command-editor-container">
<macro-command-editor [ngModel]="macroAction.command"
Expand All @@ -40,9 +39,9 @@
(gotFocus)="macroEditorGotFocus()"
></macro-command-editor>
</div>
<icon *ngIf="deletable" name="trash" (click)="deleteAction()" class="align-items-top"></icon>
</div>
</div>

<div class="list-group-item macro-action-editor__container"
*ngIf="(editable && editing) || newItem"
[@toggler]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,19 @@
}
}

.btn-change-macro-action {
margin-top: 0.2em;
padding: 2px;
width: 90px;
visibility: hidden;
}

.macro-command-item {
&:focus-within {
.btn-change-macro-action {
visibility: visible;
}
display: flex;
flex-direction: column;

.macro-command-item-header {
display: flex;
gap: 0.25em;
}
}

.macro-command-editor-container {
height: 100%;
width: 100%;
padding-left: 0.5em;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
SimpleChanges
} from '@angular/core';
import { animate, style, transition, trigger } from '@angular/animations';
import { faGripLinesVertical } from '@fortawesome/free-solid-svg-icons';
import { faCode, faGripLinesVertical } from '@fortawesome/free-solid-svg-icons';
import {
CommandMacroAction,
DelayMacroAction,
Expand Down Expand Up @@ -83,6 +83,7 @@ export class MacroItemComponent implements OnInit, OnChanges {
titleIcon: string;
iconName: string;
newItem: boolean = false;
faCode = faCode;
faGripLinesVertical = faGripLinesVertical;
isCommand = false;

Expand Down

0 comments on commit a4a4002

Please sign in to comment.