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.

input_pill: Redesign input pills.

evykassirerf6c9b515c747
diff --git a/web/styles/app_variables.css b/web/styles/app_variables.css
index 7b517855f23..bd7034cbc8e 100644
--- a/web/styles/app_variables.css
+++ b/web/styles/app_variables.css
@@ -479,6 +479,18 @@
--color-background-text-group-mention: hsl(183deg 60% 45% / 18%);
--color-background-text-hover-group-mention: hsl(183deg 60% 45% / 30%);
+ /* Input pills */
+ --color-background-input-pill: hsl(237deg 68% 94%);
+ --color-focus-outline-input-pill: hsl(240deg 50% 50%);
+ --color-input-pill-close: hsl(240deg 60% 65%);
+ --color-background-input-pill-exit-hover: hsla(240deg 70% 70% / 15%);
+ --color-background-deactivated-user-pill: hsl(8deg 96% 91%);
+ --color-focus-outline-deactivated-user-pill: hsl(4deg 75% 53%);
+ --color-close-deactivated-user-pill: hsl(4deg 75% 53%);
+ --color-background-exit-hover-deactivated-user-pill: hsl(
+ 4deg 75% 53% / 15%
+ );
+
/* Inbox view constants - Values from Figma design */
--height-inbox-search: 26px;
--width-inbox-search: 346px;
@@ -836,6 +848,16 @@
--color-background-text-group-mention: hsl(183deg 52% 40% / 20%);
--color-background-text-hover-group-mention: hsl(183deg 52% 40% / 30%);
+ /* Input pills */
+ --color-background-input-pill: hsl(240deg 65% 60% / 22%);
+ --color-focus-outline-input-pill: hsl(0deg 0% 100% / 60%);
+ --color-input-pill-close: hsl(240deg 50% 74%);
+ --color-background-input-pill-exit-hover: hsl(0deg 0% 100% / 7%);
+ --color-background-deactivated-user-pill: hsl(360deg 97% 25%);
+ --color-focus-outline-deactivated-user-pill: hsl(0deg 0% 100% / 70%);
+ --color-close-deactivated-user-pill: hsl(7deg 100% 74%);
+ --color-background-exit-hover-deactivated-user-pill: hsl(0deg 0% 100% / 7%);
+
/* Inbox view */
--color-background-inbox: var(--color-background);
--color-background-inbox-no-unreads-illustration: hsl(147deg 40% 55%);
diff --git a/web/styles/dark_theme.css b/web/styles/dark_theme.css
index 36e49510889..c1f3451a6f8 100644
--- a/web/styles/dark_theme.css
+++ b/web/styles/dark_theme.css
@@ -454,10 +454,6 @@
border-color: hsl(3deg 73% 74%);
}
- .deactivated-pill {
- background-color: hsl(0deg 86% 14%) !important;
- }
-
#compose-direct-recipient .pill-container {
background-color: hsl(0deg 0% 0% / 20%);
}
diff --git a/web/styles/input_pill.css b/web/styles/input_pill.css
index 55e6bf470d8..38d26298bfb 100644
--- a/web/styles/input_pill.css
+++ b/web/styles/input_pill.css
@@ -20,16 +20,14 @@
margin: 1px 2px;
color: inherit;
- border: 1px solid hsl(0deg 0% 0% / 15%);
+ border: 1px solid transparent;
border-radius: 4px;
- background-color: hsl(0deg 0% 0% / 7%);
+ background-color: var(--color-background-input-pill);
cursor: pointer;
&:focus {
- color: hsl(0deg 0% 100%);
- border: 1px solid hsl(176deg 78% 28%);
- background-color: hsl(176deg 49% 42%);
+ border-color: var(--color-focus-outline-input-pill);
outline: none;
}
@@ -56,14 +54,62 @@
text-overflow: ellipsis;
}
+ .pill-close-button {
+ font-size: 10px;
+ text-decoration: none;
+ /* Let the close button's box stretch,
+ but no larger than the height of the
+ banner box when the action button
+ achieves its full height (margin,
+ padding, and height), which keeps
+ the X vertically centered with it. */
+ align-self: stretch;
+ max-height: 52px;
+ /* Display as flexbox to better control
+ the X icon's position. This creates
+ an anonymous flexbox item out of the
+ ::before content where the icon sits. */
+ display: flex;
+ align-items: center;
+ /* !important overrides `.dark-theme:root a:hover` */
+ color: var(--color-input-pill-close) !important;
+ opacity: 0.7;
+ }
+
.exit {
- opacity: 0.5;
- font-size: 1.3em;
- margin-right: 3px;
+ width: 16px;
+ height: 16px;
+ display: flex;
+ justify-content: center;
+ margin-right: 2px;
+ border-radius: 2px;
}
.exit:hover {
- opacity: 1;
+ background: var(--color-background-input-pill-exit-hover);
+
+ .pill-close-button {
+ opacity: 1;
+ }
+ }
+
+ &.deactivated-pill {
+ background-color: var(--color-background-deactivated-user-pill);
+
+ &:focus {
+ border-color: var(--color-focus-outline-deactivated-user-pill);
+ }
+
+ .pill-close-button {
+ /* !important overrides `.dark-theme:root a:hover` */
+ color: var(--color-close-deactivated-user-pill) !important;
+ }
+
+ .exit:hover {
+ background: var(
+ --color-background-exit-hover-deactivated-user-pill
+ );
+ }
}
}
@@ -129,10 +175,6 @@
background-color: var(--color-background-invitee-emails-pill-container);
}
-.deactivated-pill {
- background-color: hsl(0deg 86% 86%) !important;
-}
-
.add_subscribers_container .pill-container,
.add_members_container .pill-container {
width: 100%;
diff --git a/web/styles/search.css b/web/styles/search.css
index a59bdee71fe..8a4c11f9792 100644
--- a/web/styles/search.css
+++ b/web/styles/search.css
@@ -246,6 +246,8 @@
.search_list_item .pill-container {
margin-left: 5px;
+ /* This contains only one pill, which handles its own border */
+ border: none;
cursor: pointer;
padding: 0;
}
@@ -253,7 +255,11 @@
.pill {
align-items: baseline;
margin: 0;
- border: none;
+
+ &:focus {
+ /* Keep the border the same color, there's no user interaction for users in the typeahead menu */
+ border-color: var(--color-background-input-pill);
+ }
.exit {
display: none;
diff --git a/web/templates/input_pill.hbs b/web/templates/input_pill.hbs
index d5bc5c19c1a..1be32e85654 100644
--- a/web/templates/input_pill.hbs
+++ b/web/templates/input_pill.hbs
@@ -11,6 +11,6 @@
{{~/if~}}
</span>
<div class="exit">
- <span aria-hidden="true">&times;</span>
+ <a role="button" class="zulip-icon zulip-icon-close pill-close-button"></a>
</div>
</div>
diff --git a/web/tests/search.test.js b/web/tests/search.test.js
index 072e24313ce..942ef2b42e1 100644
--- a/web/tests/search.test.js
+++ b/web/tests/search.test.js
@@ -166,13 +166,13 @@ run_test("initialize", ({override, override_rewire, mock_template}) => {
let expected_value = `<div class="search_list_item">\n <span>Search for zo</span>\n</div>\n`;
assert.equal(opts.highlighter_html(source[0]), expected_value);
- expected_value = `<div class="search_list_item">\n <span>sent by</span>\n <span class="pill-container">\n <div class='pill ' tabindex=0>\n <img class="pill-image" src="https://secure.gravatar.com/avatar/0f030c97ab51312c7bbffd3966198ced?d&#x3D;identicon&amp;version&#x3D;1&amp;s&#x3D;50" />\n <span class="pill-label">\n <span class="pill-value">&lt;strong&gt;Zo&lt;/strong&gt;e</span></span>\n <div class="exit">\n <span aria-hidden="true">&times;</span>\n </div>\n</div>\n </span>\n</div>\n`;
+ expected_value = `<div class="search_list_item">\n <span>sent by</span>\n <span class="pill-container">\n <div class='pill ' tabindex=0>\n <img class="pill-image" src="https://secure.gravatar.com/avatar/0f030c97ab51312c7bbffd3966198ced?d&#x3D;identicon&amp;version&#x3D;1&amp;s&#x3D;50" />\n <span class="pill-label">\n <span class="pill-value">&lt;strong&gt;Zo&lt;/strong&gt;e</span></span>\n <div class="exit">\n <a role="button" class="zulip-icon zulip-icon-close pill-close-button"></a>\n </div>\n</div>\n </span>\n</div>\n`;
assert.equal(opts.highlighter_html(source[1]), expected_value);
- expected_value = `<div class="search_list_item">\n <span>direct messages with</span>\n <span class="pill-container">\n <div class='pill ' tabindex=0>\n <img class="pill-image" src="https://secure.gravatar.com/avatar/0f030c97ab51312c7bbffd3966198ced?d&#x3D;identicon&amp;version&#x3D;1&amp;s&#x3D;50" />\n <span class="pill-label">\n <span class="pill-value">&lt;strong&gt;Zo&lt;/strong&gt;e</span></span>\n <div class="exit">\n <span aria-hidden="true">&times;</span>\n </div>\n</div>\n </span>\n</div>\n`;
+ expected_value = `<div class="search_list_item">\n <span>direct messages with</span>\n <span class="pill-container">\n <div class='pill ' tabindex=0>\n <img class="pill-image" src="https://secure.gravatar.com/avatar/0f030c97ab51312c7bbffd3966198ced?d&#x3D;identicon&amp;version&#x3D;1&amp;s&#x3D;50" />\n <span class="pill-label">\n <span class="pill-value">&lt;strong&gt;Zo&lt;/strong&gt;e</span></span>\n <div class="exit">\n <a role="button" class="zulip-icon zulip-icon-close pill-close-button"></a>\n </div>\n</div>\n </span>\n</div>\n`;
assert.equal(opts.highlighter_html(source[2]), expected_value);
- expected_value = `<div class="search_list_item">\n <span>group direct messages including</span>\n <span class="pill-container">\n <div class='pill ' tabindex=0>\n <img class="pill-image" src="https://secure.gravatar.com/avatar/0f030c97ab51312c7bbffd3966198ced?d&#x3D;identicon&amp;version&#x3D;1&amp;s&#x3D;50" />\n <span class="pill-label">\n <span class="pill-value">&lt;strong&gt;Zo&lt;/strong&gt;e</span></span>\n <div class="exit">\n <span aria-hidden="true">&times;</span>\n </div>\n</div>\n </span>\n</div>\n`;
+ expected_value = `<div class="search_list_item">\n <span>group direct messages including</span>\n <span class="pill-container">\n <div class='pill ' tabindex=0>\n <img class="pill-image" src="https://secure.gravatar.com/avatar/0f030c97ab51312c7bbffd3966198ced?d&#x3D;identicon&amp;version&#x3D;1&amp;s&#x3D;50" />\n <span class="pill-label">\n <span class="pill-value">&lt;strong&gt;Zo&lt;/strong&gt;e</span></span>\n <div class="exit">\n <a role="button" class="zulip-icon zulip-icon-close pill-close-button"></a>\n </div>\n</div>\n </span>\n</div>\n`;
assert.equal(opts.highlighter_html(source[3]), expected_value);
/* Test sorter */