Skip to content

Commit

Permalink
Update styles for userbar and a11y checker in dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
albinazs authored and lb- committed Jul 16, 2023
1 parent ecb2126 commit f35e9d7
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Changelog
* Add support for AVIF images (Aman Pandey)
* Change the default WebP quality to 80 to match AVIF (Aman Pandey)
* Adopt optimised Wagtail logo in the admin interface (Albina Starykova)
* Add support for presenting the userbar (Wagtail button) in dark mode (Albina Starykova)
* Fix: Prevent choosers from failing when initial value is an unrecognised ID, e.g. when moving a page from a location where `parent_page_types` would disallow it (Dan Braghis)
* Fix: Move comment notifications toggle to the comments side panel (Sage Abdullah)
* Fix: Remove comment button on InlinePanel fields (Sage Abdullah)
Expand Down
8 changes: 6 additions & 2 deletions client/scss/components/_userbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ $positions: (
width: $size-home-button;
height: $size-home-button;
margin: 0;
background-color: theme('colors.surface-page');
background-color: theme('colors.white.DEFAULT');
border: 2px solid transparent;
border-radius: 50%;
padding: 0;
Expand Down Expand Up @@ -258,6 +258,10 @@ $positions: (
background: theme('colors.surface-page');
}

.w-dialog__close-icon {
color: theme('colors.text-context');
}

.w-dialog__content {
padding: 0;
min-height: unset;
Expand Down Expand Up @@ -319,7 +323,7 @@ $positions: (
.w-a11y-result__selector {
display: flex;
align-items: center;
background: theme('colors.surface-header');
background: theme('colors.surface-field-inactive');
color: theme('colors.text-context');
border-radius: theme('borderRadius.DEFAULT');
margin-inline-end: theme('spacing.[2.5]');
Expand Down
1 change: 1 addition & 0 deletions docs/releases/5.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ This feature was developed by Aman Pandey as part of the Google Summer of Code p
* Purge revisions of non-page models in `purge_revisions` command (Sage Abdullah)
* Change the default WebP quality to 80 to match AVIF (Aman Pandey)
* Adopt optimised Wagtail logo in the admin interface (Albina Starykova)
* Add support for presenting the userbar (Wagtail button) in dark mode (Albina Starykova)

### Bug fixes

Expand Down
2 changes: 1 addition & 1 deletion wagtail/admin/templates/wagtailadmin/skeleton.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load wagtailadmin_tags i18n %}
{% get_current_language as LANGUAGE_CODE %}
{% get_current_language_bidi as LANGUAGE_BIDI %}
<html lang="{{ LANGUAGE_CODE }}" dir="{% if LANGUAGE_BIDI %}rtl{% else %}ltr{% endif %}" class="w-theme-{% admin_theme_name %}">
<html lang="{{ LANGUAGE_CODE }}" dir="{% if LANGUAGE_BIDI %}rtl{% else %}ltr{% endif %}" class="{% admin_theme_classname %}">
<head>
<meta charset="utf-8" />
<title>{% block titletag %}{% endblock %} - {% block branding_title %}Wagtail{% endblock %}</title>
Expand Down
2 changes: 1 addition & 1 deletion wagtail/admin/templates/wagtailadmin/userbar/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- Wagtail user bar embed code -->
<template id="wagtail-userbar-template">
<aside>
<div class="w-userbar w-userbar--{{ position|default:'bottom-right' }}" data-wagtail-userbar part="userbar">
<div class="w-userbar w-userbar--{{ position|default:'bottom-right' }} {% admin_theme_classname %}" data-wagtail-userbar part="userbar">
<link rel="stylesheet" href="{% versioned_static 'wagtailadmin/css/core.css' %}">
{% hook_output 'insert_global_admin_css' %}
{% hook_output 'insert_editor_css' %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
{% trans 'Issues found' %}
<span class="w-a11y-result__count" data-a11y-result-count></span>
{% endfragment %}
{% dialog id="accessibility-results" theme="floating" classname="w-dialog--userbar" title=dialog_title subtitle=issues_found a11y_count="a11y_count" %}
{% fragment as dialog_classname %}w-dialog--userbar {% admin_theme_classname %}{% endfragment %}
{% dialog id="accessibility-results" theme="floating" classname=dialog_classname title=dialog_title subtitle=issues_found a11y_count="a11y_count" %}
{# Contents of the dialog created in JS based on these templates. #}
<template id="w-a11y-result-row-template">
<div class="w-a11y-result__row" data-a11y-result-row>
Expand Down
5 changes: 3 additions & 2 deletions wagtail/admin/templatetags/wagtailadmin_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,16 +613,17 @@ def avatar_url(user, size=50, gravatar_only=False):


@register.simple_tag(takes_context=True)
def admin_theme_name(context):
def admin_theme_classname(context):
"""
Retrieves the theme name for the current user.
"""
user = context["request"].user
return (
theme_name = (
user.wagtail_userprofile.theme
if hasattr(user, "wagtail_userprofile")
else "system"
)
return f"w-theme-{theme_name}"


@register.simple_tag
Expand Down

0 comments on commit f35e9d7

Please sign in to comment.