From f72899401d3ab8acec7054ba43b2780cbc843b77 Mon Sep 17 00:00:00 2001 From: chapoi <101828855+chapoi@users.noreply.github.com> Date: Wed, 15 Nov 2023 11:14:47 +0100 Subject: [PATCH] UX: refactor .d-modal to use BEM and improve styling (#23967) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR refactors the following: * leaving all the CSS applied to the old `modal-body` classes in their respective files * made new clean styling for `.d-modal` and refactored the template to use the new BEM classes * `inner-`, `middle-`, `outer-` container classes are gone and replaced with simplified `wrapper` and `container` classes * use standardised max-sizes with modifiers `-large` and `-max` * lighter backdrop, * min-width to prevent puny modals * other styling changes regarding padding, close button,… * pulled out all modal overrides into a general `modal-overrides` file + cleanup of outdated CSS * pulled out login and create account modal styling into their own file, cause it's such a big override * removed old general login.scss file for mobile & desktop * only kept some remainders I don't want to touch in `app/assets/stylesheets/common/base/login.scss` --- .../discourse/app/components/d-modal.hbs | 134 +++--- .../discourse/app/components/d-modal.js | 4 +- .../app/components/modal/create-account.hbs | 450 +++++++++--------- .../components/modal/create-invite-bulk.hbs | 2 +- .../app/components/modal/forgot-password.hbs | 3 +- .../app/components/modal/history.hbs | 2 +- .../modal/keyboard-shortcuts-help.hbs | 2 +- .../discourse/app/components/modal/login.hbs | 18 +- .../app/components/modal/login/footer.hbs | 4 +- .../app/components/modal/share-topic.hbs | 1 + .../components/modal/topic-bulk-actions.hbs | 2 +- .../edit-navigation-menu/tags-modal.js | 4 +- .../admin-install-theme-modal-test.js | 2 +- .../acceptance/admin-watched-words-test.js | 15 +- .../acceptance/composer-hyperlink-test.js | 32 +- .../tests/acceptance/composer-test.js | 36 +- .../create-account-from-login-test.js | 4 +- .../tests/acceptance/create-account-test.js | 18 +- .../create-account-user-fields-test.js | 8 +- .../tests/acceptance/flag-post-test.js | 4 +- .../tests/acceptance/forgot-password-test.js | 6 +- .../discourse/tests/acceptance/group-test.js | 4 +- .../tests/acceptance/groups-index-test.js | 2 +- .../acceptance/keyboard-shortcuts-test.js | 4 +- .../mobile-topic-bulk-actions-test.js | 2 +- .../tests/acceptance/modal-service-test.gjs | 8 +- .../acceptance/modal/login/login-test.js | 2 +- .../acceptance/post-table-wrapper-test.js | 2 +- .../discourse/tests/acceptance/review-test.js | 14 +- .../tests/acceptance/sign-in-test.js | 52 +- .../discourse/tests/acceptance/themes-test.js | 12 +- .../acceptance/topic-bulk-actions-test.js | 2 +- .../tests/acceptance/topic-edit-timer-test.js | 6 +- .../tests/acceptance/topic-move-posts-test.js | 10 +- .../tests/acceptance/topic-slow-mode-test.js | 4 +- .../tests/acceptance/user-menu-test.js | 14 +- .../user-preferences-account-test.js | 2 +- ...er-preferences-account-user-status-test.js | 2 +- .../discourse/tests/acceptance/user-test.js | 2 +- .../integration/components/d-modal-test.gjs | 37 +- app/assets/stylesheets/common/base/alert.scss | 1 + app/assets/stylesheets/common/base/login.scss | 284 +---------- app/assets/stylesheets/common/base/modal.scss | 288 ++++------- .../stylesheets/common/base/share_link.scss | 26 - .../common/components/bookmark-modal.scss | 53 +-- .../common/components/buttons.scss | 9 +- .../stylesheets/common/modal/_index.scss | 2 + .../stylesheets/common/modal/login-modal.scss | 299 ++++++++++++ .../common/modal/modal-overrides.scss | 310 ++++++++++++ .../stylesheets/common/modal/user-status.scss | 48 +- app/assets/stylesheets/desktop/_index.scss | 1 - app/assets/stylesheets/desktop/login.scss | 450 ------------------ app/assets/stylesheets/desktop/modal.scss | 16 + app/assets/stylesheets/mobile/_index.scss | 2 +- .../stylesheets/mobile/login-modal.scss | 76 +++ app/assets/stylesheets/mobile/login.scss | 266 ----------- app/assets/stylesheets/mobile/modal.scss | 11 + config/locales/client.en.yml | 9 +- .../chat/assets/stylesheets/mobile/index.scss | 1 - .../spec/system/thread_list/full_page_spec.rb | 4 +- spec/system/page_objects/modals/badge.rb | 2 +- spec/system/page_objects/modals/base.rb | 6 +- .../page_objects/modals/change_owner.rb | 2 +- .../modals/delete_themes_confirm.rb | 2 +- spec/system/page_objects/modals/flag.rb | 2 +- .../modals/reject_reason_reviewable.rb | 2 +- .../modals/sidebar_edit_navigation_modal.rb | 2 +- .../user_preferences_security_spec.rb | 4 +- 68 files changed, 1362 insertions(+), 1748 deletions(-) create mode 100644 app/assets/stylesheets/common/modal/login-modal.scss create mode 100644 app/assets/stylesheets/common/modal/modal-overrides.scss delete mode 100644 app/assets/stylesheets/desktop/login.scss create mode 100644 app/assets/stylesheets/mobile/login-modal.scss delete mode 100644 app/assets/stylesheets/mobile/login.scss diff --git a/app/assets/javascripts/discourse/app/components/d-modal.hbs b/app/assets/javascripts/discourse/app/components/d-modal.hbs index 815c8027b06..2df4de724f4 100644 --- a/app/assets/javascripts/discourse/app/components/d-modal.hbs +++ b/app/assets/javascripts/discourse/app/components/d-modal.hbs @@ -7,11 +7,7 @@ @append={{true}} > -