Skip to content

Commit ac15fbc

Browse files
committed
Refactor AccountConnection with new layout and type components
1 parent 0be40aa commit ac15fbc

File tree

2 files changed

+19
-31
lines changed

2 files changed

+19
-31
lines changed

polaris-react/src/components/AccountConnection/AccountConnection.scss

Lines changed: 0 additions & 10 deletions
This file was deleted.

polaris-react/src/components/AccountConnection/AccountConnection.tsx

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import React from 'react';
33
import type {Action} from '../../types';
44
import {Avatar} from '../Avatar';
55
import {buttonFrom} from '../Button';
6-
import {Card} from '../Card';
7-
import {Stack} from '../Stack';
8-
import {TextStyle} from '../TextStyle';
96
import {SettingAction} from '../SettingAction';
10-
11-
import styles from './AccountConnection.scss';
7+
import {AlphaCard} from '../AlphaCard';
8+
import {Box} from '../Box';
9+
import {Inline} from '../Inline';
10+
import {Text} from '../Text';
11+
import {AlphaStack} from '../AlphaStack';
1212

1313
export interface AccountConnectionProps {
1414
/** Content to display as title */
@@ -54,39 +54,37 @@ export function AccountConnection({
5454

5555
let titleMarkup: React.ReactNode = null;
5656
if (title) {
57-
titleMarkup = <div>{title}</div>;
57+
titleMarkup = <>{title}</>;
5858
} else if (accountName) {
59-
titleMarkup = <div>{accountName}</div>;
59+
titleMarkup = <>{accountName}</>;
6060
}
6161

6262
const detailsMarkup = details ? (
63-
<div>
64-
<TextStyle variation="subdued">{details}</TextStyle>
65-
</div>
63+
<Text as="span" variant="bodyMd" color="subdued">
64+
{details}
65+
</Text>
6666
) : null;
6767

6868
const termsOfServiceMarkup = termsOfService ? (
69-
<div className={styles.TermsOfService}>{termsOfService}</div>
69+
<Box paddingTop="5">{termsOfService}</Box>
7070
) : null;
7171

7272
const actionElement = action
7373
? buttonFrom(action, {primary: !connected})
7474
: null;
7575

7676
return (
77-
<Card sectioned>
77+
<AlphaCard>
7878
<SettingAction action={actionElement}>
79-
<Stack>
79+
<Inline spacing="4">
8080
{avatarMarkup}
81-
<Stack.Item fill>
82-
<div className={styles.Content}>
83-
{titleMarkup}
84-
{detailsMarkup}
85-
</div>
86-
</Stack.Item>
87-
</Stack>
81+
<AlphaStack spacing="2">
82+
{titleMarkup}
83+
{detailsMarkup}
84+
</AlphaStack>
85+
</Inline>
8886
</SettingAction>
8987
{termsOfServiceMarkup}
90-
</Card>
88+
</AlphaCard>
9189
);
9290
}

0 commit comments

Comments
 (0)