-
Notifications
You must be signed in to change notification settings - Fork 112
/
AccountSwitcherExamples.ts
63 lines (62 loc) · 2.16 KB
/
AccountSwitcherExamples.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
export const accountSwitcherExample = `
const AccountSwitcherMenu = () => {
const accountSwitcher = useAccountSwitcherState();
const [selectedAccount, setSelectedAccount] = React.useState('Owl Telehealth');
return (
<>
<AccountSwitcherBadge {...accountSwitcher} i18nButtonLabel="Switch accounts">
Owl Telehealth
</AccountSwitcherBadge>
<AccountSwitcher {...accountSwitcher} aria-label="Avaiable accounts">
<AccountSwitcherGroup label="Recent accounts">
<AccountSwitcherItemRadio
name="recent_accounts"
value="Owl Telehealth"
checked={selectedAccount === 'Owl Telehealth'}
onChange={() => setSelectedAccount('Owl Telehealth')}
{...accountSwitcher}
>
Owl Telehealth
</AccountSwitcherItemRadio>
<AccountSwitcherItemRadio
name="recent_accounts"
value="Owl Health Demo"
checked={selectedAccount === 'Owl Health Demo'}
onChange={() => setSelectedAccount('Owl Health Demo')}
{...accountSwitcher}
>
Owl Health Demo
</AccountSwitcherItemRadio>
<AccountSwitcherItemRadio
name="recent_accounts"
value="Owl Subway"
checked={selectedAccount === 'Owl Subway'}
onChange={() => setSelectedAccount('Owl Subway')}
{...accountSwitcher}
>
Owl Subway
</AccountSwitcherItemRadio>
</AccountSwitcherGroup>
<AccountSwitcherSeparator />
<AccountSwitcherItem {...accountSwitcher} href="#">
Account settings
</AccountSwitcherItem>
<AccountSwitcherSeparator />
<AccountSwitcherItem {...accountSwitcher} href="#">
View all accounts
</AccountSwitcherItem>
<AccountSwitcherItem {...accountSwitcher} href="#">
View all subaccounts
</AccountSwitcherItem>
<AccountSwitcherSeparator />
<AccountSwitcherItem {...accountSwitcher} href="#">
Admin Center
</AccountSwitcherItem>
</AccountSwitcher>
</>
);
};
render(
<AccountSwitcherMenu />
)
`.trim();