diff --git a/src/app/components/message/content/EventContent.tsx b/src/app/components/message/content/EventContent.tsx index 2cc4934c..97ff26f7 100644 --- a/src/app/components/message/content/EventContent.tsx +++ b/src/app/components/message/content/EventContent.tsx @@ -1,6 +1,7 @@ import { Box, Icon, IconSrc } from 'folds'; import React, { ReactNode } from 'react'; import { CompactLayout, ModernLayout } from '..'; +import { MessageLayout } from '../../../state/settings'; export type EventContentProps = { messageLayout: number; @@ -11,9 +12,9 @@ export type EventContentProps = { export function EventContent({ messageLayout, time, iconSrc, content }: EventContentProps) { const beforeJSX = ( - {messageLayout === 1 && time} + {messageLayout === MessageLayout.Compact && time} @@ -25,11 +26,11 @@ export function EventContent({ messageLayout, time, iconSrc, content }: EventCon const msgContentJSX = ( {content} - {messageLayout !== 1 && time} + {messageLayout !== MessageLayout.Compact && time} ); - return messageLayout === 1 ? ( + return messageLayout === MessageLayout.Compact ? ( {msgContentJSX} ) : ( {msgContentJSX} diff --git a/src/app/components/page/Page.tsx b/src/app/components/page/Page.tsx index a8b9ea04..55ccecee 100644 --- a/src/app/components/page/Page.tsx +++ b/src/app/components/page/Page.tsx @@ -27,14 +27,14 @@ export function PageRoot({ nav, children }: PageRootProps) { type ClientDrawerLayoutProps = { children: ReactNode; }; -export function PageNav({ children }: ClientDrawerLayoutProps) { +export function PageNav({ size, children }: ClientDrawerLayoutProps & css.PageNavVariants) { const screenSize = useScreenSizeContext(); const isMobile = screenSize === ScreenSize.Mobile; return ( @@ -44,15 +44,17 @@ export function PageNav({ children }: ClientDrawerLayoutProps) { ); } -export const PageNavHeader = as<'header'>(({ className, ...props }, ref) => ( -
-)); +export const PageNavHeader = as<'header', css.PageNavHeaderVariants>( + ({ className, outlined, ...props }, ref) => ( +
+ ) +); export function PageNavContent({ scrollRef, @@ -88,11 +90,11 @@ export const Page = as<'div'>(({ className, ...props }, ref) => ( )); export const PageHeader = as<'div', css.PageHeaderVariants>( - ({ className, balance, ...props }, ref) => ( + ({ className, outlined, balance, ...props }, ref) => (
diff --git a/src/app/components/page/style.css.ts b/src/app/components/page/style.css.ts index 23f2da49..0abd4dfa 100644 --- a/src/app/components/page/style.css.ts +++ b/src/app/components/page/style.css.ts @@ -2,30 +2,55 @@ import { style } from '@vanilla-extract/css'; import { recipe, RecipeVariants } from '@vanilla-extract/recipes'; import { DefaultReset, color, config, toRem } from 'folds'; -export const PageNav = style({ - width: toRem(256), -}); - -export const PageNavHeader = style({ - padding: `0 ${config.space.S200} 0 ${config.space.S300}`, - flexShrink: 0, - borderBottomWidth: 1, - - selectors: { - 'button&': { - cursor: 'pointer', - }, - 'button&[aria-pressed=true]': { - backgroundColor: color.Background.ContainerActive, - }, - 'button&:hover, button&:focus-visible': { - backgroundColor: color.Background.ContainerHover, - }, - 'button&:active': { - backgroundColor: color.Background.ContainerActive, +export const PageNav = recipe({ + variants: { + size: { + '400': { + width: toRem(256), + }, + '300': { + width: toRem(222), + }, }, }, + defaultVariants: { + size: '400', + }, }); +export type PageNavVariants = RecipeVariants; + +export const PageNavHeader = recipe({ + base: { + padding: `0 ${config.space.S200} 0 ${config.space.S300}`, + flexShrink: 0, + selectors: { + 'button&': { + cursor: 'pointer', + }, + 'button&[aria-pressed=true]': { + backgroundColor: color.Background.ContainerActive, + }, + 'button&:hover, button&:focus-visible': { + backgroundColor: color.Background.ContainerHover, + }, + 'button&:active': { + backgroundColor: color.Background.ContainerActive, + }, + }, + }, + + variants: { + outlined: { + true: { + borderBottomWidth: 1, + }, + }, + }, + defaultVariants: { + outlined: true, + }, +}); +export type PageNavHeaderVariants = RecipeVariants; export const PageNavContent = style({ minHeight: '100%', @@ -38,7 +63,6 @@ export const PageHeader = recipe({ base: { paddingLeft: config.space.S400, paddingRight: config.space.S200, - borderBottomWidth: config.borderWidth.B300, }, variants: { balance: { @@ -46,6 +70,14 @@ export const PageHeader = recipe({ paddingLeft: config.space.S200, }, }, + outlined: { + true: { + borderBottomWidth: config.borderWidth.B300, + }, + }, + }, + defaultVariants: { + outlined: true, }, }); export type PageHeaderVariants = RecipeVariants; diff --git a/src/app/components/setting-tile/SettingTile.tsx b/src/app/components/setting-tile/SettingTile.tsx new file mode 100644 index 00000000..2656903a --- /dev/null +++ b/src/app/components/setting-tile/SettingTile.tsx @@ -0,0 +1,27 @@ +import React, { ReactNode } from 'react'; +import { Box, Text } from 'folds'; + +type SettingTileProps = { + title: ReactNode; + description?: ReactNode; + before?: ReactNode; + after?: ReactNode; + children?: ReactNode; +}; +export function SettingTile({ title, description, before, after, children }: SettingTileProps) { + return ( + + {before && {before}} + + {title} + {description && ( + + {description} + + )} + {children} + + {after && {after}} + + ); +} diff --git a/src/app/components/setting-tile/index.ts b/src/app/components/setting-tile/index.ts new file mode 100644 index 00000000..49fede72 --- /dev/null +++ b/src/app/components/setting-tile/index.ts @@ -0,0 +1 @@ +export * from './SettingTile'; diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx index a2738fcb..97d2a1a8 100644 --- a/src/app/features/room/RoomTimeline.tsx +++ b/src/app/features/room/RoomTimeline.tsx @@ -85,7 +85,7 @@ import { reactionOrEditEvent, } from '../../utils/room'; import { useSetting } from '../../state/hooks/settings'; -import { settingsAtom } from '../../state/settings'; +import { MessageLayout, settingsAtom } from '../../state/settings'; import { openProfileViewer } from '../../../client/action/navigation'; import { useMatrixEventRenderer } from '../../hooks/useMatrixEventRenderer'; import { Reactions, Message, Event, EncryptedContent } from './message'; @@ -1028,7 +1028,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli urlPreview={showUrlPreview} htmlReactParserOptions={htmlReactParserOptions} linkifyOpts={linkifyOpts} - outlineAttachment={messageLayout === 2} + outlineAttachment={messageLayout === MessageLayout.Bubble} /> )} @@ -1124,7 +1124,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli urlPreview={showUrlPreview} htmlReactParserOptions={htmlReactParserOptions} linkifyOpts={linkifyOpts} - outlineAttachment={messageLayout === 2} + outlineAttachment={messageLayout === MessageLayout.Bubble} /> ); } @@ -1208,7 +1208,9 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli const highlighted = focusItem?.index === item && focusItem.highlight; const parsed = parseMemberEvent(mEvent); - const timeJSX =