Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Refine styles of menus, toasts, popovers, and modals #12332

Merged
merged 5 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
robintown marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 15 additions & 19 deletions res/css/_common.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,21 @@ legend {
justify-content: center;
}

.mx_Dialog_border {
z-index: var(--dialog-zIndex-standard);
position: relative;
max-height: calc(100% - var(--cpd-space-12x));
display: flex;
flex-direction: column;
}

.mx_Dialog {
background-color: $background;
color: $light-fg-color;
z-index: var(--dialog-zIndex-standard);
font-size: $font-15px;
position: relative;
padding: 24px;
max-height: 80%;
box-shadow: 2px 15px 30px 0 $dialog-shadow-color;
border-radius: 8px;
padding: var(--cpd-space-8x) var(--cpd-space-10x);
box-sizing: border-box;
overflow-y: auto;

.mx_Dialog_staticWrapper & {
Expand Down Expand Up @@ -439,7 +444,6 @@ legend {
width: 100%;
height: 100%;
background-color: $dialog-backdrop-color;
opacity: 0.8;
z-index: var(--dialog-zIndex-standard-background);

&.mx_Dialog_staticBackground {
Expand Down Expand Up @@ -483,21 +487,13 @@ legend {

.mx_Dialog_header {
position: relative;
padding: 3px 0;
margin-bottom: 10px;
padding: 0;
padding-inline-end: 20px; /* Reserve room for the close button */
margin-bottom: var(--cpd-space-2x);

&.mx_Dialog_headerWithButton > .mx_Dialog_title {
text-align: center;
}

&.mx_Dialog_headerWithCancel {
padding-right: 20px; /* leave space for the 'X' cancel button */
}

&.mx_Dialog_headerWithCancelOnly {
padding: 0 20px 0 0;
margin: 0;
}
}

@define-mixin customisedCancelButton {
Expand Down Expand Up @@ -528,8 +524,8 @@ legend {
.mx_Dialog_cancelButton {
@mixin customisedCancelButton;
position: absolute;
top: 4px;
right: 0;
top: var(--cpd-space-4x);
right: var(--cpd-space-4x);
}

.mx_Dialog_content {
Expand Down
7 changes: 4 additions & 3 deletions res/css/structures/_ContextualMenu.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ limitations under the License.
}

.mx_ContextualMenu {
border-radius: 8px;
box-shadow: 4px 4px 12px 0 $menu-box-shadow-color;
background-color: $menu-bg-color;
border-radius: 12px;
box-shadow: 0px 4px 24px rgba(0, 0, 0, 0.1);
background-color: var(--cpd-color-bg-canvas-default);
border: var(--cpd-border-width-1) solid var(--cpd-color-border-interactive-secondary);
color: $primary-content;
position: absolute;
z-index: 5001;
Expand Down
8 changes: 4 additions & 4 deletions res/css/structures/_QuickSettingsButton.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ limitations under the License.
font-weight: var(--cpd-font-weight-semibold);
font-size: $font-15px;
line-height: $font-24px;
color: $primary-content;
color: var(--cpd-color-text-secondary);
margin: 0 0 16px;
}

Expand All @@ -76,7 +76,7 @@ limitations under the License.
font-size: $font-12px;
line-height: $font-15px;
text-transform: uppercase;
color: $tertiary-content;
color: var(--cpd-color-text-secondary);
margin: 20px 0 12px;
}

Expand All @@ -97,7 +97,7 @@ limitations under the License.
margin-left: 6px;
font-size: $font-15px;
line-height: $font-24px;
color: $secondary-content;
color: var(--cpd-color-text-primary);
}
}

Expand All @@ -106,7 +106,7 @@ limitations under the License.
margin-left: 22px;
font-size: $font-15px;
line-height: $font-24px;
color: $secondary-content;
color: var(--cpd-color-text-primary);
position: relative;
margin-bottom: 16px;
}
Expand Down
2 changes: 1 addition & 1 deletion res/css/structures/_TabbedView.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ limitations under the License.

.mx_TabbedView {
margin: 0;
padding: 0 0 0 16px;
padding: 0 0 0 var(--cpd-space-8x);
display: flex;
flex-direction: column;
inset: 0;
Expand Down
9 changes: 5 additions & 4 deletions res/css/structures/_ToastContainer.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ limitations under the License.
.mx_Toast_toast {
grid-row: 1 / 3;
grid-column: 1;
background-color: $system;
background-color: var(--cpd-color-bg-canvas-default);
color: $primary-content;
box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.5);
border-radius: 8px;
box-shadow: 0px 4px 24px rgba(0, 0, 0, 0.1);
border: var(--cpd-border-width-1) solid var(--cpd-color-border-interactive-secondary);
border-radius: 12px;
overflow: hidden;
display: grid;
grid-template-columns: 22px 1fr;
column-gap: 8px;
row-gap: 4px;
padding: 8px;
padding: var(--cpd-space-3x);

&.mx_Toast_hasIcon {
&::before,
Expand Down
29 changes: 5 additions & 24 deletions res/css/views/context_menus/_IconizedContextMenu.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,7 @@ limitations under the License.
/* the notFirst class is for cases where the optionList might be under a header of sorts. */
&:nth-child(n + 2),
.mx_IconizedContextMenu_optionList_notFirst {
/* This is a bit of a hack when we could just use a simple border-top property, */
/* however we have a (kinda) good reason for doing it this way: we need opacity. */
/* To get the right color, we need an opacity modifier which means we have to work */
/* around the problem. PostCSS doesn't support the opacity() function, and if we */
/* use something like postcss-functions we quickly run into an issue where the */
/* function we would define gets passed a CSS variable for custom themes, which */
/* can't be converted easily even when considering https://stackoverflow.com/a/41265350/7037379 */
//
/* Therefore, we just hack in a line and border the thing ourselves */
&::before {
border-top: 1px solid $primary-content;
opacity: 0.1;
content: "";

/* Counteract the padding problems (width: 100% ignores the 40px padding, */
/* unless we position it absolutely then it does the right thing). */
width: 100%;
position: absolute;
left: 0;
}
border-top: var(--cpd-border-width-1) solid var(--cpd-color-gray-400);
}

/* round the top corners of the top button for the hover effect to be bounded */
Expand Down Expand Up @@ -87,7 +68,7 @@ limitations under the License.

&:hover,
&:focus-visible {
background-color: $menu-selected-color;
background-color: var(--cpd-color-bg-action-secondary-hovered);
}

&.mx_AccessibleButton_disabled {
Expand Down Expand Up @@ -137,7 +118,7 @@ limitations under the License.
mask-position: center;
mask-size: contain;
mask-repeat: no-repeat;
background-color: $icon-button-color;
background-color: var(--cpd-color-icon-primary);
}
}

Expand All @@ -147,7 +128,7 @@ limitations under the License.
}

.mx_IconizedContextMenu_icon::before {
background-color: $alert;
background-color: var(--cpd-color-icon-critical-primary);
}
}

Expand All @@ -172,7 +153,7 @@ limitations under the License.

&.mx_IconizedContextMenu_compact {
.mx_IconizedContextMenu_optionList > * {
padding: 8px 16px 8px 11px;
padding: 8px 16px 8px 12px;
}
}

Expand Down
1 change: 0 additions & 1 deletion res/css/views/context_menus/_MessageContextMenu.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ limitations under the License.
mask-position: center;
mask-size: contain;
mask-repeat: no-repeat;
background: $icon-button-color;
}
}

