MOBILE-4470 styles: Revisit text wrapping ellipsis

main
Pau Ferrer Ocaña 2024-05-14 11:22:46 +02:00
parent 58ef2f9e0e
commit f8e022c1fd
19 changed files with 57 additions and 68 deletions

View File

@ -9,9 +9,7 @@
.ion-text-wrap ion-label { .ion-text-wrap ion-label {
.item-heading, h2, p { .item-heading, h2, p {
white-space: nowrap; @include ellipsis();
overflow: hidden;
text-overflow: ellipsis;
} }
} }
} }

View File

@ -52,8 +52,7 @@ h4.core-bold {
flex-wrap: wrap; flex-wrap: wrap;
& > span { & > span {
overflow: hidden; @include ellipsis();
text-overflow: ellipsis;
} }
} }

View File

@ -46,9 +46,7 @@
} }
.addon-message-last-message-text { .addon-message-last-message-text {
overflow: hidden; @include ellipsis();
text-overflow: ellipsis;
white-space: nowrap;
flex-shrink: 1; flex-shrink: 1;
} }
} }

View File

@ -51,9 +51,7 @@
} }
core-format-text { core-format-text {
overflow: hidden; @include ellipsis();
text-overflow: ellipsis;
white-space: nowrap;
flex-shrink: 1; flex-shrink: 1;
display: block; display: block;
} }

View File

