From 457b80ece6f3350603011fc6732b127b1c8a99c3 Mon Sep 17 00:00:00 2001 From: Karl Stolley Date: Thu, 6 Nov 2025 12:13:25 -0500 Subject: [PATCH] user_groups: Prepare properly sized group icon. This removes kludgy font-size adjustments on the group icon, whose path was previously smaller than the 16x16 viewbox. By adjusting the icon to take up the full width, it is no longer necessary to fiddle with the icon's size, in keeping with the app-wide move to 16x16 icons. That simplifies some headache-inducing sizing and calculations on the typeahead as well. --- web/shared/icons/user-group.svg | 5 +++-- web/styles/input_pill.css | 9 ++++++++- web/styles/typeahead.css | 31 +++++++++++++------------------ 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/web/shared/icons/user-group.svg b/web/shared/icons/user-group.svg index 09a3dc56d2..c6d3e493aa 100644 --- a/web/shared/icons/user-group.svg +++ b/web/shared/icons/user-group.svg @@ -1,3 +1,4 @@ - - + + diff --git a/web/styles/input_pill.css b/web/styles/input_pill.css index f66c31c3e9..babea30558 100644 --- a/web/styles/input_pill.css +++ b/web/styles/input_pill.css @@ -385,7 +385,14 @@ } .display_only_group_pill .zulip-icon-user-group { - font-size: 1.3571em; /* 19px at 14px / em */ + /* Reserve the same square box for the user-group + icon as on pill images. */ + height: var(--height-input-pill); + width: var(--height-input-pill); + /* Center the icon in the box using flex. */ + display: flex; + align-items: center; + justify-content: center; } @keyframes shake { diff --git a/web/styles/typeahead.css b/web/styles/typeahead.css index de401d6677..68cd2adb2e 100644 --- a/web/styles/typeahead.css +++ b/web/styles/typeahead.css @@ -195,27 +195,22 @@ /* For FontAwesome icons and zulip icons used in place of images for some users. */ .typeahead-image { - font-size: 1.3571em; /* 19px at 14px em */ - display: inline-block; - height: 1.1052em; /* 21px at 19px/1em */ - width: 1.1052em; /* 21px at 19px/1em */ + flex: 0 0 auto; + height: 1.3125em; /* 21px at 16px/1em */ + width: 1.3125em; /* 21px at 16px/1em */ border-radius: 4px; - text-align: center; - - &.zulip-icon-user-group { - font-size: 1.3571em; /* 19px at 14px em */ - } - &.no-presence-circle { - /* 0.6875 * var(--base-font-size) is the width of presence - circle, no margin (-2px left margin + 2px right margin = 0px) - of the presence circle and 0.3571 * var(--base-font-size-px) - is gap between the presence circle and avatar. - Cannot directly use 0.6875em or 0.3571em - since font-size for user group icon is different from the - font size used to calculate presence circle width and gap. */ - margin-left: calc((0.6875 + 0.3571) * var(--base-font-size-px)); + /* 0.6875em at 16px/1em is the width of presence circle, + no margin (-2px left margin + 2px right margin = 0px), + and 0.3571 is the gap between the presence circle and + image avatars. */ + margin-left: calc(0.6875em + 0.3571em); + /* To properly align icons within the 21px square box + defined on .typeahead-image, we establish a flexbox: */ + display: flex; + align-items: center; + justify-content: center; } }