Skip to content

Commit 9d264ee

Browse files
authored
Adjust new profile styling (#777)
<!-- Please read https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before submitting your pull request --> ### Description Adjusts the styling of the new profile cards to match the styling seen elsewhere & the old ones a little better. Old is left, new is right. <img width="1404" height="1177" alt="image" src="https://github.com/user-attachments/assets/f8184a63-8299-479e-acbb-0e21dcf887f2" /> <img width="1410" height="979" alt="image" src="https://github.com/user-attachments/assets/6603e65c-16ea-4027-8fc6-2fc2b54d9b82" /> #### 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. -->
2 parents 58942fc + 3d7c2bf commit 9d264ee

8 files changed

Lines changed: 473 additions & 308 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
default: patch
3+
---
4+
5+
Various small adjustments to the themed profiles for better consistency.

src/app/components/user-profile/CreatorChip.tsx

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { RectCords } from 'folds';
22
import { Chip, config, Icon, Icons, Menu, MenuItem, PopOut, Text } from 'folds';
3+
import type { CSSProperties } from 'react';
34
import type { MouseEventHandler } from 'react';
45
import { useState } from 'react';
56
import FocusTrap from 'focus-trap-react';
@@ -16,19 +17,25 @@ import { useOpenSpaceSettings } from '$state/hooks/spaceSettings';
1617
import { SpaceSettingsPage } from '$state/spaceSettings';
1718
import { RoomSettingsPage } from '$state/roomSettings';
1819
import { PowerColorBadge, PowerIcon } from '$components/power';
20+
import { heroMenuItemStyle } from './heroMenuItemStyle';
1921
import * as css from './styles.css';
2022

2123
export function CreatorChip({
22-
backgroundColor,
2324
innerColor,
2425
cardColor,
2526
textColor,
27+
chipSurfaceStyle,
28+
chipFillColor,
29+
chipHoverBrightness,
2630
}: {
27-
backgroundColor?: string;
2831
innerColor?: string;
2932
cardColor?: string;
3033
textColor?: string;
34+
chipSurfaceStyle?: CSSProperties;
35+
chipFillColor?: string;
36+
chipHoverBrightness?: number;
3137
}) {
38+
const menuItemBg = chipFillColor ?? cardColor;
3239
const mx = useMatrixClient();
3340
const useAuthentication = useMediaAuthentication();
3441
const room = useRoom();
@@ -69,7 +76,10 @@ export function CreatorChip({
6976
variant="Surface"
7077
fill="None"
7178
className={css.UserHeroMenuItem}
72-
style={{ backgroundColor: cardColor, color: textColor }}
79+
style={heroMenuItemStyle(
80+
{ backgroundColor: menuItemBg, color: textColor },
81+
chipHoverBrightness
82+
)}
7383
size="300"
7484
radii="300"
7585
onClick={() => {
@@ -93,6 +103,8 @@ export function CreatorChip({
93103
}
94104
>
95105
<Chip
106+
variant={cardColor ? undefined : 'Success'}
107+
outlined={!cardColor}
96108
radii="Pill"
97109
before={
98110
cords ? (
@@ -104,12 +116,11 @@ export function CreatorChip({
104116
after={tagIconSrc ? <PowerIcon size="50" iconSrc={tagIconSrc} /> : undefined}
105117
onClick={open}
106118
aria-pressed={!!cords}
107-
className={css.UserHeroChip}
108-
style={{
109-
backgroundColor: cardColor,
110-
borderColor: backgroundColor,
111-
color: textColor,
112-
}}
119+
className={cardColor ? css.UserHeroChipThemed : css.UserHeroBrightnessHover}
120+
style={heroMenuItemStyle(
121+
cardColor && chipSurfaceStyle ? chipSurfaceStyle : {},
122+
chipHoverBrightness
123+
)}
113124
>
114125
<Text size="B300" truncate>
115126
{tag.name}

src/app/components/user-profile/PowerChip.tsx

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
Text,
2121
toRem,
2222
} from 'folds';
23+
import type { CSSProperties } from 'react';
2324
import type { MouseEventHandler } from 'react';
2425
import { useCallback, useState } from 'react';
2526
import FocusTrap from 'focus-trap-react';
@@ -45,6 +46,7 @@ import { useMemberPowerCompare } from '$hooks/useMemberPowerCompare';
4546
import { CutoutCard } from '$components/cutout-card';
4647
import { PowerColorBadge, PowerIcon } from '$components/power';
4748
import { EventType } from '$types/matrix-sdk';
49+
import { heroMenuItemStyle } from './heroMenuItemStyle';
4850
import * as css from './styles.css';
4951

5052
type SelfDemoteAlertProps = {
@@ -149,17 +151,22 @@ function SharedPowerAlert({ power, onCancel, onChange }: SharedPowerAlertProps)
149151

150152
export function PowerChip({
151153
userId,
152-
backgroundColor,
153154
innerColor,
154155
cardColor,
155156
textColor,
157+
chipSurfaceStyle,
158+
chipFillColor,
159+
chipHoverBrightness,
156160
}: {
157161
userId: string;
158-
backgroundColor?: string;
159162
innerColor?: string;
160163
cardColor?: string;
161164
textColor?: string;
165+
chipSurfaceStyle?: CSSProperties;
166+
chipFillColor?: string;
167+
chipHoverBrightness?: number;
162168
}) {
169+
const menuItemBg = chipFillColor ?? cardColor;
163170
const mx = useMatrixClient();
164171
const room = useRoom();
165172
const space = useSpaceOptionally();
@@ -288,7 +295,10 @@ export function PowerChip({
288295
aria-disabled={changing || !canChangePowers || !canAssignPower}
289296
aria-pressed={selected}
290297
className={css.UserHeroMenuItem}
291-
style={{ backgroundColor: cardColor, color: textColor }}
298+
style={heroMenuItemStyle(
299+
{ backgroundColor: menuItemBg, color: textColor },
300+
chipHoverBrightness
301+
)}
292302
before={<PowerColorBadge color={powerTag.color} />}
293303
after={
294304
powerTagIconSrc ? (
@@ -314,7 +324,10 @@ export function PowerChip({
314324
size="300"
315325
radii="300"
316326
className={css.UserHeroMenuItem}
317-
style={{ backgroundColor: cardColor, color: textColor }}
327+
style={heroMenuItemStyle(
328+
{ backgroundColor: menuItemBg, color: textColor },
329+
chipHoverBrightness
330+
)}
318331
onClick={() => {
319332
if (room.isSpaceRoom()) {
320333
openSpaceSettings(
@@ -340,14 +353,19 @@ export function PowerChip({
340353
}
341354
>
342355
<Chip
343-
variant={error ? 'Critical' : undefined}
356+
variant={error ? 'Critical' : cardColor ? undefined : 'SurfaceVariant'}
344357
radii="Pill"
345-
className={css.UserHeroChip}
346-
style={{
347-
backgroundColor: (!error && cardColor) || undefined,
348-
borderColor: backgroundColor,
349-
color: textColor,
350-
}}
358+
className={
359+
error ? undefined : cardColor ? css.UserHeroChipThemed : css.UserHeroBrightnessHover
360+
}
361+
style={
362+
error
363+
? undefined
364+
: heroMenuItemStyle(
365+
cardColor && chipSurfaceStyle ? chipSurfaceStyle : {},
366+
chipHoverBrightness
367+
)
368+
}
351369
before={
352370
cords ? (
353371
<Icon size="50" src={Icons.ChevronBottom} />

0 commit comments

Comments
 (0)