@ -1,10 +1,11 @@
@use "theme/globals" as *;
:host { :host {
.addon-mod_h5pactivity-table-header { .addon-mod_h5pactivity-table-header {
font-weight: bold; font-weight: bold;
ion-col { ion-col {
overflow: hidden; @include ellipsis();
text-overflow: ellipsis;
} }
} }

View File

@ -1,6 +1,7 @@
@use "theme/globals" as *;
:host { :host {
.addon-mod_h5pactivity-table-header ion-col { .addon-mod_h5pactivity-table-header ion-col {
overflow: hidden; @include ellipsis();
text-overflow: ellipsis;
} }
} }

View File

@ -7,11 +7,7 @@ ion-item.addon-notification-item {
margin-bottom: 8px; margin-bottom: 8px;
p.item-heading { p.item-heading {
font-size: var(--text-size); font-size: var(--text-size);
-webkit-line-clamp: 3; @include ellipsis(3);
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
display: -webkit-box;
} }
p { p {
font-size: 12px; font-size: 12px;

View File

@ -63,11 +63,11 @@
--padding-bottom: 8px; --padding-bottom: 8px;
background: var(--background); background: var(--background);
--color: var(--core-combobox-color);
color: var(--color); color: var(--color);
text-overflow: ellipsis;
white-space: nowrap;
min-height: var(--a11y-sizing-minTargetSize); min-height: var(--a11y-sizing-minTargetSize);
overflow: hidden;
box-shadow: var(--box-shadow); box-shadow: var(--box-shadow);
--highlight-color: transparent !important; --highlight-color: transparent !important;
@ -121,7 +121,6 @@
} }
ion-button { ion-button {
--color: var(--core-combobox-color);
--color-activated: var(--core-combobox-color); --color-activated: var(--core-combobox-color);
--color-focused: currentcolor; --color-focused: currentcolor;
--color-hover: currentcolor; --color-hover: currentcolor;
@ -130,9 +129,7 @@
.select-text { .select-text {
@include margin-horizontal(null, auto); @include margin-horizontal(null, auto);
white-space: nowrap; @include ellipsis();
overflow: hidden;
text-overflow: ellipsis;
font: var(--mdl-typography-label-font-lg); font: var(--mdl-typography-label-font-lg);
} }

View File

@ -67,9 +67,7 @@
flex-grow: 1; flex-grow: 1;
padding-left: .5rem; padding-left: .5rem;
padding-right: .5rem; padding-right: .5rem;
overflow: hidden; @include ellipsis();
text-overflow: ellipsis;
white-space: nowrap;
font-size: 16px; font-size: 16px;
} }
} }

View File

@ -61,9 +61,7 @@
max-width: 100%; max-width: 100%;
ion-label { ion-label {
text-overflow: ellipsis; @include ellipsis();
white-space: nowrap;
overflow: hidden;
word-wrap: break-word; word-wrap: break-word;
max-width: 100%; max-width: 100%;
line-height: 1.2em; line-height: 1.2em;

View File

@ -31,12 +31,12 @@
<div collapsible-footer appearOnBottom *ngIf="displayCourseIndex && (previousSection || nextSection)" slot="fixed"> <div collapsible-footer appearOnBottom *ngIf="displayCourseIndex && (previousSection || nextSection)" slot="fixed">
<div class="core-course-section-nav-buttons safe-area-padding-horizontal list-item-limited-width"> <div class="core-course-section-nav-buttons safe-area-padding-horizontal list-item-limited-width">
<ion-button *ngIf="previousSection" (click)="sectionChanged(previousSection)" expand="block" <ion-button *ngIf="previousSection" (click)="sectionChanged(previousSection)" expand="block"
[attr.aria-label]="('core.previous' | translate) + ': ' + previousSection.name"> [attr.aria-label]="('core.previous' | translate) + ': ' + previousSection.name" class="ion-text-nowrap">
<ion-icon name="fas-arrow-left" slot="start" aria-hidden="true" /> <ion-icon name="fas-arrow-left" slot="start" aria-hidden="true" />
<core-format-text [text]="previousSection.name" contextLevel="course" [contextInstanceId]="course.id" /> <core-format-text [text]="previousSection.name" contextLevel="course" [contextInstanceId]="course.id" />
</ion-button> </ion-button>
<ion-button *ngIf="nextSection" (click)="sectionChanged(nextSection)" expand="block" <ion-button *ngIf="nextSection" (click)="sectionChanged(nextSection)" expand="block"
[attr.aria-label]="('core.next' | translate) + ': ' + nextSection.name"> [attr.aria-label]="('core.next' | translate) + ': ' + nextSection.name" class="ion-text-nowrap">
<core-format-text [text]="nextSection.name" contextLevel="course" [contextInstanceId]="course.id" /> <core-format-text [text]="nextSection.name" contextLevel="course" [contextInstanceId]="course.id" />
<ion-icon name="fas-arrow-right" slot="end" aria-hidden="true" /> <ion-icon name="fas-arrow-right" slot="end" aria-hidden="true" />
</ion-button> </ion-button>

View File

@ -5,9 +5,6 @@
padding-right: 8px; padding-right: 8px;
ion-button { ion-button {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
flex: 1; flex: 1;
margin-left: 4px; margin-left: 4px;
margin-right: 4px; margin-right: 4px;

View File

@ -87,9 +87,7 @@ ion-card {
.core-course-shortname { .core-course-shortname {
font-size: var(--shortname-size); font-size: var(--shortname-size);
color: var(--dark); color: var(--dark);
white-space: nowrap; @include ellipsis();
text-overflow: ellipsis;
overflow: hidden;
} }
ion-chip { ion-chip {
@ -226,18 +224,13 @@ ion-card.core-course-list-card {
// Clamp one line with ellipsis on tablet view, and 2 in mobile. // Clamp one line with ellipsis on tablet view, and 2 in mobile.
.item-heading { .item-heading {
white-space: nowrap; @include ellipsis();
text-overflow: ellipsis;
overflow: hidden;
} }
@include media-breakpoint-down(md) { @include media-breakpoint-down(md) {
.item-heading { .item-heading {
// Addition lines for 2 line or multiline ellipsis // Addition lines for 2 line or multiline ellipsis
display: -webkit-box !important; @include ellipsis(2);
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
white-space: normal;
} }
} }

View File

@ -1,3 +1,5 @@
@use "theme/globals" as *;
:host ion-item { :host ion-item {
--core-global-search-result-image-size: 40px; --core-global-search-result-image-size: 40px;
--core-global-search-result-title-color: var(--text); --core-global-search-result-title-color: var(--text);
@ -52,14 +54,7 @@
core-format-text { core-format-text {
color: var(--core-global-search-result-content-color); color: var(--core-global-search-result-content-color);
@supports (-webkit-line-clamp: 2) { @include ellipsis(2);
white-space: normal;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
} }
.result-context-wrapper { .result-context-wrapper {

View File

@ -620,9 +620,7 @@ core-rich-text-editor .core-rte-editor {
.text-wrap { white-space: normal !important; } .text-wrap { white-space: normal !important; }
.text-nowrap { white-space: nowrap !important; } .text-nowrap { white-space: nowrap !important; }
.text-truncate { .text-truncate {
overflow: hidden; @include ellipsis();
text-overflow: ellipsis;
white-space: nowrap;
} }
.text-left { text-align: left !important; } .text-left { text-align: left !important; }
.text-right { text-align: right !important; } .text-right { text-align: right !important; }

View File

@ -5,13 +5,21 @@ ion-button {
line-height: 120%; line-height: 120%;
core-format-text { core-format-text {
white-space: normal;
display: contents; display: contents;
line-height: 120%; line-height: 120%;
} }
&.ion-text-nowrap {
@include ellipsis();
& > * { & > * {
white-space: normal; @include ellipsis();
}
core-format-text {
display: block;
}
} }
ion-spinner { ion-spinner {

View File

@ -61,9 +61,7 @@ ion-header.header-md {
@include padding(0, 16px); @include padding(0, 16px);
h1, h2, .subheading { h1, h2, .subheading {
text-overflow: ellipsis; @include ellipsis();
white-space: nowrap;
overflow: hidden;
margin: 0; margin: 0;
} }

View File

@ -193,9 +193,7 @@ ion-toggle::part(label),
ion-input > label { ion-input > label {
core-format-text, core-format-text,
core-format-text > *:not(pre) { core-format-text > *:not(pre) {
white-space: nowrap; @include ellipsis();
overflow: hidden;
text-overflow: ellipsis;
} }
} }

View File

@ -153,6 +153,24 @@
border: 0; border: 0;
} }
@mixin ellipsis($lines: 1) {
@if ($lines == 1) {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
} @else {
// Only supported on Android 124+, iOs 11+. https://caniuse.com/css-line-clamp
@supports (-webkit-line-clamp: 2) {
-webkit-line-clamp: $lines;
-webkit-box-orient: vertical;
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
white-space: normal;
}
}
}
/** /**
* Same as item-push-svg-url but admits flip-rtl * Same as item-push-svg-url but admits flip-rtl
*/ */