mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-21 09:31:17 -08:00
Fix some small styling issues (#830)
<!-- Please read https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before submitting your pull request --> ### Description <!-- Please include a summary of the change. Please also include relevant motivation and context. List any dependencies that are required for this change. --> Fixes the settings menu header being misaligned, the room, dm, and home headers being the wrong size. (internal) Adds a little border and shadow to the thread drawer. #### Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ### Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings ### AI disclosure: - [ ] Partially AI assisted (clarify which code was AI assisted and briefly explain what it does). - [ ] Fully AI generated (explain what all the generated code does in moderate detail). <!-- Write any explanation required here, but do not generate the explanation using AI!! You must prove you understand what the code in this PR does. -->
This commit is contained in:
10 files changed
+138
-133
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
default: patch
|
||||
---
|
||||
|
||||
Improve thread drawer separation between the pinned root message and replies with a border.
|
||||
@@ -44,7 +44,9 @@ export function PageNav({ size, children }: ClientDrawerLayoutProps & css.PageNa
|
||||
);
|
||||
}
|
||||
|
||||
export const PageNavHeader = as<'header', css.PageNavHeaderVariants>(
|
||||
type PageNavHeaderOwnProps = Pick<ComponentProps<typeof Header>, 'size'>;
|
||||
|
||||
export const PageNavHeader = as<'header', css.PageNavHeaderVariants & PageNavHeaderOwnProps>(
|
||||
({ className, outlined, ...props }, ref) => (
|
||||
<Header
|
||||
className={classNames(css.PageNavHeader({ outlined }), className)}
|
||||
|
||||
@@ -46,7 +46,7 @@ export const PageNavHeader = recipe({
|
||||
variants: {
|
||||
outlined: {
|
||||
true: {
|
||||
borderBottomWidth: 1,
|
||||
borderBottomWidth: config.borderWidth.B300,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -28,6 +28,23 @@ export const ThreadDrawerHeader = style({
|
||||
borderBottomWidth: config.borderWidth.B300,
|
||||
});
|
||||
|
||||
export const threadRootShell = style({
|
||||
position: 'relative',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
flexShrink: 0,
|
||||
});
|
||||
|
||||
export const threadRootScrollShadow = style({
|
||||
position: 'relative',
|
||||
flexShrink: 0,
|
||||
zIndex: 1,
|
||||
boxShadow: config.shadow.E100,
|
||||
borderBottomWidth: config.borderWidth.B300,
|
||||
borderBottomStyle: 'solid',
|
||||
borderBottomColor: color.Surface.ContainerLine,
|
||||
});
|
||||
|
||||
export const ThreadDrawerContent = style({
|
||||
position: 'relative',
|
||||
overflow: 'hidden',
|
||||
|
||||
@@ -1,18 +1,6 @@
|
||||
import type { MouseEventHandler } from 'react';
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Header,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Scroll,
|
||||
Spinner,
|
||||
Text,
|
||||
color,
|
||||
config,
|
||||
toRem,
|
||||
} from 'folds';
|
||||
import { Box, Header, Icon, IconButton, Icons, Scroll, Spinner, Text, config, toRem } from 'folds';
|
||||
import type { IEvent, Room } from '$types/matrix-sdk';
|
||||
import {
|
||||
Direction,
|
||||
@@ -807,36 +795,38 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra
|
||||
|
||||
{/* Thread root message */}
|
||||
{rootEvent && (
|
||||
<Box style={{ position: 'relative', flexShrink: 0 }}>
|
||||
<Scroll
|
||||
variant="Background"
|
||||
visibility="Hover"
|
||||
direction="Vertical"
|
||||
size="300"
|
||||
hideTrack
|
||||
style={{
|
||||
height: toRem(curHeight),
|
||||
flexShrink: 0,
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
className={css.messageList}
|
||||
direction="Column"
|
||||
<Box className={css.threadRootShell}>
|
||||
<Box className={css.threadRootScrollShadow}>
|
||||
<Scroll
|
||||
variant="Background"
|
||||
visibility="Hover"
|
||||
direction="Vertical"
|
||||
size="300"
|
||||
hideTrack
|
||||
style={{
|
||||
padding: `${config.space.S200} 0 ${config.space.S100} 0`,
|
||||
height: toRem(curHeight),
|
||||
flexShrink: 0,
|
||||
}}
|
||||
>
|
||||
{renderMatrixEvent(
|
||||
rootEvent.getType(),
|
||||
typeof rootEvent.getStateKey() === 'string',
|
||||
rootEvent.getId()!,
|
||||
rootEvent,
|
||||
processedEvents.find((e) => e.id === threadRootId)?.itemIndex ?? 0,
|
||||
thread?.timelineSet ?? room.getUnfilteredTimelineSet(),
|
||||
false
|
||||
)}
|
||||
</Box>
|
||||
</Scroll>
|
||||
<Box
|
||||
className={css.messageList}
|
||||
direction="Column"
|
||||
style={{
|
||||
padding: `${config.space.S200} 0 ${config.space.S100} 0`,
|
||||
}}
|
||||
>
|
||||
{renderMatrixEvent(
|
||||
rootEvent.getType(),
|
||||
typeof rootEvent.getStateKey() === 'string',
|
||||
rootEvent.getId()!,
|
||||
rootEvent,
|
||||
processedEvents.find((e) => e.id === threadRootId)?.itemIndex ?? 0,
|
||||
thread?.timelineSet ?? room.getUnfilteredTimelineSet(),
|
||||
false
|
||||
)}
|
||||
</Box>
|
||||
</Scroll>
|
||||
</Box>
|
||||
<SidebarResizer
|
||||
setCurWidth={setCurHeight}
|
||||
sidebarWidth={threadRootHeight}
|
||||
@@ -845,13 +835,6 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra
|
||||
maxValue={700}
|
||||
topSided
|
||||
/>
|
||||
<div
|
||||
style={{
|
||||
width: '100%',
|
||||
height: toRem(1),
|
||||
backgroundColor: color.Surface.ContainerLine,
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
{/* Replies */}
|
||||
|
||||
@@ -249,29 +249,31 @@ export function Settings({
|
||||
nav={
|
||||
screenSize === ScreenSize.Mobile && visibleSection !== null ? undefined : (
|
||||
<PageNav size="300">
|
||||
<PageNavHeader className={settingsHeader}>
|
||||
<PageNavHeader className={settingsHeader} size="600">
|
||||
<Box grow="Yes" gap="200">
|
||||
<Avatar size="200" radii="300">
|
||||
<UserAvatar
|
||||
userId={userId}
|
||||
src={avatarUrl}
|
||||
renderFallback={() => <Text size="H6">{nameInitials(displayName)}</Text>}
|
||||
/>
|
||||
</Avatar>
|
||||
<Text size="H4" truncate>
|
||||
Settings
|
||||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
{visibleSection === null && (
|
||||
<IconButton
|
||||
aria-label="Close settings"
|
||||
onClick={handleRequestClose}
|
||||
variant="Background"
|
||||
>
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
)}
|
||||
<Box grow="Yes" alignItems="Center" gap="200">
|
||||
<Avatar size="200" radii="300">
|
||||
<UserAvatar
|
||||
userId={userId}
|
||||
src={avatarUrl}
|
||||
renderFallback={() => <Text size="H6">{nameInitials(displayName)}</Text>}
|
||||
/>
|
||||
</Avatar>
|
||||
<Text size="H4" truncate>
|
||||
Settings
|
||||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
{visibleSection === null && (
|
||||
<IconButton
|
||||
aria-label="Close settings"
|
||||
onClick={handleRequestClose}
|
||||
variant="Background"
|
||||
>
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
)}
|
||||
</Box>
|
||||
</Box>
|
||||
</PageNavHeader>
|
||||
<Box grow="Yes" direction="Column">
|
||||
|
||||
@@ -103,25 +103,27 @@ function DirectHeader({ hideText }: { hideText?: boolean }) {
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<PageNavHeader>
|
||||
<Box alignItems="Center" grow="Yes" gap="300" justifyContent="Center">
|
||||
{!hideText && (
|
||||
<Box grow="Yes">
|
||||
<PageNavHeader size="600">
|
||||
{hideText ? (
|
||||
<Box alignItems="Center" grow="Yes" justifyContent="Center">
|
||||
<IconButton aria-pressed={!!menuAnchor} variant="Background" onClick={handleOpenMenu}>
|
||||
<Icon src={Icons.User} size="200" filled={!!menuAnchor} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
) : (
|
||||
<Box grow="Yes" gap="300">
|
||||
<Box grow="Yes" alignItems="Center">
|
||||
<Text size="H4" truncate>
|
||||
Direct Messages
|
||||
</Text>
|
||||
</Box>
|
||||
)}
|
||||
<Box>
|
||||
<IconButton aria-pressed={!!menuAnchor} variant="Background" onClick={handleOpenMenu}>
|
||||
<Icon
|
||||
src={hideText ? Icons.User : Icons.VerticalDots}
|
||||
size="200"
|
||||
filled={!!menuAnchor}
|
||||
/>
|
||||
</IconButton>
|
||||
<Box shrink="No">
|
||||
<IconButton aria-pressed={!!menuAnchor} variant="Background" onClick={handleOpenMenu}>
|
||||
<Icon src={Icons.VerticalDots} size="200" filled={!!menuAnchor} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
</PageNavHeader>
|
||||
<PopOut
|
||||
anchor={menuAnchor}
|
||||
|
||||
@@ -113,30 +113,27 @@ function HomeHeader({ hideText }: { hideText?: boolean }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageNavHeader>
|
||||
<Box
|
||||
alignItems="Center"
|
||||
grow="Yes"
|
||||
gap="300"
|
||||
justifyContent={hideText ? 'Center' : 'Start'}
|
||||
>
|
||||
{!hideText && (
|
||||
<Box grow="Yes">
|
||||
<PageNavHeader size="600">
|
||||
{hideText ? (
|
||||
<Box alignItems="Center" grow="Yes" justifyContent="Center">
|
||||
<IconButton aria-pressed={!!menuAnchor} variant="Background" onClick={handleOpenMenu}>
|
||||
<Icon src={Icons.Home} size="200" filled={!!menuAnchor} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
) : (
|
||||
<Box grow="Yes" gap="300">
|
||||
<Box grow="Yes" alignItems="Center">
|
||||
<Text size="H4" truncate>
|
||||
Home
|
||||
</Text>
|
||||
</Box>
|
||||
)}
|
||||
<Box>
|
||||
<IconButton aria-pressed={!!menuAnchor} variant="Background" onClick={handleOpenMenu}>
|
||||
<Icon
|
||||
src={hideText ? Icons.Home : Icons.VerticalDots}
|
||||
size="200"
|
||||
filled={!!menuAnchor}
|
||||
/>
|
||||
</IconButton>
|
||||
<Box shrink="No">
|
||||
<IconButton aria-pressed={!!menuAnchor} variant="Background" onClick={handleOpenMenu}>
|
||||
<Icon src={Icons.VerticalDots} size="200" filled={!!menuAnchor} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
</PageNavHeader>
|
||||
<PopOut
|
||||
anchor={menuAnchor}
|
||||
|
||||
@@ -291,9 +291,9 @@ function SpaceHeader({ hideText, mx }: { hideText?: boolean; mx: MatrixClient })
|
||||
hasBanner ? css.RoomCoverNavContainer : css.RoomCoverlessNavContainer({ hideText })
|
||||
}
|
||||
>
|
||||
<PageNavHeader outlined={false}>
|
||||
<Box alignItems="Center" grow="Yes" gap="300" justifyContent="Center">
|
||||
{hideText ? (
|
||||
<PageNavHeader outlined={!hasBanner} size="600">
|
||||
{hideText ? (
|
||||
<Box alignItems="Center" grow="Yes" justifyContent="Center">
|
||||
<Avatar size={hideText ? undefined : '200'} radii="400" onClick={handleOpenMenu}>
|
||||
<RoomAvatar
|
||||
roomId={space.roomId}
|
||||
@@ -307,29 +307,27 @@ function SpaceHeader({ hideText, mx }: { hideText?: boolean; mx: MatrixClient })
|
||||
)}
|
||||
/>
|
||||
</Avatar>
|
||||
) : (
|
||||
<>
|
||||
<Box grow="Yes" alignItems="Center" gap="100">
|
||||
<Text size="H4" truncate>
|
||||
{spaceName}
|
||||
</Text>
|
||||
{joinRules?.join_rule !== JoinRule.Public && (
|
||||
<Icon src={Icons.Lock} size="50" />
|
||||
)}
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton
|
||||
aria-pressed={!!menuAnchor}
|
||||
variant="Background"
|
||||
style={hasBanner ? { backgroundColor: '#0000' } : {}}
|
||||
onClick={handleOpenMenu}
|
||||
>
|
||||
<Icon src={Icons.VerticalDots} size="200" />
|
||||
</IconButton>
|
||||
</Box>
|
||||
</>
|
||||
)}
|
||||
</Box>
|
||||
</Box>
|
||||
) : (
|
||||
<Box grow="Yes" gap="300">
|
||||
<Box grow="Yes" alignItems="Center" gap="100">
|
||||
<Text size="H4" truncate>
|
||||
{spaceName}
|
||||
</Text>
|
||||
{joinRules?.join_rule !== JoinRule.Public && <Icon src={Icons.Lock} size="50" />}
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton
|
||||
aria-pressed={!!menuAnchor}
|
||||
variant="Background"
|
||||
style={hasBanner ? { backgroundColor: '#0000' } : {}}
|
||||
onClick={handleOpenMenu}
|
||||
>
|
||||
<Icon src={Icons.VerticalDots} size="200" />
|
||||
</IconButton>
|
||||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
</PageNavHeader>
|
||||
{menuAnchor && (
|
||||
<PopOut
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { style } from '@vanilla-extract/css';
|
||||
import { recipe } from '@vanilla-extract/recipes';
|
||||
import { color, config } from 'folds';
|
||||
import { config } from 'folds';
|
||||
|
||||
export const RoomCoverHeaderContainer = style({ width: '100%', position: 'relative' });
|
||||
export const RoomCoverNavContainer = style({
|
||||
@@ -13,7 +13,6 @@ export const RoomCoverNavContainer = style({
|
||||
export const RoomCoverlessNavContainer = recipe({
|
||||
base: {
|
||||
flexShrink: 0,
|
||||
borderBottom: `1px solid ${color.Background.ContainerLine}`,
|
||||
minHeight: '100%',
|
||||
paddingRight: 0,
|
||||
},
|
||||
@@ -23,7 +22,7 @@ export const RoomCoverlessNavContainer = recipe({
|
||||
padding: `${config.space.S100} ${config.space.S200} ${config.space.S200}`,
|
||||
},
|
||||
false: {
|
||||
padding: `${config.space.S100} ${config.space.S200} ${config.space.S200} ${config.space.S400}`,
|
||||
padding: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user