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.

compose: Redesign control buttons row and textbox to look like 1 unit.

N-Shar-ma878d02cf5cf8
diff --git a/web/src/css_variables.js b/web/src/css_variables.js
index dc86c0a1acf..e5e3ac7c77c 100644
--- a/web/src/css_variables.js
+++ b/web/src/css_variables.js
@@ -19,11 +19,11 @@ const mc = 849; // Middle column as wide as it appears after the `sm` breakpoint
// Breakpoints for showing and hiding compose buttons which do not always fit in
// a single row below the compose box
-const cb1 = 1296;
-const cb2 = 1054;
-const cb3 = 794;
-const cb4 = 732;
-const cb5 = 486;
+const cb1 = 1314;
+const cb2 = 1072;
+const cb3 = 860;
+const cb4 = 750;
+const cb5 = 504;
module.exports = {
media_breakpoints: {
diff --git a/web/styles/app_variables.css b/web/styles/app_variables.css
index 8b5cab4c44b..8ca4e44b4e2 100644
--- a/web/styles/app_variables.css
+++ b/web/styles/app_variables.css
@@ -156,6 +156,7 @@
flex item. 2.1786em is 30.5px at 14px/1em.
*/
--compose-recipient-box-min-height: 2.1786em;
+ --compose-formatting-buttons-row-height: 28px;
/*
Width of the area where the compose box buttons are placed, "inside"
@@ -164,7 +165,7 @@
expand / collapse buttons area, but keep the text from showing under the
the buttons.
*/
- --composebox-buttons-width: 25px;
+ --composebox-buttons-width: 24px;
/*
Width of the send menu area with the Send button, Draft(s) button
@@ -377,6 +378,10 @@
--color-composebox-button-hover: var(--color-text-default);
--color-composebox-button-background: hsl(0deg 100% 100% / 60%);
--color-composebox-button-background-hover: hsl(0deg 0% 95%);
+ --color-message-formatting-controls-container: hsl(232deg 30% 96%);
+ --color-message-content-container-border: hsl(0deg 0% 0% / 10%);
+ --color-message-content-container-border-focus: hsl(0deg 0% 57%);
+ --color-compose-control-button-background-hover: hsl(0deg 0% 0% / 5%);
/* Text colors */
--color-text-default: hsl(0deg 0% 20%);
@@ -740,6 +745,10 @@
--color-composebox-button: hsl(0deg 100% 100% / 55%);
--color-composebox-button-background: hsl(231deg 8% 13.5% / 80%);
--color-composebox-button-background-hover: hsl(231deg 12% 18%);
+ --color-message-formatting-controls-container: hsl(0deg 0% 0% / 8%);
+ --color-message-content-container-border: hsl(0deg 0% 0% / 80%);
+ --color-message-content-container-border-focus: hsl(0deg 0% 100% / 27%);
+ --color-compose-control-button-background-hover: hsl(0deg 0% 100% / 5%);
/* Text colors */
--color-text-default: hsl(0deg 0% 100% / 75%);
diff --git a/web/styles/compose.css b/web/styles/compose.css
index da2a773e388..5e922070abd 100644
--- a/web/styles/compose.css
+++ b/web/styles/compose.css
@@ -260,13 +260,13 @@
/* Vlad's design calls for 122px for the send column
at its widest; 112px accounts for 6px of gap and
4px outside padding. */
- grid-template: minmax(0, 1fr) 32px / minmax(0, 1fr) var(
- --compose-send-controls-width
- );
+ grid-template:
+ minmax(0, 1fr) var(--compose-formatting-buttons-row-height)
+ / minmax(0, 1fr) var(--compose-send-controls-width);
grid-template-areas:
"message-content-container message-send-controls-container"
- "message-formatting-controls-container . ";
- gap: 4px 6px;
+ "message-formatting-controls-container message-send-controls-container";
+ gap: 0 6px;
margin-top: 5px;
}
@@ -282,6 +282,28 @@
--composebox-buttons-width
);
grid-template-areas: "message-content composebox-buttons";
+ border-radius: 4px;
+ border: 1px solid var(--color-message-content-container-border);
+ transition: border 0.2s ease;
+
+ &:has(.new_message_textarea:focus) {
+ border-color: var(--color-message-content-container-border-focus);
+ }
+
+ &:has(.new_message_textarea.over_limit),
+ &:has(.new_message_textarea.over_limit:focus) {
+ box-shadow: 0 0 0 1pt hsl(0deg 76% 65%);
+
+ &.flash {
+ animation: message-limit-flash 0.5s ease-in-out infinite;
+ }
+ }
+
+ &:has(.new_message_textarea.invalid),
+ &:has(.new_message_textarea.invalid:focus) {
+ border-color: hsl(3deg 57% 33%);
+ box-shadow: 0 0 2px hsl(3deg 57% 33%);
+ }
}
#message-content-container .composebox-buttons {
@@ -289,8 +311,6 @@
/* z-index is needed to avoid flickering of cursor and the
button when hovering it in preview mode. */
z-index: 1;
- padding-top: 1px;
- padding-right: 1px;
height: max-content;
button {
@@ -339,6 +359,24 @@
padding-right: var(--composebox-buttons-width);
}
+.surround-formatting-buttons-row {
+ /* This is to extend it under the formatting buttons
+ row, so that any border / box-shadow styles applied
+ to it surround the formatting buttons row as well. */
+ padding-bottom: var(--compose-formatting-buttons-row-height);
+ /* The extra 1px of margin-bottom is to ensure the 1px of
+ border-bottom shows below the formatting buttons row. */
+ margin-bottom: calc(
+ (var(--compose-formatting-buttons-row-height) + 1px) * -1
+ );
+
+ textarea {
+ /* Flatten the bottom edge of the textarea to
+ merge with the flat top edge of the buttons row */
+ border-radius: 3px 3px 0 0;
+ }
+}
+
#preview-message-area-container {
/* Keep preview container invisible outside
of preview mode. */
@@ -370,6 +408,11 @@
#message-formatting-controls-container {
grid-area: message-formatting-controls-container;
+ border-radius: 0 0 3px 3px;
+ background-color: var(--color-message-formatting-controls-container);
+ /* margin on either side to let the border of
+ .message-content-container show through. */
+ margin: 0 1px;
}
#compose-limit-indicator:not(:empty) {
@@ -786,19 +829,15 @@ textarea.new_message_textarea {
max-height: 22em;
margin: 0;
resize: vertical !important;
- border-radius: 4px;
- color: hsl(0deg 0% 33%);
+ border-radius: 3px 3px 0 0;
+ border: none;
background-color: hsl(0deg 0% 100%);
scrollbar-width: thin;
scrollbar-color: hsl(0deg 0% 50%) transparent;
+ box-shadow: none;
- &.over_limit,
- &.over_limit:focus {
- box-shadow: 0 0 0 1pt hsl(0deg 76% 65%);
-
- &.flash {
- animation: message-limit-flash 0.5s ease-in-out infinite;
- }
+ &:focus {
+ outline: 0;
}
&:read-only,
@@ -806,26 +845,11 @@ textarea.new_message_textarea {
cursor: not-allowed;
background-color: hsl(0deg 0% 93%);
}
-
- &.invalid,
- &.invalid:focus {
- border: 1px solid hsl(3deg 57% 33%);
- box-shadow: 0 0 2px hsl(3deg 57% 33%);
- }
}
-textarea.new_message_textarea,
+#message-content-container,
#compose_recipient_box {
- border: 1px solid hsl(0deg 0% 0% / 20%);
- box-shadow: none;
- transition: border 0.2s ease;
color: var(--color-text-default);
-
- &:focus {
- outline: 0;
- border: 1px solid hsl(0deg 0% 67%);
- box-shadow: none;
- }
}
#compose_recipient_box {
@@ -833,16 +857,16 @@ textarea.new_message_textarea,
grid-template-columns: minmax(0, 1fr) auto;
align-items: stretch;
flex: 1 1 0;
+ border: 1px solid hsl(0deg 0% 0% / 20%);
border-radius: 3px;
+ transition: border 0.2s ease;
background: hsl(0deg 0% 100%);
/* Give the recipient box, a `<div>`, the
correct styles when focus is in the
#stream_message_recipient_topic `<input>` */
&:focus-within {
- outline: 0;
border: 1px solid hsl(0deg 0% 67%);
- box-shadow: none;
}
#stream_message_recipient_topic,
@@ -1047,7 +1071,7 @@ textarea.new_message_textarea,
align-items: center;
.compose_control_button {
- height: 28px;
+ height: var(--compose-formatting-buttons-row-height);
width: 30px;
display: flex;
align-items: center;
@@ -1056,11 +1080,12 @@ textarea.new_message_textarea,
color: inherit;
text-decoration: none;
font-size: 22px;
- border-radius: 3px;
&:hover {
opacity: 1;
- background-color: hsl(0deg 0% 0% / 10%);
+ background-color: var(
+ --color-compose-control-button-background-hover
+ );
}
&:focus:not(:focus-visible) {
@@ -1126,6 +1151,7 @@ textarea.new_message_textarea,
color: hsl(0deg 0% 75%);
font-size: 20px;
margin: 0 3px;
+ height: var(--compose-formatting-buttons-row-height);
}
.compose_draft_button {
@@ -1223,8 +1249,7 @@ textarea.new_message_textarea,
min-height: 42px;
overflow: auto;
- border: 1px solid hsl(0deg 0% 67%);
- border-radius: 4px;
+ border-radius: 3px 3px 0 0;
background-color: hsl(0deg 0% 100%);
cursor: not-allowed;
}
@@ -1374,12 +1399,9 @@ textarea.new_message_textarea,
width: 30px;
/* This reduces the vdots button so that
it and the send button fit within the
- 54px height the compose textarea occupies.
- TODO: Should formatting buttons become part
- of the textarea, the height here and its
- participation in the columnar flexbox
- should get a rewrite. */
- height: 26px;
+ 53px height the compose textarea occupies,
+ including its top border. */
+ height: 25px;
margin-left: 0;
border-radius: 4px;
}
diff --git a/web/styles/dark_theme.css b/web/styles/dark_theme.css
index c1f3451a6f8..82ed3b8d97c 100644
--- a/web/styles/dark_theme.css
+++ b/web/styles/dark_theme.css
@@ -120,10 +120,6 @@
.tippy-content a,
p {
color: hsl(236deg 33% 90%);
-
- &.compose_control_button:hover {
- color: hsl(200deg 79% 66%);
- }
}
}
@@ -510,7 +506,7 @@
}
.compose_control_button:hover {
- background-color: hsl(0deg 0% 100% / 10%);
+ color: inherit;
}
#compose-content {
diff --git a/web/styles/message_row.css b/web/styles/message_row.css
index 91f46d8a1dc..a5eb9d058b7 100644
--- a/web/styles/message_row.css
+++ b/web/styles/message_row.css
@@ -534,36 +534,39 @@
}
}
+.edit-content-container {
+ border-radius: 4px;
+ border: 1px solid var(--color-message-content-container-border);
+ transition: border 0.2s ease;
+
+ &:has(.message_edit_content:focus) {
+ border-color: var(--color-message-content-container-border-focus);
+ }
+}
+
.message_edit_content {
max-height: 24em;
width: 100%;
min-width: 206px;
+ min-height: 52px;
box-sizing: border-box;
/* Setting resize as none hides the bottom right diagonal box
(which even has a background color of its own!). */
resize: none !important;
color: hsl(0deg 0% 33%);
background-color: hsl(0deg 0% 100%);
- border-radius: 4px;
+ border-radius: 3px;
vertical-align: middle;
- border: 1px solid hsl(0deg 0% 80%);
+ border: none;
/* Match textarea padding to compose box and
message-edit preview area. */
padding: 5px;
- margin: 0 0 10px;
+ margin: 0;
- box-shadow: inset 0 1px 1px hsl(0deg 0% 0% / 7.5%);
- transition:
- border linear 0.2s,
- box-shadow linear 0.2s;
+ box-shadow: none;
&:focus {
- border-color: hsl(206.5deg 80% 62% / 80%);
outline: 0;
-
- box-shadow:
- inset 0 1px 1px hsl(0deg 0% 0% / 7.5%),
- 0 0 8px hsl(206.5deg 80% 62% / 60%);
}
&:read-only,
@@ -600,8 +603,12 @@ of the base style defined for a read-only textarea in dark mode. */
.message-edit-feature-group {
display: flex;
- margin: 0;
align-items: baseline;
+ border-radius: 0 0 3px 3px;
+ background-color: var(--color-message-formatting-controls-container);
+ /* margin on either side to let the border of
+ .edit-content-container show through. */
+ margin: 0 1px;
}
.message_edit_save .loader {
diff --git a/web/templates/compose.hbs b/web/templates/compose.hbs
index bc5a44e382f..48b26bc42ea 100644
--- a/web/templates/compose.hbs
+++ b/web/templates/compose.hbs
@@ -69,7 +69,7 @@
</div>
</div>
<div class="messagebox">
- <div id="message-content-container">
+ <div id="message-content-container" class="surround-formatting-buttons-row">
<textarea class="new_message_textarea" name="content" id='compose-textarea' placeholder="{{t 'Compose your message here' }}" tabindex="0" aria-label="{{t 'Compose your message here...' }}"></textarea>
<div id="preview-message-area-container">
<div class="scrolling_list preview_message_area" data-simplebar data-simplebar-tab-index="-1" id="preview_message_area" style="display:none;">
diff --git a/web/templates/message_edit_form.hbs b/web/templates/message_edit_form.hbs
index ed75d49f7ef..1b1852ba7b9 100644
--- a/web/templates/message_edit_form.hbs
+++ b/web/templates/message_edit_form.hbs
@@ -2,7 +2,7 @@
<form id="edit_form_{{message_id}}" class="new-style">
<div class="edit_form_banners"></div>
- <div class="edit-controls">
+ <div class="edit-controls edit-content-container {{#if is_editable}}surround-formatting-buttons-row{{/if}}">
{{> copy_message_button message_id=this.message_id}}
<textarea class="message_edit_content" maxlength="{{ max_message_length }}">{{content}}</textarea>
<div class="scrolling_list preview_message_area" id="preview_message_area_{{message_id}}" style="display:none;">