Skip to content

Commit cbe89bb

Browse files
fix(ui): align passkey rows with the design
1 parent c5fe0ef commit cbe89bb

2 files changed

Lines changed: 28 additions & 4 deletions

File tree

‎packages/ui/src/mosaic/features/user-profile/user-profile-passkey-row.view.tsx‎

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
import * as stylex from '@stylexjs/stylex';
12
import { useMemo, useState } from 'react';
23

34
import { Dialog } from '../../components/dialog';
5+
import { Icon, IconFrame } from '../../components/icon';
46
import { Section } from '../../components/section';
7+
import { colorVars } from '../../tokens.stylex';
58
import { fill } from './user-profile-account-section/user-profile-account-section.messages';
69
import type { UserProfileMenuAction } from './user-profile-action-menu';
710
import { UserProfileActionMenu } from './user-profile-action-menu';
811
import { userProfilePasskeysMessages as m } from './user-profile-passkeys-section.messages';
912
import type { UserProfilePasskey } from './user-profile-passkeys-section.view';
1013
import { UserProfileRenamePasskeyDialog } from './user-profile-rename-passkey.dialog';
11-
import { UserProfileSecurityIcon } from './user-profile-security-icon';
1214

1315
export function UserProfilePasskeyRowView({
1416
passkey,
@@ -26,6 +28,10 @@ export function UserProfilePasskeyRowView({
2628
const [name, setName] = useState(passkey.name);
2729
const [isSaving, setIsSaving] = useState(false);
2830
const [error, setError] = useState<string>();
31+
const description =
32+
passkey.createdAtLabel && passkey.lastUsedAtLabel
33+
? fill(m.details, { createdAt: passkey.createdAtLabel, lastUsedAt: passkey.lastUsedAtLabel })
34+
: passkey.createdAtLabel || passkey.lastUsedAtLabel;
2935

3036
const onOpenChange = (nextOpen: boolean) => {
3137
if (isSaving) {
@@ -66,11 +72,22 @@ export function UserProfilePasskeyRowView({
6672
return (
6773
<>
6874
<Section.Item>
69-
<UserProfileSecurityIcon name='passkey' />
75+
<Section.Media size='lg'>
76+
<IconFrame
77+
filled
78+
bordered={false}
79+
>
80+
<Icon
81+
aria-hidden
82+
name='security-passkey'
83+
size='md'
84+
xstyle={styles.icon}
85+
/>
86+
</IconFrame>
87+
</Section.Media>
7088
<Section.Content>
7189
<Section.Label>{passkey.name}</Section.Label>
72-
{passkey.createdAtLabel ? <Section.Description>{passkey.createdAtLabel}</Section.Description> : null}
73-
{passkey.lastUsedAtLabel ? <Section.Description>{passkey.lastUsedAtLabel}</Section.Description> : null}
90+
{description ? <Section.Description>{description}</Section.Description> : null}
7491
</Section.Content>
7592
{actions.length > 0 ? (
7693
<Section.Actions>
@@ -97,3 +114,9 @@ export function UserProfilePasskeyRowView({
97114
</>
98115
);
99116
}
117+
118+
const styles = stylex.create({
119+
icon: {
120+
color: colorVars['--cl-color-neutral-faded'],
121+
},
122+
});

‎packages/ui/src/mosaic/features/user-profile/user-profile-passkeys-section.messages.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export const userProfilePasskeysMessages = {
22
label: 'Passkeys',
33
add: 'Add passkey',
44
empty: 'No passkeys added',
5+
details: '{createdAt} · {lastUsedAt}',
56
manage: 'Manage {name}',
67
rename: 'Rename',
78
renameTitle: 'Rename passkey',

0 commit comments

Comments
 (0)