Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify icon styling #2731

Merged
merged 5 commits into from
Oct 28, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ng-container *ngIf="isInitialized">
<ng-container *ngVar="(component.id === component.alias ? outputChannel.channelId : component.alias) as name">
<oe-flat-widget [icon]="{name: icon.name, color:icon.color}" [title]="name | translate">
<oe-flat-widget [icon]="icon" [title]="name | translate">
<oe-flat-widget-line [name]="name | translate" [value]="state">
</oe-flat-widget-line>
</oe-flat-widget>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/edge/live/Controller/ChpSoc/ChpSoc.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</oe-flat-widget-line>

<ng-template #noValue>
<oe-flat-widget-line [icon]="{name: icon.name}" [name]="'General.state' | translate"></oe-flat-widget-line>
<oe-flat-widget-line [icon]="icon" [name]="'General.state' | translate"></oe-flat-widget-line>
</ng-template>

<oe-flat-widget-percentagebar *ngIf="this.modeChannelValue === 'AUTOMATIC'">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<oe-flat-widget *ngIf="isInitialized" button (click)="presentModal()" [title]="component.alias"
[icon]="{name: icon.name}">
[icon]="icon">
<oe-flat-widget-line [name]="'General.state' | translate" [value]="state"></oe-flat-widget-line>
<oe-flat-widget-line [name]="'General.mode' | translate" [value]="mode"></oe-flat-widget-line>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Controller_Io_ChannelSingleThresholdComponent extends AbstractFlatW
public icon: Icon = {
name: "",
color: "",
size: "",
size: "large",
};
public dependendOn: string;
public dependendOnValue: any;
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/shared/components/flat/flat-widget.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<ion-item color="light" lines="full">

<!-- Check if img or icon is handed over. -->
<ion-avatar *ngIf="img" slot="start">
<img [src]="img">
<ion-avatar *ngIf="img" slot="start" [class]="'iconify' + (img.large? ' icon-large' : '')">
<img [src]="img.src">
</ion-avatar>
<ion-icon *ngIf="icon" slot="start" [size]="icon.size || 'large'" [color]="icon.color || 'primary'"
[name]="icon.name">
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/shared/components/flat/flat.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<ion-item color="light" lines="full">

<!-- Check if img or icon is handed over. -->
<ion-avatar *ngIf="img" slot="start">
<img [src]="img">
<ion-avatar *ngIf="img" slot="start" [class]="'iconify' + (img.large? ' icon-large' : '')">
<img [src]="img.src">
</ion-avatar>
<ion-icon *ngIf="icon" slot="start" [size]="icon.size || 'large'" [color]="icon.color || 'primary'"
[name]="icon.name">
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/shared/components/flat/flat.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-strict-ignore
import { Component, Input } from "@angular/core";
import { Icon } from "src/app/shared/type/widget";
import { Icon, ImageIcon } from "src/app/shared/type/widget";

@Component({
selector: "oe-flat-widget",
Expand All @@ -9,7 +9,7 @@ import { Icon } from "src/app/shared/type/widget";
export class FlatWidgetComponent {

/** Image in Header */
@Input() public img?: string;
@Input() public img?: ImageIcon;

/** Icon in Header */
@Input() public icon: Icon | null = null;
Expand Down
5 changes: 5 additions & 0 deletions ui/src/app/shared/type/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export type Icon = {
name: string;
};

export type ImageIcon = {
src: string;
large: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what you want to provide here, shouldnt this be size?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is only normal and large.

};

export class Widget {
public name: WidgetNature | WidgetFactory | string;
public componentId: string;
Expand Down
14 changes: 14 additions & 0 deletions ui/src/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -416,3 +416,17 @@ ion-modal.full-width {
.card-with-primary-border {
border: 2px solid $primary-color;
}

ion-avatar.iconify {
margin-inline-end: 32px;
margin-top: 12px;
margin-bottom: 12px;
--border-radius: 0;
max-height: 24px;
max-width: 24px;
}

ion-avatar.iconify.icon-large {
max-height: 32px;
max-width: 32px;
da-Kai marked this conversation as resolved.
Show resolved Hide resolved
}