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: Rewrite picker as grid and adjust presentation.

Karl Stolleyf5a661a4626c
diff --git a/web/src/compose_recipient.ts b/web/src/compose_recipient.ts
index c1179f950d1..ef0673737b5 100644
--- a/web/src/compose_recipient.ts
+++ b/web/src/compose_recipient.ts
@@ -149,8 +149,9 @@ function switch_message_type(message_type: MessageType): void {
function update_recipient_label(stream_id?: number): void {
const stream = stream_id !== undefined ? stream_data.get_sub_by_id(stream_id) : undefined;
if (stream === undefined) {
- $("#compose_select_recipient_widget .dropdown_widget_value").text(
- $t({defaultMessage: "Select a channel"}),
+ const select_channel_label = $t({defaultMessage: "Select a channel"});
+ $("#compose_select_recipient_widget .dropdown_widget_value").html(
+ `<span class="select-channel-label">${select_channel_label}</span>`,
);
} else {
$("#compose_select_recipient_widget .dropdown_widget_value").html(
@@ -179,7 +180,8 @@ export function update_compose_for_message_type(opts: ComposeTriggeredOptions):
// it here.
const direct_message_label = $t({defaultMessage: "DM"});
$("#compose_select_recipient_widget .dropdown_widget_value").html(
- `<i class="zulip-icon zulip-icon-users channel-privacy-type-icon"></i> ${direct_message_label}`,
+ `<i class="zulip-icon zulip-icon-users channel-privacy-type-icon"></i>
+ <span class="decorated-dm-label">${direct_message_label}</span>`,
);
}
compose_banner.clear_errors();
diff --git a/web/styles/compose.css b/web/styles/compose.css
index 89b4c134c0e..104c0f3688e 100644
--- a/web/styles/compose.css
+++ b/web/styles/compose.css
@@ -1196,7 +1196,9 @@ textarea.new_message_textarea {
border-color: var(--color-compose-recipient-box-border-color);
&.dropdown-widget-button {
- padding: 0 6px;
+ /* We control the surrounding space through the
+ grid on `.dropdown_widget_value`. */
+ padding: 0;
border-radius: 4px;
}
@@ -1549,23 +1551,42 @@ textarea.new_message_textarea {
.dropdown_widget_value {
flex-grow: 1;
- display: flex;
+ display: grid;
align-items: baseline;
- /* This gap matches a single space character,
- as used previously in the icon-stream name
- layout. */
- gap: 0.4ch;
+ /* This is a bit of eyeball work, based on balancing
+ out the size and spatial relationships between the
+ privacy icon and the channel name, and the
+ surrounding negative space. */
+ /* 7px at 20px/1em; 4px at 20px/1em. */
+ grid-template:
+ "lefthand-offset privacy-icon privacy-icon-gap channel-name righthand-offset" auto / 0.35em auto 0.2em minmax(
+ 0,
+ 1fr
+ )
+ 0.35em;
.channel-privacy-type-icon {
- font-size: 0.9286em; /* 13px at 14px em */
+ grid-area: privacy-icon;
+ place-self: center;
+ font-size: 0.95em; /* 19px at 20px/1em */
+ margin-top: -0.0579em; /* Eyeball work; 1.1px at 19px/1em */
+ /* Eliminate inherited component styles. */
+ position: static;
+ padding: 0;
width: 1em;
height: 1em;
- position: relative;
- top: 0.1538em; /* 2px at 13px/em */
+
+ &.zulip-icon-lock {
+ /* The lock looks better centered without
+ a negative margin-top adjustment. */
+ margin-top: 0;
+ }
}
+ .select-channel-label,
+ .decorated-dm-label,
.decorated-channel-name {
- flex: 1 1 auto;
+ grid-area: channel-name;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;