Skip to content

Commit

Permalink
Limit balance displays in width
Browse files Browse the repository at this point in the history
This is necessary to not break the layout for big balances
  • Loading branch information
manuelwedler committed Apr 22, 2021
1 parent 0b86cdd commit 23f8a37
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:host {
white-space: nowrap;
}

.balance {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
vertical-align: text-bottom;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
*ngIf="balance | decimal: token.decimals as decimalBalance"
[matTooltip]="decimalBalance"
[matTooltipDisabled]="!showTooltip"
class="balance"
[style.max-width.px]="maxBalanceWidth"
>
{{ decimalBalance | displayDecimals: 3 }}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export class BalanceWithSymbolComponent implements OnInit {
@Input() balance: BigNumber;
@Input() token: UserToken;
@Input() showTooltip = true;
@Input() maxBalanceWidth = 50;

constructor() {}

Expand Down
2 changes: 1 addition & 1 deletion src/app/components/header/header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<span fxLayout="row">
<span
[matTooltip]="balance"
class="header__balance header__balance--uppercase"
class="header__balance header__balance--limited"
>
{{ balance | displayDecimals: 3 }}&nbsp;
</span>
Expand Down
13 changes: 11 additions & 2 deletions src/app/components/header/header.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
&--uppercase {
text-transform: uppercase;
}

&--limited {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 50px;
}
}

&__label {
Expand Down Expand Up @@ -119,15 +126,16 @@
background-color: $black;
border-radius: 8px;
font-size: 12px;
line-height: 30px;
line-height: 15px;
color: $white;
width: 125px;
max-height: 171px;
overflow-y: scroll;

&__label {
width: 100%;
padding-top: 6px;
padding-top: 13.5px;
padding-bottom: 7.5px;
background-color: $black;
position: sticky;
position: -webkit-sticky;
Expand All @@ -140,6 +148,7 @@
}

&__item {
padding: 7.5px 0;
margin: 0 16px;
white-space: nowrap;
overflow: hidden;
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/header/header.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ describe('HeaderComponent', () => {
expect(dialogSpy).toHaveBeenCalledTimes(1);
expect(dialogSpy).toHaveBeenCalledWith(QrCodeComponent, {
data: payload,
width: '536px',
width: '550px',
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/app/components/header/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class HeaderComponent implements OnInit, OnDestroy {
};
this.dialog.open(QrCodeComponent, {
data: payload,
width: '536px',
width: '550px',
});
}

Expand Down
1 change: 1 addition & 0 deletions src/app/components/token/token.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
<app-balance-with-symbol
[balance]="selectedToken.sumChannelBalances"
[token]="selectedToken"
[maxBalanceWidth]="250"
></app-balance-with-symbol>
</div>
<ng-template #all_networks>All Networks</ng-template>
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/token/token.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
&__item {
text-align: center;
font-size: 12px;
line-height: 22px;
line-height: 15px;
border-right: 1px solid $bg-grey;

&:last-child {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
class="info__balance"
[balance]="balance$ | async"
[token]="servicesToken"
[maxBalanceWidth]="200"
></app-balance-with-symbol>
<span
*ngIf="zeroBalance$ | async"
Expand Down Expand Up @@ -211,6 +212,7 @@
[balance]="withdrawPlan?.amount"
[token]="servicesToken"
[showTooltip]="false"
[maxBalanceWidth]="100"
></app-balance-with-symbol>
<mat-icon
*ngIf="!withdrawPending; else withdraw_pending"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
&__balance {
font-weight: 500;
font-size: 26px;
line-height: 39px;
line-height: 32px;
padding: 3.5px 0;
color: $white;
}

Expand Down Expand Up @@ -168,7 +169,7 @@
}

.form {
z-index: 3000;
z-index: 2500;
background-color: $black;
position: absolute;
margin: 0 !important;
Expand Down

0 comments on commit 23f8a37

Please sign in to comment.