Skip to content

A platform for community discussion. Free, open, simple.

UX: modal modifier class BEM rename + new modifier (#40369)

chapoiada0aa0d4e17
diff --git a/app/assets/stylesheets/admin/customize-install-theme.scss b/app/assets/stylesheets/admin/customize-install-theme.scss
index 1e4b9b244b1..469528db997 100644
--- a/app/assets/stylesheets/admin/customize-install-theme.scss
+++ b/app/assets/stylesheets/admin/customize-install-theme.scss
@@ -1,6 +1,6 @@
@use "lib/viewport";
-.d-modal.-large.admin-install-theme-modal {
+.d-modal.--large.admin-install-theme-modal {
@include viewport.from(sm) {
.d-modal__container {
max-width: min(1100px, 90vw);
diff --git a/app/assets/stylesheets/common/base/history.scss b/app/assets/stylesheets/common/base/history.scss
index be596e68c8b..b9798cf3759 100644
--- a/app/assets/stylesheets/common/base/history.scss
+++ b/app/assets/stylesheets/common/base/history.scss
@@ -1,7 +1,7 @@
@use "lib/viewport";
// styles that apply to the popup that appears when you show the edit history of a post
-.modal.history-modal {
+.d-modal.history-modal {
.d-modal__footer {
justify-content: space-between;
}
diff --git a/app/assets/stylesheets/common/base/modal.scss b/app/assets/stylesheets/common/base/modal.scss
index cea39901a36..95bee995f46 100644
--- a/app/assets/stylesheets/common/base/modal.scss
+++ b/app/assets/stylesheets/common/base/modal.scss
@@ -25,7 +25,6 @@ html:not(.keyboard-visible).mobile-device {
}
}
-// Modal wrappers
.d-modal {
pointer-events: none; // Allow clicks through wrappers so they hit the adjacent backdrop element
display: flex;
@@ -47,10 +46,6 @@ html:not(.keyboard-visible).mobile-device {
--modal-min-width: 400px;
}
- &.-inline {
- position: relative;
- }
-
&__container {
display: flex;
flex-direction: column;
@@ -83,14 +78,18 @@ html:not(.keyboard-visible).mobile-device {
min-width: var(--modal-min-width);
min-height: var(--modal-min-height); // unset, optional theme utility
- .d-modal.-large & {
+ .d-modal.--large & {
max-width: 800px;
}
- .d-modal.-max & {
+ .d-modal.--max & {
max-width: 90vw;
}
+ .d-modal.has-search & {
+ height: 80vh; // fixed height so the modal doesnt jump when the search results appear/filter
+ }
+
&.is-entering {
@include d-animation(
modal-enter-desktop,
@@ -237,6 +236,10 @@ html:not(.keyboard-visible).mobile-device {
background-color: #000;
animation: fade 0.3s forwards;
+ &.fade {
+ opacity: 0;
+ }
+
@media (prefers-reduced-motion) {
animation-duration: 0s;
}
@@ -270,37 +273,21 @@ html:not(.keyboard-visible).mobile-device {
height: 100%;
}
}
-}
-
-// legacy
-.input-hint-text {
- margin-left: 0.5em;
- color: var(--secondary-high);
-}
-
-.modal-backdrop {
- user-select: none;
- position: fixed;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- z-index: z("modal", "overlay");
- background-color: #111;
- &.fade {
- opacity: 0;
+ pre code {
+ white-space: pre-wrap;
+ max-width: var(--modal-max-width);
}
-}
-.modal-backdrop,
-.modal-backdrop.fade.in {
- animation: fade 0.3s;
- opacity: 0.9;
- filter: alpha(opacity=90);
+ @include viewport.from(sm) {
+ .category-chooser {
+ width: 50%;
+ }
+ }
- @media (prefers-reduced-motion) {
- animation-duration: 0s;
+ .input-hint-text {
+ margin-left: 0.5em;
+ color: var(--secondary-high);
}
}
@@ -369,554 +356,3 @@ html:not(.keyboard-visible).mobile-device {
opacity: 0;
}
}
-
-.modal-form {
- margin-bottom: 0;
-}
-
-.modal {
- &.has-tabs {
- .modal-tabs {
- display: inline-flex;
- flex-wrap: wrap;
- flex: 1 0 auto;
- margin: 0;
-
- .modal-tab {
- list-style: none;
- padding: 4px 8px;
- margin-right: 4px;
- cursor: pointer;
-
- &.is-active {
- color: var(--secondary);
- background: var(--danger);
-
- &.single-tab {
- background: none;
- color: var(--primary);
- padding: 0;
- font-size: var(--font-up-3);
- font-weight: bold;
- }
- }
- }
- }
- }
-
- &:not(.has-tabs) {
- .modal-tab {
- position: absolute;
- width: 95%;
- }
- }
-
- .nav {
- background-color: var(--secondary);
- border-bottom: 1px solid var(--content-border-color);
-
- li > a {
- font-size: var(--font-0);
- }
- }
-
- &.hidden {
- display: none;
- }
-
- pre code {
- white-space: pre-wrap;
- max-width: var(--modal-max-width);
- }
-
- .close {
- font-size: var(--font-up-4);
- text-decoration: none;
- cursor: pointer;
-
- @include viewport.from(sm) {
- font-size: var(--font-up-3);
-
- &:hover {
- color: var(--primary);
- }
- }
- }
-
- @include viewport.from(sm) {
- .category-chooser {
- width: 50%;
- }
- }
-}
-
-.reply-where-modal {
- .dialog-content {
- width: 100%;
- min-width: unset;
- max-width: 30em;
- }
-
- .dialog-footer {
- display: block;
- }
-
- .btn {
- display: block;
- text-align: left;
- margin-bottom: 0.75em;
- margin-right: 0;
- overflow: hidden;
- width: 100%;
- border-radius: var(--d-border-radius);
-
- &.dialog-close {
- display: none;
- }
-
- &.btn-reply-on-original {
- --text-color: var(--secondary);
- }
-
- &.btn-reply-where__cancel {
- padding-left: 0;
- margin: 0;
- }
-
- &.btn-reply-here {
- --text-color: var(--primary);
-
- .discourse-no-touch & {
- &:hover {
- --text-color: var(--secondary);
- }
- }
- }
-
- &.btn-reply-where {
- min-height: 3em; // for situations when there are no categories/tags
- }
-
- .fancy-title {
- display: inline-block;
- width: 100%;
-
- @include ellipsis;
- }
-
- .topic-title__top-line {
- display: flex;
- align-items: baseline;
- color: var(--text-color);
- font-size: var(--font-up-1);
-
- .d-icon {
- color: var(--text-color);
- margin: 0;
- }
- }
-
- .topic-statuses {
- display: flex;
- font-size: 0.95em;
- }
-
- .topic-title__bottom-line {
- margin-top: 0.15em;
- display: flex;
- align-items: baseline;
- gap: 0.5em;
-
- .discourse-tags {
- font-size: var(--font-down-1);
- }
-
- .badge-category__name,
- .discourse-tag {
- color: var(--text-color);
- }
- }
- }
-}
-
-.admin-delete-user-posts-progress-modal {
- .progress-bar {
- height: 15px;
- position: relative;
- background: var(--primary-low-mid);
- border-radius: 25px;
- overflow: hidden;
- margin: 30px 0 20px;
-
- span {
- display: block;
- width: 0%;
- height: 100%;
- background-color: var(--tertiary);
- position: relative;
- transition: width 0.6s linear;
- }
- }
-}
-
-.incoming-email-modal {
- max-height: 80vh;
-
- .btn {
- background-color: transparent;
- margin-right: 5px;
-
- &:hover,
- &.active {
- color: var(--primary);
- }
-
- &.active {
- font-weight: bold;
- }
-
- &:focus {
- outline: 2px solid var(--primary-low);
- }
- }
-
- .incoming-email-tabs {
- margin-bottom: 15px;
- }
-
- .incoming-email-content {
- height: 300px;
- max-width: 100%;
- width: 90vw; // forcing textarea wider
-
- textarea,
- .incoming-email-html-part {
- height: 95%;
- border: none;
- border-top: 1px solid var(--content-border-color);
- padding-top: 10px;
- width: 100%;
- }
-
- textarea {
- font-family: var(--d-font-family--monospace);
- resize: none;
- border-radius: 0;
- box-shadow: none;
- }
-
- .incoming-email-html-part {
- width: calc(100% - 36px);
- padding: 10px 4px 4px 4px;
- }
-
- @media screen and (width <= 760px) {
- .incoming-email-html-part {
- width: calc(100% - 10px);
- }
- }
- }
-}
-
-.change-timestamp {
- width: 28em; // scales with user font-size
- max-width: 90vw; // prevents overflow due to extra large user font-size
-
- #date-container {
- .pika-single {
- position: relative !important; // overriding another important
- display: inline-block;
- margin-top: 0.5em;
- }
- }
-
- .date-picker-wrapper {
- min-width: 130px;
- margin-right: 0.5em;
- }
-
- input[type="time"] {
- width: 130px;
- }
-
- form {
- margin: 0;
- }
-}
-
-.flag-modal-body {
- form {
- margin: 0;
- }
-
- .flag-action-type .controls .checkbox-label {
- margin-bottom: 0.25em;
- }
-
- .flag-action-type-details {
- width: 100%;
-
- // max-width: 500px;
- line-height: var(--line-height-large);
-
- a {
- margin: 0;
- }
- }
-
- .flag-confirmation {
- margin-top: 0.5em;
- padding-left: 1.125em;
- }
-}
-
-.flag-message {
- margin: 0;
-}
-
-.custom-message-length {
- color: var(--primary-medium);
- font-size: var(--font-down-1);
-}
-
-.ignore-duration-with-username-modal {
- .future-date-input {
- margin-top: 1em;
- }
-}
-
-.bulk-notification-list {
- margin-bottom: 1.5em;
-}
-
-.notification-level-radio {
- flex-wrap: wrap;
- align-items: baseline;
- margin-bottom: 0.5em;
-
- .description {
- width: 100%;
- margin-top: 0.25em;
- }
-}
-
-.json-editor-btn-delete {
- @extend .btn-danger;
- @extend .no-text;
-}
-
-.json-editor-btn-collapse {
- @extend .no-text;
- @extend .btn-flat;
- @extend .btn-small;
-}
-
-.confirm-session {
- &__instructions {
- margin-bottom: 0.5em;
- }
-
- form {
- margin: 1.5em 0;
- }
-
- &__passkey {
- margin-top: 1em;
- }
-
- &__fine-print {
- font-size: var(--font-down-1);
- color: var(--primary-medium);
- max-width: 600px;
- }
-
- &__reset {
- font-size: var(--font-down-1);
- color: var(--primary-medium);
- }
-}
-
-.rename-passkey__message {
- max-width: 500px;
- margin-bottom: 2em;
-}
-
-@include viewport.from(sm) {
- .flag-modal-body .flag-message {
- height: 3em;
- }
-
- .choose-topic-modal {
- #choosing-topic {
- // prevents content from moving when user selects different move options 525px
- width: 525px;
-
- p {
- margin-top: 0;
- }
-
- .radios {
- margin-bottom: 10px;
- display: flex;
- flex-direction: row;
-
- .radio-label {
- display: inline-block;
- padding-right: 15px;
- }
- }
-
- button {
- margin-top: 10px;
- display: block;
- }
-
- form {
- width: 95%;
- margin-top: 20px;
-
- .participant-selector {
- width: 100%;
- }
-
- div.ac-wrap {
- width: 100%;
- margin-bottom: 9px;
- }
- }
- }
- }
-
- .create-invite-modal,
- .create-invite-bulk-modal,
- .share-topic-modal {
- .title {
- align-items: center;
- display: flex;
-
- .subtitle {
- margin-left: 0.5em;
- }
- }
-
- .alert-error {
- label {
- display: inline-block;
- }
- }
- }
-}
-
-.create-invite-modal {
- .edit-link-options {
- text-align: left;
- }
-}
-
-.wrap-attributes-modal {
- .wrap-modal__attribute-row {
- display: flex;
- gap: var(--space-2);
-
- .form-kit__field {
- flex: 1;
- }
-
- .btn {
- align-self: end;
- }
- }
-
- &__unwrap {
- margin-left: auto;
- }
-}
-
-.permanently-delete-confirm-modal {
- .d-modal__footer .btn-danger {
- white-space: normal;
- text-align: left;
- }
-
- &.--fire-easter-egg-modal {
- .d-modal__container {
- background-color: transparent;
- color: white;
-
- .confirmation-phrase {
- z-index: 100000;
- }
- }
- }
-
- &__message {
- margin-bottom: var(--space-4);
- }
-
- &__instruction {
- display: flex;
- flex-direction: column;
- gap: 0.5em;
-
- .confirmation-phrase {
- width: 100%;
- margin: 0;
- }
- }
-
- --glitter: url("/images/firenoise.png");
-
- .fire-easter-egg::before,
- .fire-easter-egg::after {
- content: "";
- position: absolute;
- inset: 0;
- }
-
- .fire-easter-egg::before {
- content: "";
- background-image:
- var(--glitter), var(--glitter),
- linear-gradient(
- 0deg,
- white 0,
- #ff8951 5px,
- #dcbc169c 30%,
- transparent 70%
- ),
- radial-gradient(ellipse at bottom, transparent 30%, black 60%);
- background-size:
- 350px 500px,
- 400px 650px,
- 100% 100%,
- 100% 100%;
- background-blend-mode: hard-light, color-dodge, multiply;
- background-position:
- 0 0,
- 0 0,
- var(--gradientPos);
- background-repeat: repeat, repeat, repeat, no-repeat;
- mix-blend-mode: color-dodge;
- filter: brightness(3.7) blur(7px) contrast(6);
- animation: fire-easter-egg 1.75s linear infinite;
- box-shadow: inset 0 -40px 50px -60px #63bbc5;
- }
-
- @keyframes fire-easter-egg {
- 0% {
- background-position:
- center 0,
- center 0,
- 50% 100%,
- center center;
- }
-
- 100% {
- background-position:
- center -500px,
- center -650px,
- 50% 100%,
- center center;
- }
- }
-}
diff --git a/app/assets/stylesheets/common/base/revise-and-reject-post-reviewable.scss b/app/assets/stylesheets/common/base/revise-and-reject-post-reviewable.scss
index 892a1d9446e..8cb55b1a11a 100644
--- a/app/assets/stylesheets/common/base/revise-and-reject-post-reviewable.scss
+++ b/app/assets/stylesheets/common/base/revise-and-reject-post-reviewable.scss
@@ -1,4 +1,4 @@
-.modal.revise-and-reject-reviewable {
+.d-modal.revise-and-reject-reviewable {
.revise-and-reject-reviewable__optional {
margin-left: 0.5em;
color: var(--primary-low-mid);
diff --git a/app/assets/stylesheets/common/components/add-pm-participants.scss b/app/assets/stylesheets/common/components/add-pm-participants.scss
index fd850a395b9..191472f7f02 100644
--- a/app/assets/stylesheets/common/components/add-pm-participants.scss
+++ b/app/assets/stylesheets/common/components/add-pm-participants.scss
@@ -4,7 +4,7 @@
}
}
-.add-pm-participants.modal .share.modal-panel {
+.add-pm-participants.d-modal .share.modal-panel {
.header {
display: flex;
flex-direction: row;
@@ -47,7 +47,7 @@
}
}
-.add-pm-participants.modal .invite.modal-panel,
+.add-pm-participants.d-modal .invite.modal-panel,
.invite-link.modal-panel {
.error-message,
.success-message {
diff --git a/app/assets/stylesheets/common/components/keyboard_shortcuts.scss b/app/assets/stylesheets/common/components/keyboard_shortcuts.scss
index ab826a55c34..43d6d9cc9c1 100644
--- a/app/assets/stylesheets/common/components/keyboard_shortcuts.scss
+++ b/app/assets/stylesheets/common/components/keyboard_shortcuts.scss
@@ -42,7 +42,7 @@
background-color: inherit;
}
-.keyboard-shortcuts-modal.d-modal.-max {
+.keyboard-shortcuts-modal.d-modal.--max {
.d-modal__container {
max-width: 70vw;
}
diff --git a/app/assets/stylesheets/common/modal/modal-overrides.scss b/app/assets/stylesheets/common/modal/modal-overrides.scss
index d35c9ad67f4..7c4eea16ca2 100644
--- a/app/assets/stylesheets/common/modal/modal-overrides.scss
+++ b/app/assets/stylesheets/common/modal/modal-overrides.scss
@@ -610,3 +610,508 @@
}
}
}
+
+.reply-where-modal {
+ .dialog-content {
+ width: 100%;
+ min-width: unset;
+ max-width: 30em;
+ }
+
+ .dialog-footer {
+ display: block;
+ }
+
+ .btn {
+ display: block;
+ text-align: left;
+ margin-bottom: 0.75em;
+ margin-right: 0;
+ overflow: hidden;
+ width: 100%;
+ border-radius: var(--d-border-radius);
+
+ &.dialog-close {
+ display: none;
+ }
+
+ &.btn-reply-on-original {
+ --text-color: var(--secondary);
+ }
+
+ &.btn-reply-where__cancel {
+ padding-left: 0;
+ margin: 0;
+ }
+
+ &.btn-reply-here {
+ --text-color: var(--primary);
+
+ .discourse-no-touch & {
+ &:hover {
+ --text-color: var(--secondary);
+ }
+ }
+ }
+
+ &.btn-reply-where {
+ min-height: 3em; // for situations when there are no categories/tags
+ }
+
+ .fancy-title {
+ display: inline-block;
+ width: 100%;
+
+ @include ellipsis;
+ }
+
+ .topic-title__top-line {
+ display: flex;
+ align-items: baseline;
+ color: var(--text-color);
+ font-size: var(--font-up-1);
+
+ .d-icon {
+ color: var(--text-color);
+ margin: 0;
+ }
+ }
+
+ .topic-statuses {
+ display: flex;
+ font-size: 0.95em;
+ }
+
+ .topic-title__bottom-line {
+ margin-top: 0.15em;
+ display: flex;
+ align-items: baseline;
+ gap: 0.5em;
+
+ .discourse-tags {
+ font-size: var(--font-down-1);
+ }
+
+ .badge-category__name,
+ .discourse-tag {
+ color: var(--text-color);
+ }
+ }
+ }
+}
+
+.admin-delete-user-posts-progress-modal {
+ .progress-bar {
+ height: 15px;
+ position: relative;
+ background: var(--primary-low-mid);
+ border-radius: 25px;
+ overflow: hidden;
+ margin: 30px 0 20px;
+
+ span {
+ display: block;
+ width: 0%;
+ height: 100%;
+ background-color: var(--tertiary);
+ position: relative;
+ transition: width 0.6s linear;
+ }
+ }
+}
+
+.incoming-email-modal {
+ .btn {
+ background-color: transparent;
+ margin-right: 5px;
+
+ &:hover,
+ &.active {
+ color: var(--primary);
+ }
+
+ &.active {
+ font-weight: bold;
+ }
+
+ &:focus {
+ outline: 2px solid var(--primary-low);
+ }
+ }
+
+ .incoming-email-tabs {
+ margin-bottom: 15px;
+ }
+
+ .incoming-email-content {
+ height: 300px;
+ max-width: 100%;
+ width: 90vw; // forcing textarea wider
+
+ textarea,
+ .incoming-email-html-part {
+ height: 95%;
+ border: none;
+ border-top: 1px solid var(--content-border-color);
+ padding-top: 10px;
+ width: 100%;
+ }
+
+ textarea {
+ font-family: var(--d-font-family--monospace);
+ resize: none;
+ border-radius: 0;
+ box-shadow: none;
+ }
+
+ .incoming-email-html-part {
+ width: calc(100% - 36px);
+ padding: 10px 4px 4px 4px;
+ }
+
+ @media screen and (width <= 760px) {
+ .incoming-email-html-part {
+ width: calc(100% - 10px);
+ }
+ }
+ }
+}
+
+.change-timestamp {
+ width: 28em; // scales with user font-size
+ max-width: 90vw; // prevents overflow due to extra large user font-size
+
+ #date-container {
+ .pika-single {
+ position: relative !important; // overriding another important
+ display: inline-block;
+ margin-top: 0.5em;
+ }
+ }
+
+ .date-picker-wrapper {
+ min-width: 130px;
+ margin-right: 0.5em;
+ }
+
+ input[type="time"] {
+ width: 130px;
+ }
+
+ form {
+ margin: 0;
+ }
+}
+
+.flag-modal-body {
+ form {
+ margin: 0;
+ }
+
+ .flag-action-type .controls .checkbox-label {
+ margin-bottom: 0.25em;
+ }
+
+ .flag-action-type-details {
+ width: 100%;
+
+ // max-width: 500px;
+ line-height: var(--line-height-large);
+
+ a {
+ margin: 0;
+ }
+ }
+
+ .flag-confirmation {
+ margin-top: 0.5em;
+ padding-left: 1.125em;
+ }
+}
+
+.flag-message {
+ margin: 0;
+}
+
+.custom-message-length {
+ color: var(--primary-medium);
+ font-size: var(--font-down-1);
+}
+
+.ignore-duration-with-username-modal {
+ .future-date-input {
+ margin-top: 1em;
+ }
+}
+
+.bulk-notification-list {
+ margin-bottom: 1.5em;
+}
+
+.notification-level-radio {
+ flex-wrap: wrap;
+ align-items: baseline;
+ margin-bottom: 0.5em;
+
+ .description {
+ width: 100%;
+ margin-top: 0.25em;
+ }
+}
+
+.json-editor-btn-delete {
+ @extend .btn-danger;
+ @extend .no-text;
+}
+
+.json-editor-btn-collapse {
+ @extend .no-text;
+ @extend .btn-flat;
+ @extend .btn-small;
+}
+
+.confirm-session {
+ &__instructions {
+ margin-bottom: 0.5em;
+ }
+
+ form {
+ margin: 1.5em 0;
+ }
+
+ &__passkey {
+ margin-top: 1em;
+ }
+
+ &__fine-print {
+ font-size: var(--font-down-1);
+ color: var(--primary-medium);
+ max-width: 600px;
+ }
+
+ &__reset {
+ font-size: var(--font-down-1);
+ color: var(--primary-medium);
+ }
+}
+
+.rename-passkey__message {
+ max-width: 500px;
+ margin-bottom: 2em;
+}
+
+@include viewport.from(sm) {
+ .flag-modal-body .flag-message {
+ height: 3em;
+ }
+
+ .choose-topic-modal {
+ #choosing-topic {
+ // prevents content from moving when user selects different move options 525px
+ width: 525px;
+
+ p {
+ margin-top: 0;
+ }
+
+ .radios {
+ margin-bottom: 10px;
+ display: flex;
+ flex-direction: row;
+
+ .radio-label {
+ display: inline-block;
+ padding-right: 15px;
+ }
+ }
+
+ button {
+ margin-top: 10px;
+ display: block;
+ }
+
+ form {
+ width: 95%;
+ margin-top: 20px;
+
+ .participant-selector {
+ width: 100%;
+ }
+
+ div.ac-wrap {
+ width: 100%;
+ margin-bottom: 9px;
+ }
+ }
+ }
+ }
+
+ .create-invite-modal,
+ .create-invite-bulk-modal,
+ .share-topic-modal {
+ .title {
+ align-items: center;
+ display: flex;
+
+ .subtitle {
+ margin-left: 0.5em;
+ }
+ }
+
+ .alert-error {
+ label {
+ display: inline-block;
+ }
+ }
+ }
+}
+
+.create-invite-modal {
+ .edit-link-options {
+ text-align: left;
+ }
+}
+
+.wrap-attributes-modal {
+ .wrap-modal__attribute-row {
+ display: flex;
+ gap: var(--space-2);
+
+ .form-kit__field {
+ flex: 1;
+ }
+
+ .btn {
+ align-self: end;
+ }
+ }
+
+ &__unwrap {
+ margin-left: auto;
+ }
+}
+
+.permanently-delete-confirm-modal {
+ .d-modal__footer .btn-danger {
+ white-space: normal;
+ text-align: left;
+ }
+
+ &.--fire-easter-egg-modal {
+ .d-modal__container {
+ background-color: transparent;
+ color: white;
+
+ .confirmation-phrase {
+ z-index: 100000;
+ }
+ }
+ }
+
+ &__message {
+ margin-bottom: var(--space-4);
+ }
+
+ &__instruction {
+ display: flex;
+ flex-direction: column;
+ gap: 0.5em;
+
+ .confirmation-phrase {
+ width: 100%;
+ margin: 0;
+ }
+ }
+
+ --glitter: url("/images/firenoise.png");
+
+ .fire-easter-egg::before,
+ .fire-easter-egg::after {
+ content: "";
+ position: absolute;
+ inset: 0;
+ }
+
+ .fire-easter-egg::before {
+ content: "";
+ background-image:
+ var(--glitter), var(--glitter),
+ linear-gradient(
+ 0deg,
+ white 0,
+ #ff8951 5px,
+ #dcbc169c 30%,
+ transparent 70%
+ ),
+ radial-gradient(ellipse at bottom, transparent 30%, black 60%);
+ background-size:
+ 350px 500px,
+ 400px 650px,
+ 100% 100%,
+ 100% 100%;
+ background-blend-mode: hard-light, color-dodge, multiply;
+ background-position:
+ 0 0,
+ 0 0,
+ var(--gradientPos);
+ background-repeat: repeat, repeat, repeat, no-repeat;
+ mix-blend-mode: color-dodge;
+ filter: brightness(3.7) blur(7px) contrast(6);
+ animation: fire-easter-egg 1.75s linear infinite;
+ box-shadow: inset 0 -40px 50px -60px #63bbc5;
+ }
+
+ @keyframes fire-easter-egg {
+ 0% {
+ background-position:
+ center 0,
+ center 0,
+ 50% 100%,
+ center center;
+ }
+
+ 100% {
+ background-position:
+ center -500px,
+ center -650px,
+ 50% 100%,
+ center center;
+ }
+ }
+}
+
+.d-modal.has-tabs {
+ .modal-tabs {
+ display: inline-flex;
+ flex-wrap: wrap;
+ flex: 1 0 auto;
+ margin: 0;
+
+ .modal-tab {
+ list-style: none;
+ padding: 4px 8px;
+ margin-right: 4px;
+ cursor: pointer;
+
+ &.is-active {
+ color: var(--secondary);
+ background: var(--danger);
+
+ &.single-tab {
+ background: none;
+ color: var(--primary);
+ padding: 0;
+ font-size: var(--font-up-3);
+ font-weight: bold;
+ }
+ }
+ }
+ }
+}
+
+.d-modal:not(.has-tabs) {
+ .modal-tab {
+ position: absolute;
+ width: 95%;
+ }
+}
diff --git a/app/assets/stylesheets/common/modal/user-status.scss b/app/assets/stylesheets/common/modal/user-status.scss
index 39fbcd26a15..f0ad04f3da1 100644
--- a/app/assets/stylesheets/common/modal/user-status.scss
+++ b/app/assets/stylesheets/common/modal/user-status.scss
@@ -1,4 +1,4 @@
-.user-status.modal {
+.user-status.d-modal {
.d-modal {
&__footer {
.delete-status {
diff --git a/frontend/discourse/admin/components/modal/install-theme.gjs b/frontend/discourse/admin/components/modal/install-theme.gjs
index d6baaf16cc3..162a2a63353 100644
--- a/frontend/discourse/admin/components/modal/install-theme.gjs
+++ b/frontend/discourse/admin/components/modal/install-theme.gjs
@@ -284,7 +284,7 @@ export default class InstallThemeModal extends Component {
<template>
<DModal
@bodyClass="install-theme"
- class="admin-install-theme-modal -large"
+ class="admin-install-theme-modal --large"
@title={{i18n "admin.customize.theme.install"}}
@closeModal={{@closeModal}}
>
diff --git a/frontend/discourse/app/components/modal/create-invite-bulk.gjs b/frontend/discourse/app/components/modal/create-invite-bulk.gjs
index e1e5664c82c..0af8e72f374 100644
--- a/frontend/discourse/app/components/modal/create-invite-bulk.gjs
+++ b/frontend/discourse/app/components/modal/create-invite-bulk.gjs
@@ -9,7 +9,7 @@ const CreateInviteBulk = <template>
<CreateInviteUploader @autoFindInput={{false}} as |uploader setElement|>
<DModal
@title={{i18n "user.invited.bulk_invite.text"}}
- class="create-invite-bulk-modal -large"
+ class="create-invite-bulk-modal --large"
@closeModal={{@closeModal}}
>
<:body>
diff --git a/frontend/discourse/app/components/modal/fullscreen-code.gjs b/frontend/discourse/app/components/modal/fullscreen-code.gjs
index c50576f9e34..03f1d645ace 100644
--- a/frontend/discourse/app/components/modal/fullscreen-code.gjs
+++ b/frontend/discourse/app/components/modal/fullscreen-code.gjs
@@ -38,7 +38,7 @@ export default class FullscreenCode extends Component {
@title={{i18n "copy_codeblock.view_code"}}
@closeModal={{this.closeModal}}
{{didInsert this.applyCodeblockButtons}}
- class="fullscreen-code-modal -max"
+ class="fullscreen-code-modal --max"
>
<:body>
<PluginOutlet
diff --git a/frontend/discourse/app/components/modal/fullscreen-table.gjs b/frontend/discourse/app/components/modal/fullscreen-table.gjs
index 96e86cc2fd0..89c969e1b17 100644
--- a/frontend/discourse/app/components/modal/fullscreen-table.gjs
+++ b/frontend/discourse/app/components/modal/fullscreen-table.gjs
@@ -5,7 +5,7 @@ const FullscreenTable = <template>
<DModal
@title={{i18n "fullscreen_table.view_table"}}
@closeModal={{@closeModal}}
- class="fullscreen-table-modal -max"
+ class="fullscreen-table-modal --max"
>
<:body>
{{@model.tableHtml}}
diff --git a/frontend/discourse/app/components/modal/history.gjs b/frontend/discourse/app/components/modal/history.gjs
index 68eb15ac664..af68f1c9422 100644
--- a/frontend/discourse/app/components/modal/history.gjs
+++ b/frontend/discourse/app/components/modal/history.gjs
@@ -387,7 +387,8 @@ export default class History extends Component {
<DModal
@title={{i18n this.modalTitleKey}}
@closeModal={{@closeModal}}
- class="history-modal -max {{concat '--mode-' (dDasherize this.viewMode)}}"
+ class="history-modal --max
+ {{concat '--mode-' (dDasherize this.viewMode)}}"
>
<:body>
{{#if this.error}}
diff --git a/frontend/discourse/app/components/modal/keyboard-shortcuts-help.gjs b/frontend/discourse/app/components/modal/keyboard-shortcuts-help.gjs
index 050a5742c70..e5c272de610 100644
--- a/frontend/discourse/app/components/modal/keyboard-shortcuts-help.gjs
+++ b/frontend/discourse/app/components/modal/keyboard-shortcuts-help.gjs
@@ -509,7 +509,7 @@ export default class KeyboardShortcutsHelp extends Component {
<DModal
@title={{i18n "keyboard_shortcuts_help.title"}}
@closeModal={{@closeModal}}
- class="keyboard-shortcuts-modal -max"
+ class="keyboard-shortcuts-modal --max"
>
<:body>
<div id="keyboard-shortcuts-help">
diff --git a/frontend/discourse/app/components/sidebar/edit-navigation-menu/modal.gjs b/frontend/discourse/app/components/sidebar/edit-navigation-menu/modal.gjs
index 2d22278e04e..1da88b34e32 100644
--- a/frontend/discourse/app/components/sidebar/edit-navigation-menu/modal.gjs
+++ b/frontend/discourse/app/components/sidebar/edit-navigation-menu/modal.gjs
@@ -51,7 +51,7 @@ export default class SidebarEditNavigationMenuModal extends Component {
<DModal
@title={{i18n @title}}
@closeModal={{@closeModal}}
- class="sidebar__edit-navigation-menu__modal -large"
+ class="sidebar__edit-navigation-menu__modal --large"
...attributes
>
<:belowModalTitle>
diff --git a/frontend/discourse/app/ui-kit/d-modal.gjs b/frontend/discourse/app/ui-kit/d-modal.gjs
index 42f1d603a87..e34a7f58430 100644
--- a/frontend/discourse/app/ui-kit/d-modal.gjs
+++ b/frontend/discourse/app/ui-kit/d-modal.gjs
@@ -337,9 +337,7 @@ export default class DModal extends Component {
{{/unless}}
<this.dynamicElement
class={{dConcatClass
- "modal"
- "d-modal"
- (if @inline "-inline")
+ "modal d-modal"
(if this.animating "is-animating")
}}
data-keyboard="false"
diff --git a/frontend/discourse/tests/acceptance/composer-test.js b/frontend/discourse/tests/acceptance/composer-test.js
index 997a5f4795b..bcea32ed0cd 100644
--- a/frontend/discourse/tests/acceptance/composer-test.js
+++ b/frontend/discourse/tests/acceptance/composer-test.js
@@ -373,7 +373,7 @@ acceptance(`Composer`, function (needs) {
await click(".topic-post[data-post-number='1'] button.edit");
await click(".d-modal__footer .discard-draft-modal__cancel-btn");
- assert.dom(".discard-draft-modal.modal").doesNotExist();
+ assert.dom(".discard-draft-modal.d-modal").doesNotExist();
assert
.dom(".d-editor-input")
.hasValue(
@@ -383,7 +383,7 @@ acceptance(`Composer`, function (needs) {
await click(".topic-post[data-post-number='1'] button.edit");
await click(".d-modal__footer .discard-draft-modal__discard-btn");
- assert.dom(".discard-draft-modal.modal").doesNotExist();
+ assert.dom(".discard-draft-modal.d-modal").doesNotExist();
assert
.dom(".d-editor-input")
@@ -401,10 +401,10 @@ acceptance(`Composer`, function (needs) {
await visit("/t/this-is-a-test-topic/9");
await click("#topic-footer-buttons .create");
- assert.dom(".discard-draft-modal.modal").exists();
+ assert.dom(".discard-draft-modal.d-modal").exists();
await click(".d-modal__footer .discard-draft-modal__cancel-btn");
- assert.dom(".discard-draft-modal.modal").doesNotExist();
+ assert.dom(".discard-draft-modal.d-modal").doesNotExist();
assert
.dom(".d-editor-input")
@@ -462,14 +462,16 @@ acceptance(`Composer`, function (needs) {
);
await click("#topic-footer-buttons .btn.create");
assert
- .dom(".discard-draft-modal.modal")
+ .dom(".discard-draft-modal.d-modal")
.exists("pops up the discard drafts modal");
await click(".d-modal__footer .discard-draft-modal__cancel-btn");
- assert.dom(".discard-draft-modal.modal").doesNotExist("hides modal");
+ assert.dom(".discard-draft-modal.d-modal").doesNotExist("hides modal");
await click("#topic-footer-buttons .btn.create");
- assert.dom(".discard-draft-modal.modal").exists("pops up the modal again");
+ assert
+ .dom(".discard-draft-modal.d-modal")
+ .exists("pops up the modal again");
await click(".d-modal__footer .discard-draft-modal__discard-btn");
@@ -505,12 +507,12 @@ acceptance(`Composer`, function (needs) {
await click("#reply-control .discard-button");
assert
- .dom(".discard-draft-modal.modal")
+ .dom(".discard-draft-modal.d-modal")
.exists("shows Discard draft confirmation modal");
await click(".d-modal__footer .discard-draft-modal__cancel-btn");
assert
- .dom(".discard-draft-modal.modal")
+ .dom(".discard-draft-modal.d-modal")
.doesNotExist("hides modal on Cancel button click");
assert
.dom(".d-editor-input")
@@ -528,12 +530,12 @@ acceptance(`Composer`, function (needs) {
await click("#reply-control .discard-button");
assert
- .dom(".discard-draft-modal.modal")
+ .dom(".discard-draft-modal.d-modal")
.exists("pops up the discard drafts modal");
await triggerKeyEvent(".discard-draft-modal", "keydown", "Escape");
assert
- .dom(".discard-draft-modal.modal")
+ .dom(".discard-draft-modal.d-modal")
.doesNotExist("hides modal on Esc key stroke");
await fillIn(
@@ -681,7 +683,7 @@ acceptance(`Composer`, function (needs) {
await fillIn(".d-editor-input", "This is a dirty reply");
await click(".topic-post[data-post-number='2'] button.edit");
assert
- .dom(".discard-draft-modal.modal")
+ .dom(".discard-draft-modal.d-modal")
.exists("pops up a confirmation dialog");
await click(".d-modal__footer .discard-draft-modal__discard-btn");
@@ -949,7 +951,7 @@ acceptance(`Composer`, function (needs) {
await click(".toggler");
await click(".topic-post[data-post-number='2'] button.edit");
assert
- .dom(".discard-draft-modal.modal")
+ .dom(".discard-draft-modal.d-modal")
.exists("pops up a confirmation dialog");
assert
.dom(".d-modal__footer .discard-draft-modal__cancel-btn")
@@ -973,7 +975,7 @@ acceptance(`Composer`, function (needs) {
await click("#create-topic");
assert
- .dom(".discard-draft-modal.modal")
+ .dom(".discard-draft-modal.d-modal")
.exists("pops up a confirmation dialog");
assert
.dom(".d-modal__footer .discard-draft-modal__discard-btn")
diff --git a/frontend/discourse/tests/acceptance/user-preferences-second-factor-test.js b/frontend/discourse/tests/acceptance/user-preferences-second-factor-test.js
index af8d1a27273..4ff1e3886d1 100644
--- a/frontend/discourse/tests/acceptance/user-preferences-second-factor-test.js
+++ b/frontend/discourse/tests/acceptance/user-preferences-second-factor-test.js
@@ -67,9 +67,9 @@ acceptance("User Preferences - Second Factor", function (needs) {
await click(".new-totp");
assert.dom(".qr-code img").exists("shows qr code image");
- await click(".modal a.show-second-factor-key");
+ await click(".d-modal a.show-second-factor-key");
assert
- .dom(".modal .second-factor-key")
+ .dom(".d-modal .second-factor-key")
.exists("displays second factor key");
await click(".add-totp");
diff --git a/plugins/discourse-local-dates/assets/javascripts/discourse/components/modal/local-dates-create.gjs b/plugins/discourse-local-dates/assets/javascripts/discourse/components/modal/local-dates-create.gjs
index 10c78dfb8cd..1fad444c294 100644
--- a/plugins/discourse-local-dates/assets/javascripts/discourse/components/modal/local-dates-create.gjs
+++ b/plugins/discourse-local-dates/assets/javascripts/discourse/components/modal/local-dates-create.gjs
@@ -418,7 +418,7 @@ export default class LocalDatesCreate extends Component {
<DModal
@title={{i18n "discourse_local_dates.title"}}
@closeModal={{@closeModal}}
- class="discourse-local-dates-create-modal -large"
+ class="discourse-local-dates-create-modal --large"
>
<:body>
<div class="form">
diff --git a/plugins/poll/assets/stylesheets/common/poll-breakdown.scss b/plugins/poll/assets/stylesheets/common/poll-breakdown.scss
index 9472244b7e9..256b6e6ae66 100644
--- a/plugins/poll/assets/stylesheets/common/poll-breakdown.scss
+++ b/plugins/poll/assets/stylesheets/common/poll-breakdown.scss
@@ -1,4 +1,4 @@
-.poll-breakdown.modal {
+.poll-breakdown.d-modal {
.modal-tabs {
justify-content: flex-end;
}
diff --git a/plugins/poll/assets/stylesheets/desktop/poll-ui-builder.scss b/plugins/poll/assets/stylesheets/desktop/poll-ui-builder.scss
index 374a309cc2b..57f61cc913c 100644
--- a/plugins/poll/assets/stylesheets/desktop/poll-ui-builder.scss
+++ b/plugins/poll/assets/stylesheets/desktop/poll-ui-builder.scss
@@ -1,4 +1,4 @@
-.poll-ui-builder.modal {
+.poll-ui-builder.d-modal {
.poll-number {
margin-right: 10px;
diff --git a/plugins/styleguide/assets/javascripts/discourse/components/sections/organisms/modal.gjs b/plugins/styleguide/assets/javascripts/discourse/components/sections/organisms/modal.gjs
index 3b26d1dedde..af283215a84 100644
--- a/plugins/styleguide/assets/javascripts/discourse/components/sections/organisms/modal.gjs
+++ b/plugins/styleguide/assets/javascripts/discourse/components/sections/organisms/modal.gjs
@@ -7,6 +7,7 @@ import { action } from "@ember/object";
import withEventValue from "discourse/helpers/with-event-value";
import { getLoadedFaker } from "discourse/lib/load-faker";
import ComboBox from "discourse/select-kit/components/combo-box";
+import DButton from "discourse/ui-kit/d-button";
import DModal from "discourse/ui-kit/d-modal";
import DToggleSwitch from "discourse/ui-kit/d-toggle-switch";
import { i18n } from "discourse-i18n";
@@ -16,7 +17,7 @@ import Row from "discourse/plugins/styleguide/discourse/components/styleguide/co
import StyleguideExample from "discourse/plugins/styleguide/discourse/components/styleguide-example";
export default class extends Component {
- @tracked inline = true;
+ @tracked open = false;
@tracked hideHeader = false;
@tracked dismissable = true;
@tracked modalTagName = "div";
@@ -34,22 +35,9 @@ export default class extends Component {
this.hideHeader = !this.hideHeader;
}
- @action
- toggleInline() {
- this.inline = !this.inline;
- if (!this.inline) {
- // Make sure there is a way to dismiss the modal
- this.dismissable = true;
- }
- }
-
@action
toggleDismissable() {
this.dismissable = !this.dismissable;
- if (!this.dismissable) {
- // Make sure there is a way to dismiss the modal
- this.inline = true;
- }
}
@action
@@ -57,30 +45,46 @@ export default class extends Component {
this.showFooter = !this.showFooter;
}
+ @action
+ openModal() {
+ this.open = true;
+ }
+
+ @action
+ closeModal() {
+ this.open = false;
+ }
+
<template>
{{! eslint-disable ember/template-no-potential-path-strings }}
<StyleguideExample @title="<DModal>">
<StyleguideComponent>
- <DModal
- @closeModal={{fn (mut this.inline) true}}
- @hideHeader={{this.hideHeader}}
- @inline={{this.inline}}
- @title={{this.title}}
- @subtitle={{this.subtitle}}
- @flash={{this.flash}}
- @flashType={{this.flashType}}
- @errors={{this.errors}}
- @dismissable={{this.dismissable}}
- >
- <:body>
- {{this.body}}
- </:body>
+ <DButton
+ @label="styleguide.sections.modal.open"
+ @action={{this.openModal}}
+ />
+
+ {{#if this.open}}
+ <DModal
+ @closeModal={{this.closeModal}}
+ @hideHeader={{this.hideHeader}}
+ @title={{this.title}}
+ @subtitle={{this.subtitle}}
+ @flash={{this.flash}}
+ @flashType={{this.flashType}}
+ @errors={{this.errors}}
+ @dismissable={{this.dismissable}}
+ >
+ <:body>
+ {{this.body}}
+ </:body>
- <:footer>
- {{i18n "styleguide.sections.modal.footer"}}
- </:footer>
- </DModal>
+ <:footer>
+ {{i18n "styleguide.sections.modal.footer"}}
+ </:footer>
+ </DModal>
+ {{/if}}
</StyleguideComponent>
<Controls>
@@ -90,12 +94,6 @@ export default class extends Component {
{{on "click" this.toggleHeader}}
/>
</Row>
- <Row @name="@inline">
- <DToggleSwitch
- @state={{this.inline}}
- {{on "click" this.toggleInline}}
- />
- </Row>
<Row @name="@dismissable">
<DToggleSwitch
@state={{this.dismissable}}
diff --git a/plugins/styleguide/config/locales/client.en.yml b/plugins/styleguide/config/locales/client.en.yml
index 93bcd117123..fd6bd9affe0 100644
--- a/plugins/styleguide/config/locales/client.en.yml
+++ b/plugins/styleguide/config/locales/client.en.yml
@@ -97,6 +97,7 @@ en:
title: "Modal"
header: "Modal Title"
footer: "Modal Footer"
+ open: "Open modal"
user_about:
title: "User About Box"
header_icons:
diff --git a/spec/system/admin_site_texts_spec.rb b/spec/system/admin_site_texts_spec.rb
index 31ce378f528..032e3a7ab7c 100644
--- a/spec/system/admin_site_texts_spec.rb
+++ b/spec/system/admin_site_texts_spec.rb
@@ -123,7 +123,7 @@ describe "Admin Site Texts Page" do
site_texts_page.visit
site_texts_page.click_replace_text_button
- expect(page.all(".modal label span").map(&:text)).to eq(["Uncategorized"])
+ expect(page.all(".d-modal label span").map(&:text)).to eq(["Uncategorized"])
end
it "can load more results" do
diff --git a/spec/system/page_objects/modals/base.rb b/spec/system/page_objects/modals/base.rb
index cc26e14f8ac..32b30c2dbac 100644
--- a/spec/system/page_objects/modals/base.rb
+++ b/spec/system/page_objects/modals/base.rb
@@ -23,7 +23,7 @@ module PageObjects
end
def full_modal_selector
- ".modal.d-modal#{@modal_selector}"
+ ".d-modal#{@modal_selector}"
end
def footer_selector
diff --git a/spec/system/page_objects/modals/delete_themes_confirm.rb b/spec/system/page_objects/modals/delete_themes_confirm.rb
index ced9e6bf6c1..94c1eb91adb 100644
--- a/spec/system/page_objects/modals/delete_themes_confirm.rb
+++ b/spec/system/page_objects/modals/delete_themes_confirm.rb
@@ -4,7 +4,7 @@ module PageObjects
module Modals
class DeleteThemesConfirm < PageObjects::Pages::Base
def has_theme?(name)
- has_css?(".modal li", text: name)
+ has_css?(".d-modal li", text: name)
end
def confirm
diff --git a/spec/system/page_objects/modals/discard_draft.rb b/spec/system/page_objects/modals/discard_draft.rb
index a3eeda1cec8..e90964b5d79 100644
--- a/spec/system/page_objects/modals/discard_draft.rb
+++ b/spec/system/page_objects/modals/discard_draft.rb
@@ -5,11 +5,11 @@ module PageObjects
MODAL_SELECTOR = ".discard-draft-modal"
def open?
- has_css?(".modal.d-modal#{MODAL_SELECTOR}")
+ has_css?(".d-modal#{MODAL_SELECTOR}")
end
def closed?
- has_no_css?(".modal.d-modal#{MODAL_SELECTOR}")
+ has_no_css?(".d-modal#{MODAL_SELECTOR}")
end
def click_discard
diff --git a/spec/system/page_objects/modals/sidebar_section_form.rb b/spec/system/page_objects/modals/sidebar_section_form.rb
index 9b7a5896924..b10f9d994d9 100644
--- a/spec/system/page_objects/modals/sidebar_section_form.rb
+++ b/spec/system/page_objects/modals/sidebar_section_form.rb
@@ -23,7 +23,7 @@ module PageObjects
end
def mark_as_public
- find(".modal .mark-public").click
+ find(".d-modal .mark-public").click
end
def remove_last_link
diff --git a/spec/system/page_objects/pages/topic.rb b/spec/system/page_objects/pages/topic.rb
index bef95d9ea4e..13a47225cef 100644
--- a/spec/system/page_objects/pages/topic.rb
+++ b/spec/system/page_objects/pages/topic.rb
@@ -399,7 +399,7 @@ module PageObjects
end
def move_to_public_modal
- find(".modal.convert-to-public-topic")
+ find(".d-modal.convert-to-public-topic")
end
def has_no_flag_button?