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.

css: Improve the dialog_widget loading spinner visuals.

aparna-bhatt5189826f273d
diff --git a/static/js/dialog_widget.js b/static/js/dialog_widget.js
index a9277e8bfb9..792e2d8ee36 100644
--- a/static/js/dialog_widget.js
+++ b/static/js/dialog_widget.js
@@ -56,7 +56,12 @@ export function show_dialog_spinner() {
$("#dialog_widget_modal .modal__btn").prop("disabled", true);
const $spinner = $("#dialog_widget_modal .modal__spinner");
- loading.make_indicator($spinner);
+ const dialog_submit_button_span_width = $(".dialog_submit_button span").width();
+ const dialog_submit_button_span_height = $(".dialog_submit_button span").height();
+ loading.make_indicator($spinner, {
+ width: dialog_submit_button_span_width,
+ height: dialog_submit_button_span_height,
+ });
}
// Supports a callback to be called once the modal finishes closing.
diff --git a/static/js/loading.ts b/static/js/loading.ts
index fd77cc3bbf8..4eb4c2151c5 100644
--- a/static/js/loading.ts
+++ b/static/js/loading.ts
@@ -4,7 +4,12 @@ import render_loader from "../templates/loader.hbs";
export function make_indicator(
$outer_container: JQuery,
- {abs_positioned = false, text}: {abs_positioned?: boolean; text?: string} = {},
+ {
+ abs_positioned = false,
+ text,
+ width,
+ height,
+ }: {abs_positioned?: boolean; text?: string; width?: number; height?: number} = {},
): void {
let $container = $outer_container;
@@ -48,7 +53,16 @@ export function make_indicator(
// These width calculations are tied to the spinner width and
// margins defined via CSS
- $container.css({width: 38 + text_width, height: 0});
+ if (width !== undefined) {
+ $container.css({width: width + text_width});
+ } else {
+ $container.css({width: 38 + text_width});
+ }
+ if (height !== undefined) {
+ $container.css({height});
+ } else {
+ $container.css({height: 0});
+ }
$outer_container.data("destroying", false);
}
diff --git a/static/styles/modal.css b/static/styles/modal.css
index c77603811fc..35fe5dc3e52 100644
--- a/static/styles/modal.css
+++ b/static/styles/modal.css
@@ -95,7 +95,6 @@
transition: transform 0.25s ease-out;
&:disabled {
- background-color: hsl(0, 0%, 83%);
cursor: not-allowed;
}
}
@@ -286,3 +285,8 @@
fill: hsl(0, 0%, 100%);
}
}
+
+.modal__spinner {
+ display: flex;
+ justify-content: center;
+}