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 ` -
${errorDetails}