Expand Down
16 changes: 8 additions & 8 deletions res/css/views/dialogs/_CompoundDialog.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
/* -------------------------------------------------------------------------------- */

/* Override legacy/default styles for dialogs */
.mx_Dialog_wrapper.mx_CompoundDialog > .mx_Dialog {
.mx_Dialog_wrapper.mx_CompoundDialog .mx_Dialog {
padding: 0; /* we'll manage it ourselves */
color: $primary-content;
}
Expand All @@ -41,14 +41,14 @@ limitations under the License.
font-size: $font-24px;
margin: 0; /* managed by header class */
}
}

.mx_CompoundDialog_cancelButton {
@mixin customisedCancelButton;
/* Align with middle of title, 30px from right edge */
position: absolute;
top: 30px;
right: 30px;
}
.mx_CompoundDialog_cancelButton {
@mixin customisedCancelButton;
/* Align with corner radius of dialog */
position: absolute;
top: var(--cpd-space-4x);
right: var(--cpd-space-4x);
}

.mx_CompoundDialog_form {
Expand Down
20 changes: 6 additions & 14 deletions res/css/views/dialogs/_LocationViewDialog.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ limitations under the License.

.mx_LocationViewDialog_wrapper .mx_Dialog {
padding: 0px;

/* Unset contain and position to allow the close button
to appear outside the dialog */
contain: unset;
position: unset;
}

.mx_LocationViewDialog {
Expand All @@ -37,16 +32,13 @@ limitations under the License.
.mx_Dialog_title {
display: none;
}
}

.mx_Dialog_cancelButton {
z-index: 4010;
position: absolute;
right: 5vw;
top: 5vh;
width: 20px;
height: 20px;
background-color: $dialog-close-external-color;
}
.mx_Dialog_cancelButton {
z-index: 4010;
position: absolute;
left: var(--cpd-space-4x);
top: var(--cpd-space-4x);
}
}

