Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/app/shared/layout/header.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,29 @@
align-items: center;
}
}

.repo-button-text {
margin-right: 32px;
}

.remove-btn {
position: absolute;
right: 2px;
inset-block: 0;
margin-block: auto;
border: none;
color: lightgray;
width: 28px;
height: 28px;
font-size: 28px;
line-height: 28px;
display: none;
}

.remove-btn:hover {
color: red;
}

button.mat-menu-item:hover .remove-btn {
display: inline-block;
}
3 changes: 2 additions & 1 deletion src/app/shared/layout/header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
<div class="repo-options">
<div *ngFor="let repo of this.repoUrlCacheService.suggestions">
<button mat-menu-item *ngIf="repo !== this.currentRepo" (click)="this.applyRepoDropdown(repo, true)">
{{ repo }}
<span class="repo-button-text">{{ repo }}</span>
<mat-icon class="remove-btn" (click)="this.removeRepo(repo, $event)">close</mat-icon>
</button>
</div>
</div>
Expand Down
10 changes: 10 additions & 0 deletions src/app/shared/layout/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,14 @@ export class HeaderComponent implements OnInit {
}
});
}

/**
* Removes the repo from the list of suggestions.
* This method will update the local storage as well.
*/
removeRepo(repo: string, event: MouseEvent) {
event.stopPropagation();
event.preventDefault();
this.repoUrlCacheService.removeFromSuggestions(repo);
}
}