discourse/app/assets/stylesheets/desktop/modal.scss
chapoi f72899401d
UX: refactor .d-modal to use BEM and improve styling (#23967)
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`
2023-11-15 10:14:47 +00:00

144 lines
2.3 KiB
SCSS

.d-modal {
--modal-max-width: 600px;
--modal-width: 30em; // set in ems to scale with user font-size
--modal-min-width: 400px;
&__container {
max-width: var(--modal-max-width);
min-width: var(--modal-min-width);
.d-modal.-large & {
max-width: 800px;
}
.d-modal.-max & {
max-width: 90vw;
}
}
}
//legacy
// Hardcode to be the same as before for now. I would recommend not using bootbox, or finding a way so the html structure can be the same
.bootbox.modal {
top: 50%;
left: 50%;
width: 610px;
margin: -250px 0 0 -305px;
.cancel {
margin-left: 1em;
}
}
.modal.in {
animation: fade 0.25s;
@media (prefers-reduced-motion) {
animation-duration: 0s;
}
}
.modal-footer .btn.right {
float: right;
}
.modal-header {
h3 {
font-size: var(--font-up-3);
}
}
.close {
font-size: var(--font-up-3);
text-decoration: none;
&:visited {
color: var(--primary-high);
}
cursor: pointer;
&:hover {
color: var(--primary);
}
}
.modal {
.category-chooser {
width: 50%;
}
.modal-body.insert-link {
input {
min-width: 450px;
}
}
}
.choose-topic-modal {
.modal-body {
position: relative;
min-height: 350px;
}
#choosing-topic {
// prevents content from moving when user selects different move options 525px
// is the same width we set on category edit modal
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;
}
}
}
}
.change-post-notice-modal {
.modal-body {
min-width: 450px;
}
}
.create-invite-modal,
.create-invite-bulk-modal,
.share-topic-modal {
.title {
align-items: center;
display: flex;
.subtitle {
margin-left: 0.5em;
}
}
&.modal .modal-body {
margin: 1em;
padding: unset;
}
.modal-inner-container {
width: 40em; // scale with user font-size
max-width: 100vw; // prevent overflow if user font-size is enormous
}
}