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.

timestamps: Consolidate variable-based timestamp width.

Karl Stolley09d710574784
diff --git a/web/styles/app_variables.css b/web/styles/app_variables.css
index 4eb3d9bd15c..a5fa575754b 100644
--- a/web/styles/app_variables.css
+++ b/web/styles/app_variables.css
@@ -69,6 +69,9 @@
--message-box-line-height: 1.214;
--message-box-icon-width: 26px;
--message-box-icon-height: 25px;
+ /* This width is updated with an exact pixel
+ width upon UI initialization. */
+ --message-box-timestamp-column-width: 42px;
/*
Reaction container UI scaling.
diff --git a/web/styles/message_row.css b/web/styles/message_row.css
index 04b089aa666..9ddd34aa3e0 100644
--- a/web/styles/message_row.css
+++ b/web/styles/message_row.css
@@ -3,18 +3,6 @@ $distance_of_text_elements_from_message_box_top: 8.5px;
$distance_of_non_text_elements_from_message_box: 6px;
$message_box_margin: 3px;
-/* The time column usually just needs enough space to display the
- timestamp. The minimum width here is enough for "22:22 PM", which
- is roughly the widest this will be in English; this is nice as the
- timestamps and message controls will be vertically aligned.
-
- But in some locales, the time encoding is wider, (especially where
- the "PM" abbreviation is longer), so we allow the column to be
- wider for individual messages if required, up to `max-content`, to
- prevent ugly line-wrapping. In practice, it's unlikely we'll see
- anything wider than 60px. */
-$time_column_min_width: 42px; /* + padding */
-
.message_row {
display: grid;
/* Prevent the messagebox column from overflowing the 1fr
@@ -144,13 +132,18 @@ $time_column_min_width: 42px; /* + padding */
/* Prevent the message column from overflowing the 1fr
space allotted by specifying `minmax(0,1fr)`, which
sets 0 as the minimum size, not the grid default of
- `auto`. */
+ `auto`.
+
+ The calculated `--message-box-timestamp-column-width`
+ should match `max-content` exactly, but `max-content`
+ ensures the timestamp will always have enough space
+ in the column. */
grid-template:
var(--message-box-icon-height) repeat(3, auto) /
$avatar_column_width minmax(0, 1fr) calc(
3 * var(--message-box-icon-width)
)
- 8px minmax($time_column_min_width, max-content);
+ 8px minmax(var(--message-box-timestamp-column-width), max-content);
/* Named grid areas provide flexibility for positioning grid items
reliably, even if the row or column definitions of the grid change. */
grid-template-areas:
@@ -164,7 +157,7 @@ $time_column_min_width: 42px; /* + padding */
/* Set the controls area to 0 to give more space
to the edit/source view area. */
grid-template-columns: $avatar_column_width minmax(0, 1fr) 0 8px minmax(
- $time_column_min_width,
+ var(--message-box-timestamp-column-width),
max-content
);
}
@@ -174,7 +167,10 @@ $time_column_min_width: 42px; /* + padding */
$avatar_column_width minmax(0, 1fr) calc(
2 * var(--message-box-icon-width)
)
- 8px minmax($time_column_min_width, max-content);
+ 8px minmax(
+ var(--message-box-timestamp-column-width),
+ max-content
+ );
}
.message_controls {