Issue #3100083 by finnsky, Zsuffa Dávid, ankithashetty, _utsavsharma, gauravvvv, smustgrave, zrpnr, markconroy: Add js message theme override to match Umami message markup

merge-requests/9435/head^2
nod_ 2024-10-07 10:16:02 +02:00
parent 5f1bd5ffbd
commit 0e07179f7b
No known key found for this signature in database
GPG Key ID: 76624892606FA197
7 changed files with 44 additions and 50 deletions

View File

@ -28,7 +28,7 @@ class AssetAggregationAcrossPagesTest extends PerformanceTestBase {
$this->assertSame(6, $performance_data->getStylesheetCount()); $this->assertSame(6, $performance_data->getStylesheetCount());
$this->assertLessThan(125000, $performance_data->getStylesheetBytes()); $this->assertLessThan(125000, $performance_data->getStylesheetBytes());
$this->assertSame(1, $performance_data->getScriptCount()); $this->assertSame(1, $performance_data->getScriptCount());
$this->assertLessThan(7500, $performance_data->getScriptBytes()); $this->assertLessThan(12000, $performance_data->getScriptBytes());
} }
/** /**

View File

@ -75,9 +75,9 @@ class OpenTelemetryFrontPagePerformanceTest extends PerformanceTestBase {
$this->assertSame(1, $performance_data->getCacheTagIsValidCount()); $this->assertSame(1, $performance_data->getCacheTagIsValidCount());
$this->assertSame(0, $performance_data->getCacheTagInvalidationCount()); $this->assertSame(0, $performance_data->getCacheTagInvalidationCount());
$this->assertSame(1, $performance_data->getScriptCount()); $this->assertSame(1, $performance_data->getScriptCount());
$this->assertLessThan(7500, $performance_data->getScriptBytes()); $this->assertLessThan(12000, $performance_data->getScriptBytes());
$this->assertSame(2, $performance_data->getStylesheetCount()); $this->assertSame(2, $performance_data->getStylesheetCount());
$this->assertLessThan(40400, $performance_data->getStylesheetBytes()); $this->assertLessThan(42000, $performance_data->getStylesheetBytes());
} }
/** /**

View File

@ -3,13 +3,12 @@
* This file is used to style the layout builder. * This file is used to style the layout builder.
*/ */
.layout-builder__message--defaults .messages, .layout-builder__message .messages {
.layout-builder__message--overrides .messages {
background-image: none; background-image: none;
} }
.layout-builder__message--defaults .messages__content { .layout-builder__message--defaults .messages__content {
background-image: url("../../../../../../../misc/icons/73b355/globe.svg"); --umami-message-icon: url("../../../../../../../misc/icons/73b355/globe.svg");
} }
.layout-builder__message--overrides .messages__content { .layout-builder__message--overrides .messages__content {
background-image: url("../../../../../../../misc/icons/73b355/location.svg"); --umami-message-icon: url("../../../../../../../misc/icons/73b355/location.svg");
} }

View File

@ -4,49 +4,39 @@
*/ */
.messages { .messages {
margin-bottom: 1em;
padding: 20px; padding: 20px;
word-wrap: break-word; word-wrap: break-word;
color: inherit; color: inherit;
overflow-wrap: break-word; overflow-wrap: break-word;
} }
[dir="rtl"] .messages {
text-align: right;
background-position: right 10px top 17px;
}
.messages + .messages {
margin-top: 1.538em;
}
.messages__content { .messages__content {
padding-left: 24px; /* LTR */ padding-inline-start: 24px;
background: no-repeat 0 center; /* LTR */ background-image: var(--umami-message-icon);
background-repeat: no-repeat;
background-position-x: left;
background-position-y: center;
} }
[dir="rtl"] .messages__content { [dir="rtl"] .messages__content {
padding-right: 24px; background-position-x: right;
padding-left: 0;
background-position: right;
} }
.messages--status { .messages--status {
--umami-message-icon: url(/core/misc/icons/73b355/check.svg);
border: 1px solid #cbdebc; border: 1px solid #cbdebc;
background-color: #e6eee0; background-color: #e6eee0;
} }
.messages--status .messages__content {
background-image: url(/core/misc/icons/73b355/check.svg);
}
.messages--warning { .messages--warning {
--umami-message-icon: url(/core/misc/icons/e29700/warning.svg);
border: 1px solid #fae2a4; border: 1px solid #fae2a4;
background-color: #fcf1d4; background-color: #fcf1d4;
} }
.messages--warning .messages__content {
background-image: url(/core/misc/icons/e29700/warning.svg);
}
.messages--error { .messages--error {
--umami-message-icon: url(/core/misc/icons/e32700/error.svg);
border: 1px solid #f8c8d5; border: 1px solid #f8c8d5;
background-color: #f9e6eb; background-color: #f9e6eb;
} }
.messages--error .messages__content {
background-image: url(/core/misc/icons/e32700/error.svg);
}
.messages--error .error { .messages--error .error {
color: inherit; color: inherit;
} }
@ -61,3 +51,7 @@
.messages__item + .messages__item { .messages__item + .messages__item {
margin-top: 0.769em; margin-top: 0.769em;
} }
.messages__wrapper {
display: grid;
gap: 1.538em;
}

View File

@ -34,7 +34,7 @@
messageWrapper.setAttribute('data-drupal-message-type', type); messageWrapper.setAttribute('data-drupal-message-type', type);
messageWrapper.innerHTML = ` messageWrapper.innerHTML = `
<div class="messages__content container"> <div class="messages__content">
<h2 class="visually-hidden"> <h2 class="visually-hidden">
${messagesTypes[type]} ${messagesTypes[type]}
</h2> </h2>

View File

@ -20,19 +20,21 @@
*/ */
#} #}
<div data-drupal-messages> <div data-drupal-messages>
{% block messages %} <div class="messages__wrapper container">
{% for type, messages in message_list %} {% block messages %}
{% {% for type, messages in message_list %}
set classes = [ {%
'messages', set classes = [
'messages--' ~ type, 'messages',
] 'messages--' ~ type,
%} ]
<div role="contentinfo" aria-label="{{ status_headings[type] }}"{{ attributes.addClass(classes)|without('role', 'aria-label') }}> %}
<div class="messages__content container"> <div
{% if type == 'error' %} aria-label="{{ status_headings[type] }}"
<div role="alert"> {{ attributes.addClass(classes)|without('aria-label') }}
{% endif %} role={{ type == 'error' or type == 'warning' ? 'alert' : 'status' }}
>
<div class="messages__content">
{% if status_headings[type] %} {% if status_headings[type] %}
<h2 class="visually-hidden">{{ status_headings[type] }}</h2> <h2 class="visually-hidden">{{ status_headings[type] }}</h2>
{% endif %} {% endif %}
@ -45,13 +47,11 @@
{% else %} {% else %}
<span class="messages__item">{{ messages|first }}</span> <span class="messages__item">{{ messages|first }}</span>
{% endif %} {% endif %}
{% if type == 'error' %} </div>
</div>
{% endif %}
</div> </div>
{# Remove type specific classes. #}
{% set attributes = attributes.removeClass(classes) %}
{% endfor %}
{% endblock messages %}
</div> </div>
{# Remove type specific classes. #}
{% set attributes = attributes.removeClass(classes) %}
{% endfor %}
{% endblock messages %}
</div> </div>

View File

@ -6,6 +6,7 @@ version: VERSION
libraries: libraries:
- umami/classy.base - umami/classy.base
- core/normalize - core/normalize
- core/drupal.message
- umami/global - umami/global
libraries-override: libraries-override: