Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak search dialog based on new designs #7980

Merged
merged 3 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions res/css/views/dialogs/_SpotlightDialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ limitations under the License.
display: flex;
white-space: nowrap;
overflow-x: hidden;
margin-right: 1px; // occlude the 1px visible of the very next tile to prevent it looking broken
}

.mx_AccessibleButton {
Expand All @@ -109,15 +110,16 @@ limitations under the License.
font-size: $font-12px;
line-height: $font-15px;
display: inline-block;
width: 50px;
min-width: 50px;
width: 58px;
height: 58px;
min-width: 58px;
box-sizing: border-box;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;

.mx_DecoratedRoomAvatar {
margin: 0 5px 4px; // maintain centering
margin: 0 9px 4px; // maintain centering
}

& + .mx_AccessibleButton {
Expand Down Expand Up @@ -150,8 +152,8 @@ limitations under the License.
> .mx_DecoratedRoomAvatar,
> .mx_BaseAvatar {
margin-right: 8px;
width: 20px;
height: 20px;
width: 24px;
height: 24px;

.mx_BaseAvatar {
width: inherit;
Expand Down Expand Up @@ -186,8 +188,8 @@ limitations under the License.
mask-repeat: no-repeat;
mask-position: center;
mask-size: contain;
width: 20px;
height: 20px;
width: 24px;
height: 24px;
position: absolute;
left: 4px;
top: 50%;
Expand All @@ -214,8 +216,8 @@ limitations under the License.

.mx_SpotlightDialog_otherSearches_messageSearchIcon {
display: inline-block;
width: 20px;
height: 20px;
width: 24px;
height: 24px;
background-color: $secondary-content;
vertical-align: text-bottom;
mask-repeat: no-repeat;
Expand Down
15 changes: 9 additions & 6 deletions src/components/views/dialogs/SpotlightDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import { getCachedRoomIDForAlias } from "../../../RoomAliasCache";

const MAX_RECENT_SEARCHES = 10;
const SECTION_LIMIT = 50; // only show 50 results per section for performance reasons
const AVATAR_SIZE = 24;

const Option: React.FC<ComponentProps<typeof RovingAccessibleButton>> = ({ inputRef, children, ...props }) => {
const [onFocus, isActive, ref] = useRovingTabIndex(inputRef);
Expand Down Expand Up @@ -358,7 +359,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", onFinished }) =>
viewRoom(result.room.roomId, true, ev.type !== "click");
}}
>
<DecoratedRoomAvatar room={result.room} avatarSize={20} tooltipProps={{ tabIndex: -1 }} />
<DecoratedRoomAvatar room={result.room} avatarSize={AVATAR_SIZE} tooltipProps={{ tabIndex: -1 }} />
{ result.room.name }
<NotificationBadge notification={RoomNotificationStateStore.instance.getRoomState(result.room)} />
<ResultDetails room={result.room} />
Expand Down Expand Up @@ -426,9 +427,12 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", onFinished }) =>
<BaseAvatar
name={room.name}
idName={room.room_id}
url={room.avatar_url ? mediaFromMxc(room.avatar_url).getSquareThumbnailHttp(20) : null}
width={20}
height={20}
url={room.avatar_url
? mediaFromMxc(room.avatar_url).getSquareThumbnailHttp(AVATAR_SIZE)
: null
}
width={AVATAR_SIZE}
height={AVATAR_SIZE}
/>
{ room.name || room.canonical_alias }
{ room.name && room.canonical_alias && <div className="mx_SpotlightDialog_result_details">
Expand Down Expand Up @@ -539,7 +543,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", onFinished }) =>
viewRoom(room.roomId, true, ev.type !== "click");
}}
>
<DecoratedRoomAvatar room={room} avatarSize={20} tooltipProps={{ tabIndex: -1 }} />
<DecoratedRoomAvatar room={room} avatarSize={AVATAR_SIZE} tooltipProps={{ tabIndex: -1 }} />
{ room.name }
<NotificationBadge notification={RoomNotificationStateStore.instance.getRoomState(room)} />
<ResultDetails room={room} />
Expand All @@ -556,7 +560,6 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", onFinished }) =>
<div>
{ BreadcrumbsStore.instance.rooms
.filter(r => r.roomId !== RoomViewStore.getRoomId())
.slice(0, 10)
.map(room => (
<TooltipOption
id={`mx_SpotlightDialog_button_recentlyViewed_${room.roomId}`}
Expand Down