Expand Down
4 changes: 2 additions & 2 deletions res/css/views/dialogs/_SettingsDialog.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ limitations under the License.
.mx_SpaceSettingsDialog,
.mx_SpacePreferencesDialog {
width: 90vw;
max-width: 1000px;
max-width: 980px;
/* set the height too since tabbed view scrolls itself. */
height: 80vh;

.mx_TabbedView {
top: 65px;
top: 90px;
}

.mx_TabbedView .mx_SettingsTab {
Expand Down
70 changes: 39 additions & 31 deletions res/css/views/dialogs/_SpotlightDialog.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,46 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_SpotlightDialog_wrapper .mx_Dialog {
border-radius: 8px;
overflow-y: initial;
position: relative;
height: 60%;
padding: 0;
contain: unset; /* needed for #mx_SpotlightDialog_keyboardPrompt to not be culled */

#mx_SpotlightDialog_keyboardPrompt {
position: absolute;
padding: $spacing-8;
.mx_SpotlightDialog_wrapper {
.mx_Dialog_border {
/* Disable the glass border as this dialog wasn't designed with it in mind */
display: contents;
}

.mx_Dialog {
width: fit-content;
border-radius: 8px;
background-color: $background;
top: -60px; /* relative to the top of the modal */
left: 50%;
transform: translateX(-50%);
font-size: $font-12px;
line-height: $font-15px;
color: $secondary-content;

kbd {
display: inline-block;
padding: 2px $spacing-4;
margin: 0 $spacing-4;
border-radius: 6px;
background-color: $quinary-content;
vertical-align: middle;
color: $tertiary-content;
/* To avoid any styling inherent with <kbd> elements */
font-family: inherit;
font-weight: inherit;
font-size: inherit;
overflow-y: initial;
position: relative;
height: 60%;
padding: 0;
contain: unset; /* needed for #mx_SpotlightDialog_keyboardPrompt to not be culled */

#mx_SpotlightDialog_keyboardPrompt {
position: absolute;
padding: $spacing-8;
border-radius: 8px;
background-color: $background;
top: -60px; /* relative to the top of the modal */
left: 50%;
transform: translateX(-50%);
font-size: $font-12px;
line-height: $font-15px;
color: $secondary-content;

kbd {
display: inline-block;
padding: 2px $spacing-4;
margin: 0 $spacing-4;
border-radius: 6px;
background-color: $quinary-content;
vertical-align: middle;
color: $tertiary-content;
/* To avoid any styling inherent with <kbd> elements */
font-family: inherit;
font-weight: inherit;
font-size: inherit;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion res/css/views/dialogs/_TermsDialog.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ limitations under the License.
* terms dialog sizing when it will appear for the integration manager so that
* it gets the same basic size as the IM's own modal.
*/
.mx_TermsDialog_forIntegrationManager .mx_Dialog {
.mx_TermsDialog_forIntegrationManager .mx_Dialog_border {
width: 60%;
height: 70%;
box-sizing: border-box;
Expand Down
Loading
Loading