Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

settings: Change modal sidebar collapse breakpoint to use em and @container.

evykassirer9bf2a8e3179c
diff --git a/web/src/css_variables.ts b/web/src/css_variables.ts
index 39f36c388f3..9f2dd774455 100644
--- a/web/src/css_variables.ts
+++ b/web/src/css_variables.ts
@@ -37,6 +37,11 @@ export const media_breakpoints = {
cb4_min: cb4 + "px",
cb5_min: cb5 + "px",
short_navbar_cutoff_height: "600px",
+ // Used for main settings overlay and stream/subscription settings overlay
+ // measured as the width of the overlay itself, not the width of the full
+ // screen. 800px is the breakpoint at the 14px legacy font size, scaled with
+ // em to user-chosen font-size.
+ settings_overlay_sidebar_collapse_breakpoint: 800 / 14 + "em",
};
export const media_breakpoints_num = {
diff --git a/web/styles/settings.css b/web/styles/settings.css
index 2260c6b7c6c..adf47f1753f 100644
--- a/web/styles/settings.css
+++ b/web/styles/settings.css
@@ -1326,25 +1326,23 @@ label.preferences-radio-choice-label {
background-color: var(--color-background-modal-bar);
border-bottom: 1px solid var(--color-border-modal-bar);
- @media (width >= $md_min) {
- .tab-switcher {
- display: flex;
+ .tab-switcher {
+ display: flex;
+
+ .ind-tab {
+ width: auto;
+ }
+ }
- .ind-tab {
- width: auto;
- min-width: 6.7857em; /* 95px at 14px em */
- }
+ @container settings-overlay (width >= $settings_overlay_sidebar_collapse_breakpoint) {
+ .tab-switcher .ind-tab {
+ min-width: 6.7857em; /* 95px at 14px em */
}
}
- @media (width < $md_min) {
+ @container settings-overlay (width < $settings_overlay_sidebar_collapse_breakpoint) {
.tab-switcher {
- display: flex;
justify-content: center;
-
- .ind-tab {
- width: auto;
- }
}
}
}
@@ -1780,7 +1778,7 @@ label.preferences-radio-choice-label {
/* This value needs to match with the same in subscriptions.css, as
we have some shared styles declared there */
-@media (width < $md_min) {
+@container settings-overlay (width < $settings_overlay_sidebar_collapse_breakpoint) {
.profile-settings-form {
.user-avatar-section {
flex: 100%;
@@ -1855,7 +1853,7 @@ label.preferences-radio-choice-label {
}
}
-@media (width > $md_min) {
+@container (width > $settings_overlay_sidebar_collapse_breakpoint) {
#attachments-settings .upload-file-name {
min-width: 10em;
}
diff --git a/web/styles/subscriptions.css b/web/styles/subscriptions.css
index cf90a628c0d..7c129dfd19e 100644
--- a/web/styles/subscriptions.css
+++ b/web/styles/subscriptions.css
@@ -775,6 +775,12 @@ h4.user_group_setting_subsection_title {
}
}
+#settings_page,
+#groups_overlay,
+#subscription_overlay {
+ container: settings-overlay / inline-size;
+}
+
#groups_overlay,
#subscription_overlay {
.tab-switcher {
@@ -821,7 +827,7 @@ h4.user_group_setting_subsection_title {
border-top: 1px solid var(--color-border-modal-bar);
}
- @media (width > $md_min) {
+ @container settings-overlay (width > $settings_overlay_sidebar_collapse_breakpoint) {
.settings-sticky-footer {
border-radius: 0 0 6px;
}
@@ -1274,7 +1280,7 @@ div.settings-radio-input-parent {
Longer-term we should extract this logic two-column-overlay class
to read more naturally. */
-@media (width < $md_min) {
+@container settings-overlay (width < $settings_overlay_sidebar_collapse_breakpoint) {
.user-groups-container,
.subscriptions-container {
position: relative;