From e1be8caace8f32abfbd5d1c7bbeec765c93ef037 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Mon, 18 Mar 2024 09:30:14 +0100 Subject: [PATCH] MOBILE-4268 core: Rename core-error-accordion --- .../core-error-accordion.html} | 2 +- .../error-accordion.scss} | 24 ++++++++--------- .../error-accordion.ts} | 26 +++++++++---------- src/core/features/login/pages/site/site.ts | 9 ++++--- src/core/services/utils/dom.ts | 8 +++--- src/theme/theme.scss | 2 +- 6 files changed, 36 insertions(+), 35 deletions(-) rename src/core/components/{error-info/core-error-info.html => error-accordion/core-error-accordion.html} (75%) rename src/core/components/{error-info/error-info.scss => error-accordion/error-accordion.scss} (66%) rename src/core/components/{error-info/error-info.ts => error-accordion/error-accordion.ts} (73%) diff --git a/src/core/components/error-info/core-error-info.html b/src/core/components/error-accordion/core-error-accordion.html similarity index 75% rename from src/core/components/error-info/core-error-info.html rename to src/core/components/error-accordion/core-error-accordion.html index 2808ecb68..47704faba 100644 --- a/src/core/components/error-info/core-error-info.html +++ b/src/core/components/error-accordion/core-error-accordion.html @@ -2,5 +2,5 @@ The markup for this component is rendered dynamically using the static render() method instead of using Angular's engine. The reason for using this approach is that this allows injecting this component into HTML directly, rather than requiring Angular - to control its lifecycle. + to control its lifecycle. This is necessary, for example, to render within alerts. --> diff --git a/src/core/components/error-info/error-info.scss b/src/core/components/error-accordion/error-accordion.scss similarity index 66% rename from src/core/components/error-info/error-info.scss rename to src/core/components/error-accordion/error-accordion.scss index a0723f21f..a16ec2ac9 100644 --- a/src/core/components/error-info/error-info.scss +++ b/src/core/components/error-accordion/error-accordion.scss @@ -1,4 +1,4 @@ -.core-error-info { +.core-error-accordion { background: var(--gray-200); border-radius: var(--radius-xs); font-size: var(--body-font-size-sm); @@ -12,26 +12,26 @@ margin-bottom: 0; } - .core-error-info--code { + .core-error-accordion--code { padding: var(--spacing-2) var(--spacing-2) 0 var(--spacing-2); font-size: var(--body-font-size-md); } - .core-error-info--details p { + .core-error-accordion--details p { padding: var(--spacing-2) var(--spacing-2) 0 var(--spacing-2); color: var(--gray-500); } - .core-error-info--checkbox { + .core-error-accordion--checkbox { display: none; - & + .core-error-info--details, - & + .core-error-info--code + .core-error-info--details { + & + .core-error-accordion--details, + & + .core-error-accordion--code + .core-error-accordion--details { max-height: 0; overflow: hidden; transition: max-height 600ms ease-in-out; - & + .core-error-info--toggle { + & + .core-error-accordion--toggle { display: flex; padding: var(--spacing-2); min-height: var(--a11y-min-target-size); @@ -48,7 +48,7 @@ width: 11px; } - .core-error-info--hide-content { + .core-error-accordion--hide-content { display: none; } @@ -56,15 +56,15 @@ } - &:checked + .core-error-info--details, - &:checked + .core-error-info--code + .core-error-info--details { + &:checked + .core-error-accordion--details, + &:checked + .core-error-accordion--code + .core-error-accordion--details { max-height: 110px; - & + .core-error-info--toggle .core-error-info--hide-content { + & + .core-error-accordion--toggle .core-error-accordion--hide-content { display: flex; } - & + .core-error-info--toggle .core-error-info--show-content { + & + .core-error-accordion--toggle .core-error-accordion--show-content { display: none; } diff --git a/src/core/components/error-info/error-info.ts b/src/core/components/error-accordion/error-accordion.ts similarity index 73% rename from src/core/components/error-info/error-info.ts rename to src/core/components/error-accordion/error-accordion.ts index 31666e599..b2f31d845 100644 --- a/src/core/components/error-info/error-info.ts +++ b/src/core/components/error-accordion/error-accordion.ts @@ -23,11 +23,11 @@ import { CoreForms } from '@singletons/form'; * it can be rendered using the static render() method to get the raw HTML. */ @Component({ - selector: 'core-error-info', - templateUrl: 'core-error-info.html', - styleUrls: ['error-info.scss'], + selector: 'core-error-accordion', + templateUrl: 'core-error-accordion.html', + styleUrls: ['error-accordion.scss'], }) -export class CoreErrorInfoComponent implements OnInit, OnChanges { +export class CoreErrorAccordionComponent implements OnInit, OnChanges { /** * Render an instance of the component into an HTML string. @@ -37,24 +37,24 @@ export class CoreErrorInfoComponent implements OnInit, OnChanges { * @returns Component HTML. */ static render(errorDetails: string, errorCode: string): string { - const toggleId = CoreForms.uniqueId('error-info-toggle'); + const toggleId = CoreForms.uniqueId('error-accordion-toggle'); const errorCodeLabel = Translate.instant('core.errorcode', { errorCode }); const hideDetailsLabel = Translate.instant('core.errordetailshide'); const showDetailsLabel = Translate.instant('core.errordetailsshow'); return ` -
- -
${errorCodeLabel}
-
+
+ +
${errorCodeLabel}
+

${errorDetails}

-