Skip to content

Commit ea4b48d

Browse files
fix(ui): frame connected account provider icons
1 parent 0d9a5c8 commit ea4b48d

4 files changed

Lines changed: 24 additions & 18 deletions

File tree

‎packages/ui/src/mosaic/user-profile/__tests__/user-profile-profile-panel.view.test.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,17 +241,18 @@ describe('UserProfileProfilePanelView', () => {
241241
expect(onDeleteAccount).toHaveBeenCalledOnce();
242242
});
243243

244-
it('renders connected provider images and Web3 icon frames', () => {
244+
it('renders connected provider and Web3 images inside icon frames', () => {
245245
const { container } = renderView({
246246
connectedAccounts: [{ id: 'google', provider: 'Google', iconUrl: '/google.svg' }],
247247
web3Wallets: [{ id: 'metamask', provider: 'MetaMask', iconUrl: '/metamask.svg' }],
248248
});
249249

250250
const frames = container.querySelectorAll('.cl-icon-frame');
251251
const images = container.querySelectorAll('img');
252-
expect(frames).toHaveLength(1);
252+
expect(frames).toHaveLength(2);
253253
expect(screen.getByRole('img', { name: 'Google' })).toHaveAttribute('src', '/google.svg');
254-
expect(frames[0]).toContainElement(images[1]);
254+
expect(frames[0]).toContainElement(images[0]);
255+
expect(frames[1]).toContainElement(images[1]);
255256
frames.forEach(frame => expect(frame.closest('.cl-section-media')).toHaveAttribute('data-size', 'lg'));
256257
});
257258

‎packages/ui/src/mosaic/user-profile/user-profile-connect-account-row.view.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function UserProfileConnectAccountRowView({
1616
return (
1717
<Section.Row xstyle={styles.connectRow}>
1818
<Section.Item>
19-
<Section.Media size='md'>
19+
<Section.Media size='lg'>
2020
<UserProfileConnectedProviderIcon {...provider} />
2121
</Section.Media>
2222
<Section.Content>

‎packages/ui/src/mosaic/user-profile/user-profile-connected-account-row.view.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function UserProfileConnectedAccountRowView({
3030
return (
3131
<Section.Row>
3232
<Section.Item>
33-
<Section.Media size='md'>
33+
<Section.Media size='lg'>
3434
<UserProfileConnectedProviderIcon {...account} />
3535
</Section.Media>
3636
<Section.Content>
Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
import * as stylex from '@stylexjs/stylex';
22

3+
import { IconFrame } from '../components/icon';
34
import { styles } from './user-profile-connected-accounts.styles';
45

56
export function UserProfileConnectedProviderIcon({ provider, iconUrl }: { provider: string; iconUrl?: string }) {
6-
return iconUrl?.trim() ? (
7-
<img
8-
src={iconUrl.trim()}
9-
alt={provider}
10-
{...stylex.props(styles.icon)}
11-
/>
12-
) : (
13-
<span
14-
aria-hidden
15-
{...stylex.props(styles.fallback)}
16-
>
17-
{provider.trim().charAt(0).toUpperCase()}
18-
</span>
7+
return (
8+
<IconFrame>
9+
{iconUrl?.trim() ? (
10+
<img
11+
src={iconUrl.trim()}
12+
alt={provider}
13+
{...stylex.props(styles.icon)}
14+
/>
15+
) : (
16+
<span
17+
aria-hidden
18+
{...stylex.props(styles.fallback)}
19+
>
20+
{provider.trim().charAt(0).toUpperCase()}
21+
</span>
22+
)}
23+
</IconFrame>
1924
);
2025
}

0 commit comments

Comments
 (0)