Skip to content

Commit

Permalink
Feat/improve UI (#878)
Browse files Browse the repository at this point in the history
* feat(ui): improve colors in header and responsiveness

* feat(ui): improve sidebar tags

* feat(ui): add back github icon

* chore(ui): load svg with mock-server
  • Loading branch information
timonback authored Aug 1, 2024
1 parent dbbb833 commit a9d974d
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 14 deletions.
2 changes: 0 additions & 2 deletions springwolf-ui/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/_redirects",
"src/favicon.ico",
"src/assets"
],
"styles": [
Expand Down
13 changes: 12 additions & 1 deletion springwolf-ui/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: Apache-2.0 */
import { Component, OnInit } from "@angular/core";
import { UiService } from "./service/ui.service";
import { DomSanitizer } from "@angular/platform-browser";
import { MatIconRegistry } from "@angular/material/icon";

@Component({
selector: "app-root",
Expand All @@ -10,7 +12,16 @@ import { UiService } from "./service/ui.service";
export class AppComponent implements OnInit {
isNewUi: boolean = true;

constructor(private uiService: UiService) {}
constructor(
private iconRegistry: MatIconRegistry,
private sanitizer: DomSanitizer,
private uiService: UiService
) {
this.iconRegistry.addSvgIcon(
"github",
this.sanitizer.bypassSecurityTrustResourceUrl("assets/github.svg")
);
}

ngOnInit() {
this.uiService.isNewUi$.subscribe((value) => (this.isNewUi = value));
Expand Down
14 changes: 11 additions & 3 deletions springwolf-ui/src/app/components/header/header.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@
display: block;
}

h1,
:host ::ng-deep label,
a {
text-decoration: none;
color: white;
color: var(--mat-toolbar-container-text-color);
}

a {
text-decoration: none;
}
a:hover {
color: lightgray;
}

:host ::ng-deep mat-icon {
height: 3em;
width: 3em;
transform: scale(0.75);
filter: invert(100%);
}
8 changes: 4 additions & 4 deletions springwolf-ui/src/app/components/header/header.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- SPDX-License-Identifier: Apache-2.0 -->
<mat-toolbar class="flex-column space-between items-center">
<mat-toolbar class="row space-between">
<span>
<a
href="https://www.springwolf.dev"
Expand All @@ -16,16 +16,16 @@
Springwolf
</a>
</span>
<h1>{{ title }}</h1>
<div>
<h1 class="width-s-hide">{{ title }}</h1>
<div class="flex flex-column items-center">
<mat-slide-toggle
[(ngModel)]="isNewUi"
(change)="toggleIsNewUi($event.checked)"
>New UI</mat-slide-toggle
>
&nbsp;
<a href="https://github.com/springwolf/springwolf-core" target="_blank">
GitHub
<mat-icon [svgIcon]="'github'" />
</a>
</div>
</mat-toolbar>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ a {

.sidenav .entry.selected > span > a {
font-weight: bold;
color: var(--mat-app-text-color);
}
.sidenav .entry.collapsed {
display: none;
Expand All @@ -24,10 +25,10 @@ a {
.sidenav .badge {
text-transform: uppercase;
font-size: smaller;
word-break: break-all;

border-radius: 0.3em;
padding: 0 0.1em;
margin: 0 0 auto 0;
}
.sidenav .badge.send-badge {
color: var(--springwolf-badge-color-send);
Expand Down
4 changes: 2 additions & 2 deletions springwolf-ui/src/app/service/mock/mock-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class MockServer implements InMemoryDbService {
});
}

return undefined;
return reqInfo.utils.getPassThruBackend().handle(reqInfo.req);
}

post(reqInfo: RequestInfo) {
Expand All @@ -38,7 +38,7 @@ export class MockServer implements InMemoryDbService {
});
}

return undefined;
return reqInfo.utils.getPassThruBackend().handle(reqInfo.req);
}

private selectMockData() {
Expand Down
1 change: 1 addition & 0 deletions springwolf-ui/src/assets/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion springwolf-ui/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ $theme: mat.define-theme((
tertiary: mat.$blue-palette,
),
));
// @include mat.color-variants-backwards-compatibility($theme);

@mixin theme($theme) {
--mat-toolbar-container-text-color: #EEE;
mat-toolbar {
background: mat.get-theme-color($theme, primary, 40);
color: var(--mat-toolbar-container-text-color);
}
}

Expand Down

0 comments on commit a9d974d

Please sign in to comment.