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.

inbox: Standardize inbox filter input.

Sayam Samalb6ff74860288
diff --git a/web/src/inbox_ui.ts b/web/src/inbox_ui.ts
index 8a605f003ec..0906d3251a3 100644
--- a/web/src/inbox_ui.ts
+++ b/web/src/inbox_ui.ts
@@ -1895,7 +1895,7 @@ export function initialize({hide_other_views}: {hide_other_views: () => void}):
);
$("body").on(
- "keyup",
+ "input",
"#inbox-search",
_.debounce(() => {
search_and_update();
@@ -2011,12 +2011,6 @@ export function initialize({hide_other_views}: {hide_other_views: () => void}):
focus_clicked_list_element($elt);
});
- $("body").on("click", "#inbox-clear-search", () => {
- $("#inbox-search").val("");
- search_and_update();
- focus_inbox_search();
- });
-
$("body").on("click", "#inbox-search", () => {
current_focus_id = INBOX_SEARCH_ID;
compose_closed_ui.set_standard_text_for_reply_button();
diff --git a/web/styles/app_variables.css b/web/styles/app_variables.css
index e8f91061e19..193a7462209 100644
--- a/web/styles/app_variables.css
+++ b/web/styles/app_variables.css
@@ -1870,8 +1870,7 @@
);
/* Inbox view constants - Values from Figma design */
- --height-inbox-search: 1.8571em; /* 26px / 14px em */
- --width-inbox-search: 24.7142em; /* 346px / 14px em */
+ --width-inbox-search: 29.0625em; /* 465px / 16px em */
--width-inbox-filters-dropdown: 10.7142em; /* 150px / 14px em */
--color-background-inbox-no-unreads-illustration: light-dark(
hsl(147deg 57% 25%),
diff --git a/web/styles/inbox.css b/web/styles/inbox.css
index 3c57a9db3ff..c841427c6da 100644
--- a/web/styles/inbox.css
+++ b/web/styles/inbox.css
@@ -40,94 +40,9 @@
}
#inbox-filters {
- .zulip-icon-search-inbox {
- position: relative;
- /* We need to position the icon relative to the filters dropdown since its width is variable.
- To avoid icon from taking width since it is no longer absolute/fixed positioned, we set its width to 0. */
- width: 0;
- /* (30px searchbox height - 15px icon height) / 2) = 7.5px at 14px em */
- top: 0.5357em;
- /* (30px left padding - 15px icon width) / 2) = 7.5px at 14px em */
- left: 0.5357em;
- color: var(--color-icons-inbox);
- opacity: 0.4;
- }
-
- #inbox-clear-search {
- border: none;
- background: transparent;
- display: flex;
- justify-content: center;
- align-items: center;
- border-radius: 2px;
- cursor: pointer;
- font-size: 1.1428em; /* 16px at 14px em */
- color: var(--color-icons-inbox);
- opacity: 0.4;
- transition: 140ms;
- transition-property: background-color, opacity, transform;
- /* 5px at 16px font-size at 14px em */
- padding: 0.3125em;
- margin: 0;
- position: relative;
- /* Give 2px space to right at 16px font-size */
- right: 0.125em;
-
- &:focus {
- outline: none;
- }
-
- &:hover,
- &:focus-visible {
- opacity: 1;
- }
-
- &:active {
- opacity: 1;
- transform: scale(0.9);
- }
- }
- }
-
- #inbox-search:placeholder-shown + #inbox-clear-search {
- visibility: hidden;
- }
-
- #inbox-search {
- /* Give space for 30px cross icon at 16px font-size */
- margin-right: -1.875em;
- flex-grow: 1;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- max-width: var(--width-inbox-search);
- /* Setting width to 100% ensures the search box takes the full width of its container,
- preventing overflow issues by making sure it doesn't exceed the available space. */
- width: 100%;
- height: var(--height-inbox-search);
- /* top/bottom default 1px padding / 14px em */
- /* left padding 30px / 14px em */
- /* right padding for 28px / 14px em (close icon) */
- padding: 0.0714em 2em 0.0714em 2.1428em;
- font-style: normal;
- font-weight: 400;
- line-height: 1.2142em; /* 17px / 14px em */
- border-radius: 4px;
- background-color: var(--color-background-inbox-search);
- color: var(--color-inbox-search-text);
- border: 1px solid var(--color-border-inbox-search);
-
- &:not(:placeholder-shown),
- &:hover {
- background-color: var(--color-background-inbox-search-hover);
- border: 1px solid var(--color-border-inbox-search-hover);
- }
-
- &:focus {
- outline: none;
- background-color: var(--color-background-inbox-search-focus);
- border: 1px solid var(--color-border-inbox-search-focus);
- box-shadow: 0 0 5px var(--color-box-shadow-inbox-search-focus);
+ .inbox-search-wrapper {
+ flex-grow: 1;
+ max-width: var(--width-inbox-search);
}
}
@@ -148,10 +63,11 @@
overflow: hidden;
border-radius: 5px;
border: 1px solid hsl(0deg 0% 0% / 20%);
- /* margin(5) + search left padding(30) + search right padding (28) = 63px at 14px em */
+ /* search box left border (1px) + search box right border (1px)
+ + dropdown left border (1px) + dropdown right border (1px) = 4px at 16px em */
max-width: calc(
var(--width-inbox-search) +
- var(--width-inbox-filters-dropdown) + 4.5em
+ var(--width-inbox-filters-dropdown) + 0.25em
);
.inbox-channel-topic-list {
diff --git a/web/templates/inbox_view/inbox_view.hbs b/web/templates/inbox_view/inbox_view.hbs
index 4d0510306db..9e8d949e731 100644
--- a/web/templates/inbox_view/inbox_view.hbs
+++ b/web/templates/inbox_view/inbox_view.hbs
@@ -6,11 +6,9 @@
{{else}}
<div class="search_group" id="inbox-filters" role="group">
{{> ../dropdown_widget widget_name="inbox-filter"}}
- <i class="zulip-icon zulip-icon-search-inbox"></i>
- <input type="text" id="{{INBOX_SEARCH_ID}}" value="{{search_val}}" autocomplete="off" placeholder="{{t 'Filter' }}" />
- <button id="inbox-clear-search">
- <i class="zulip-icon zulip-icon-close-small"></i>
- </button>
+ {{#> input . input_type="filter-input" custom_classes="inbox-search-wrapper" icon="search" input_button_icon="close"}}
+ <input type="text" id="{{INBOX_SEARCH_ID}}" class="input-element" value="{{search_val}}" autocomplete="off" placeholder="{{t 'Filter' }}" />
+ {{/input}}
</div>
<div id="inbox-empty-with-search" class="inbox-empty-text empty-list-message">
{{t "No conversations match your filters."}}