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.

message_grid: Add named grid areas to .messagebox-content.

Karl Stolley1d1a2e3c753e
diff --git a/web/styles/message_row.css b/web/styles/message_row.css
index de79bc8cbeb..830932b7cb5 100644
--- a/web/styles/message_row.css
+++ b/web/styles/message_row.css
@@ -121,30 +121,19 @@ $time_column_max_width: 150px;
}
.messagebox .messagebox-content {
- /* Total 868px
- 1 56px 2 697px 3 55px 4 60px(min) 5
- 1 |‾‾‾‾‾‾‾‾‾‾‾:‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾:‾‾‾‾‾‾‾‾‾‾‾‾‾‾:‾‾‾‾‾‾‾‾‾‾‾‾|
- | : TEXT : + ⋮ ☆ : 10:00 AM |
- | : TEXT : : |
- | EDITED : TEXT : : |
- | : TEXT : : |
- | : TEXT : : |
- 2,3 |_ _ _ _ _ _:_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ : _ _ _ _ _ _ _:_ _ _ _ _ _ |
- | : : : |
- | : [EXPAND / COLLAPSE] : : |
- 4 |_ _ _ _ _ _:_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ : _ _ _ _ _ _ _:_ _ _ _ _ _ |
- | : : : |
- | : [Message Reactions] : : |
- 5 |___________:____________________________________________________________________________________________________:______________:____________|
- */
display: grid;
align-items: start;
padding-left: 10px;
- grid-template-rows: repeat(4, auto);
-
- grid-template-columns: $avatar_column_width auto 55px fit-content(
- $time_column_max_width
- );
+ grid-template:
+ 25px repeat(3, auto) /
+ $avatar_column_width auto 55px fit-content($time_column_max_width);
+ /* Named grid areas provide flexibility for positioning grid items
+ reliably, even if the row or column definitions of the grid change. */
+ grid-template-areas:
+ "edited message controls time"
+ ". message . . "
+ ". more . . "
+ ". reactions . . ";
@media (width < $sm_min) {
grid-template-columns: $avatar_column_width auto max-content fit-content(
@@ -153,8 +142,7 @@ $time_column_max_width: 150px;
}
.message_controls {
- grid-row-start: 1;
- grid-column-start: 3;
+ grid-area: controls;
line-height: 1;
justify-self: end;
padding: 0;
@@ -171,7 +159,7 @@ $time_column_max_width: 150px;
}
.message_edit_notice {
- grid-row-start: 1;
+ grid-area: edited;
position: relative;
top: $distance_of_text_elements_from_message_box_top;
}
@@ -182,8 +170,7 @@ $time_column_max_width: 150px;
padding-right: 5px;
min-width: $time_column_min_width;
text-align: end;
- grid-row-start: 1;
- grid-column-start: 4;
+ grid-area: time;
&.notvisible {
/* This happens when message failed to send. We don't want to
@@ -198,15 +185,11 @@ $time_column_max_width: 150px;
justify-self: end;
margin-right: 10px;
text-align: end;
- grid-row-start: 1;
- grid-column-start: 4;
- position: relative;
- top: $distance_of_text_elements_from_message_box_top;
+ grid-area: time;
}
.message_content {
- grid-row-start: 1;
- grid-column-start: 2;
+ grid-area: message;
/*
Space between two single line messages in a paragraph is 10px.
There is 3px margin above and below a message. So, having a 2px
@@ -217,59 +200,43 @@ $time_column_max_width: 150px;
}
.message_reactions {
- grid-row-start: 4;
- grid-column-start: 2;
+ grid-area: reactions;
margin-top: -1px;
}
.message_edit {
- grid-row-start: 2;
- grid-column-start: 2;
+ grid-area: message;
}
.alert-msg {
- grid-row-start: 1;
- grid-column: 3 / 5;
- margin-top: 4px;
+ /* Span both the controls and time columns */
+ grid-row: controls-start;
+ grid-column: controls-start / time-end;
}
.message_length_controller {
- grid-row-start: 3;
- grid-column-start: 2;
+ grid-area: more;
}
}
&.include-sender {
- /*
- 1 2 3 4 5
- 1 |‾‾‾‾‾‾‾‾‾‾‾:‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾:‾‾‾‾‾‾‾‾‾‾‾‾‾‾:‾‾‾‾‾‾‾‾‾‾‾‾|
- | ((((\\\ : Sender Name EDITED : + ⋮ ☆ : 10:00 AM |
- 2 | 9_9 3)) :_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ : _ _ _ _ _ _ _:_ _ _ _ _ _ |
- | \= (( : TEXT : : |
- | : TEXT : : |
- | : TEXT : : |
- | : TEXT : : |
- | : TEXT : : |
- 3 |_ _ _ _ _ _:_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ : _ _ _ _ _ _ _:_ _ _ _ _ _ |
- | : : : |
- | : [EXPAND / COLLAPSE] : : |
- 4 |_ _ _ _ _ _:_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ : _ _ _ _ _ _ _:_ _ _ _ _ _ |
- | : : : |
- | : [Message Reactions] : : |
- 5 |___________:____________________________________________________________________________________________________:______________:____________|
- */
.messagebox .messagebox-content {
- grid-template-rows: 25px repeat(3, auto);
+ grid-template-areas:
+ "sender sender controls time"
+ ". message . . "
+ ". more . . "
+ ". reactions . . ";
.message_content {
padding-top: 0;
- grid-row-start: 2;
+ grid-area: message;
}
.message_time {
align-self: center;
/* TODO: See if this margin is necessary in a grid context (KAS, 2023-06-012) */
margin-top: 1px;
+ grid-area: time;
}
.slow-send-spinner {
@@ -293,13 +260,13 @@ $time_column_max_width: 150px;
.message_controls {
align-self: center;
+ grid-area: controls;
}
.message_sender {
overflow: hidden;
text-overflow: ellipsis;
- grid-column: 1 / 3;
- grid-row: 1 / 2;
+ grid-area: sender;
.zulip-icon.zulip-icon-bot {
align-self: center;