fix(direct): lock DmStreamRow title-block height so the room name stops jumping when row 2 collapses on hover
This commit is contained in:
parent
1d64275bae
commit
e8865cec5f
2 changed files with 67 additions and 42 deletions
|
|
@ -15,7 +15,6 @@ import {
|
||||||
RectCords,
|
RectCords,
|
||||||
Spinner,
|
Spinner,
|
||||||
Text,
|
Text,
|
||||||
color,
|
|
||||||
config,
|
config,
|
||||||
toRem,
|
toRem,
|
||||||
} from 'folds';
|
} from 'folds';
|
||||||
|
|
@ -62,9 +61,7 @@ import { useCallPreferencesAtom } from '../../state/hooks/callPreferences';
|
||||||
import { useAutoDiscoveryInfo } from '../../hooks/useAutoDiscoveryInfo';
|
import { useAutoDiscoveryInfo } from '../../hooks/useAutoDiscoveryInfo';
|
||||||
import { livekitSupport } from '../../hooks/useLivekitSupport';
|
import { livekitSupport } from '../../hooks/useLivekitSupport';
|
||||||
import { timeHourMinute } from '../../utils/time';
|
import { timeHourMinute } from '../../utils/time';
|
||||||
|
import * as css from './styles.css';
|
||||||
const MONO_FONT = '"JetBrains Mono Variable", ui-monospace, monospace';
|
|
||||||
const ROW_MIN_HEIGHT = toRem(68);
|
|
||||||
|
|
||||||
type DmStreamRowMenuProps = {
|
type DmStreamRowMenuProps = {
|
||||||
room: Room;
|
room: Room;
|
||||||
|
|
@ -346,7 +343,7 @@ export function DmStreamRow({ room, selected, notificationMode, linkPath }: DmSt
|
||||||
aria-selected={selected}
|
aria-selected={selected}
|
||||||
data-hover={!!menuAnchor}
|
data-hover={!!menuAnchor}
|
||||||
onContextMenu={handleContextMenu}
|
onContextMenu={handleContextMenu}
|
||||||
style={{ minHeight: ROW_MIN_HEIGHT, boxSizing: 'border-box' }}
|
className={css.DmRowOuter}
|
||||||
{...hoverProps}
|
{...hoverProps}
|
||||||
{...focusWithinProps}
|
{...focusWithinProps}
|
||||||
>
|
>
|
||||||
|
|
@ -357,11 +354,7 @@ export function DmStreamRow({ room, selected, notificationMode, linkPath }: DmSt
|
||||||
grow="Yes"
|
grow="Yes"
|
||||||
alignItems="Center"
|
alignItems="Center"
|
||||||
gap="300"
|
gap="300"
|
||||||
style={{
|
className={css.DmRowInner}
|
||||||
minHeight: ROW_MIN_HEIGHT,
|
|
||||||
boxSizing: 'border-box',
|
|
||||||
padding: `${toRem(8)} 0`,
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<Avatar size="300" radii="400">
|
<Avatar size="300" radii="400">
|
||||||
<RoomAvatar
|
<RoomAvatar
|
||||||
|
|
@ -391,56 +384,34 @@ export function DmStreamRow({ room, selected, notificationMode, linkPath }: DmSt
|
||||||
direction="Column"
|
direction="Column"
|
||||||
grow="Yes"
|
grow="Yes"
|
||||||
gap="100"
|
gap="100"
|
||||||
style={{ minWidth: 0, overflow: 'hidden' }}
|
className={css.DmRowText}
|
||||||
>
|
>
|
||||||
<Box as="span" alignItems="Baseline" gap="200" style={{ minWidth: 0 }}>
|
<Box as="span" alignItems="Baseline" gap="200">
|
||||||
<Box
|
<Box as="span" grow="Yes" className={css.DmRowTextStretch}>
|
||||||
as="span"
|
|
||||||
grow="Yes"
|
|
||||||
alignItems="Baseline"
|
|
||||||
style={{ minWidth: 0, overflow: 'hidden' }}
|
|
||||||
>
|
|
||||||
<Text
|
<Text
|
||||||
as="span"
|
as="span"
|
||||||
priority={unread ? '500' : '400'}
|
priority={unread ? '500' : '400'}
|
||||||
size="T300"
|
size="T300"
|
||||||
truncate
|
truncate
|
||||||
style={{ fontWeight: 600 }}
|
className={css.DmRowName}
|
||||||
>
|
>
|
||||||
{roomName}
|
{roomName}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
{timeLabel && !optionsVisible && (
|
{timeLabel && !optionsVisible && (
|
||||||
<span
|
<span className={css.DmRowTime}>{timeLabel}</span>
|
||||||
style={{
|
|
||||||
fontFamily: MONO_FONT,
|
|
||||||
fontSize: toRem(10.5),
|
|
||||||
color: color.Surface.OnContainer,
|
|
||||||
opacity: 0.55,
|
|
||||||
fontVariantNumeric: 'tabular-nums',
|
|
||||||
flexShrink: 0,
|
|
||||||
whiteSpace: 'nowrap',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{timeLabel}
|
|
||||||
</span>
|
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
<Box as="span" alignItems="Center" gap="200" style={{ minWidth: 0 }}>
|
<Box as="span" alignItems="Center" gap="200">
|
||||||
<Box as="span" grow="Yes" style={{ minWidth: 0, overflow: 'hidden' }}>
|
<Box as="span" grow="Yes" className={css.DmRowTextStretch}>
|
||||||
{typingMember.length > 0 ? (
|
{typingMember.length > 0 ? (
|
||||||
<Box as="span" alignItems="Center" gap="100">
|
<TypingIndicator size="300" disableAnimation />
|
||||||
<TypingIndicator size="300" disableAnimation />
|
|
||||||
</Box>
|
|
||||||
) : (
|
) : (
|
||||||
<Text
|
<Text
|
||||||
as="span"
|
as="span"
|
||||||
size="T200"
|
size="T200"
|
||||||
truncate
|
truncate
|
||||||
style={{
|
className={unread ? css.DmRowPreviewUnread : css.DmRowPreview}
|
||||||
opacity: unread ? 0.85 : 0.6,
|
|
||||||
fontWeight: unread ? 500 : 400,
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{previewText}
|
{previewText}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { style } from '@vanilla-extract/css';
|
import { style } from '@vanilla-extract/css';
|
||||||
import { config } from 'folds';
|
import { color, config, toRem } from 'folds';
|
||||||
|
|
||||||
export const CategoryButton = style({
|
export const CategoryButton = style({
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
|
|
@ -7,3 +7,57 @@ export const CategoryButton = style({
|
||||||
export const CategoryButtonIcon = style({
|
export const CategoryButtonIcon = style({
|
||||||
opacity: config.opacity.P400,
|
opacity: config.opacity.P400,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const DmRowMinHeight = toRem(68);
|
||||||
|
const DmRowTitleBlockHeight = toRem(40);
|
||||||
|
|
||||||
|
export const DmRowOuter = style({
|
||||||
|
minHeight: DmRowMinHeight,
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
});
|
||||||
|
|
||||||
|
export const DmRowInner = style({
|
||||||
|
minHeight: DmRowMinHeight,
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
padding: `${toRem(8)} 0`,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Locks the title block to its natural 2-line height so the name does
|
||||||
|
// not jump vertically when the second row's content (preview / unread
|
||||||
|
// badge / notification icon) collapses to 0px on hover. Bridged rooms
|
||||||
|
// with no m.room.message yet but a synced unread badge are the obvious
|
||||||
|
// trigger; the same pathology applies to any (empty preview + has unread)
|
||||||
|
// pair, so the fix is room-class-agnostic.
|
||||||
|
export const DmRowText = style({
|
||||||
|
minWidth: 0,
|
||||||
|
overflow: 'hidden',
|
||||||
|
minHeight: DmRowTitleBlockHeight,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const DmRowTextStretch = style({
|
||||||
|
minWidth: 0,
|
||||||
|
overflow: 'hidden',
|
||||||
|
});
|
||||||
|
|
||||||
|
export const DmRowName = style({
|
||||||
|
fontWeight: 600,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const DmRowTime = style({
|
||||||
|
fontFamily: '"JetBrains Mono Variable", ui-monospace, monospace',
|
||||||
|
fontSize: toRem(10.5),
|
||||||
|
color: color.Surface.OnContainer,
|
||||||
|
opacity: 0.55,
|
||||||
|
fontVariantNumeric: 'tabular-nums',
|
||||||
|
flexShrink: 0,
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
});
|
||||||
|
|
||||||
|
export const DmRowPreview = style({
|
||||||
|
opacity: 0.6,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const DmRowPreviewUnread = style({
|
||||||
|
opacity: 0.85,
|
||||||
|
fontWeight: 500,
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue