Skip to content

Commit 1426e5e

Browse files
authored
feat(clerk-js): Update ui of OrganizationSwitcher to better match OrganizationList (#1675)
* chore(types,localizations): Remove unused localization keys * feat(clerk-js): Update ui of OrganizationSwitcher to better match OrganizationList As part of this commit, was also some refactoring of duplicate code between the list of suggestions and invitations * chore(clerk-js): Add changeset * test(clerk-js): Test helpers for populateCache of swr mutate * chore(clerk-js): Remove unnecessary optional channing
1 parent 5be0c62 commit 1426e5e

File tree

12 files changed

+355
-409
lines changed

12 files changed

+355
-409
lines changed

.changeset/popular-sloths-mate.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@clerk/localizations': patch
3+
'@clerk/clerk-js': patch
4+
'@clerk/types': patch
5+
---
6+
7+
Organization Switcher now diplays organization invitations and suggestions in a more compact form.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { forwardRef } from 'react';
2+
3+
import { Box, Spinner } from '../customizables';
4+
5+
export const InfiniteListSpinner = forwardRef<HTMLDivElement>((_, ref) => {
6+
return (
7+
<Box
8+
ref={ref}
9+
sx={t => ({
10+
width: '100%',
11+
height: t.space.$12,
12+
position: 'relative',
13+
})}
14+
>
15+
<Box
16+
sx={{
17+
margin: 'auto',
18+
position: 'absolute',
19+
left: '50%',
20+
top: '50%',
21+
transform: 'translateY(-50%) translateX(-50%)',
22+
}}
23+
>
24+
<Spinner
25+
size='md'
26+
colorScheme='primary'
27+
/>
28+
</Box>
29+
</Box>
30+
);
31+
});

packages/clerk-js/src/ui/common/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export * from './BlockButtons';
22
export * from './constants';
33
export * from './CalloutWithAction';
44
export * from './forms';
5+
export * from './InfiniteListSpinner';
56
export * from './redirects';
67
export * from './verification';
78
export * from './withRedirectToHome';

packages/clerk-js/src/ui/components/OrganizationSwitcher/OtherOrganizationActions.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ import { Plus } from '../../../ui/icons';
44
import { useCoreUser } from '../../contexts';
55
import { descriptors, localizationKeys } from '../../customizables';
66
import { Action, SecondaryActions } from '../../elements';
7-
import { UserInvitationList } from './UserInvitationList';
7+
import { UserInvitationSuggestionList } from './UserInvitationSuggestionList';
88
import type { UserMembershipListProps } from './UserMembershipList';
99
import { UserMembershipList } from './UserMembershipList';
10-
import { UserSuggestionList } from './UserSuggestionList';
1110

1211
export interface OrganizationActionListProps extends UserMembershipListProps {
1312
onCreateOrganizationClick: React.MouseEventHandler;
@@ -43,11 +42,12 @@ export const OrganizationActionList = (props: OrganizationActionListProps) => {
4342
const { onCreateOrganizationClick, onPersonalWorkspaceClick, onOrganizationClick } = props;
4443

4544
return (
46-
<SecondaryActions elementDescriptor={descriptors.organizationSwitcherPopoverActions}>
47-
<UserMembershipList {...{ onPersonalWorkspaceClick, onOrganizationClick }} />
48-
<UserInvitationList />
49-
<UserSuggestionList />
50-
<CreateOrganizationButton {...{ onCreateOrganizationClick }} />
51-
</SecondaryActions>
45+
<>
46+
<UserInvitationSuggestionList />
47+
<SecondaryActions elementDescriptor={descriptors.organizationSwitcherPopoverActions}>
48+
<UserMembershipList {...{ onPersonalWorkspaceClick, onOrganizationClick }} />
49+
<CreateOrganizationButton {...{ onCreateOrganizationClick }} />
50+
</SecondaryActions>
51+
</>
5252
);
5353
};

packages/clerk-js/src/ui/components/OrganizationSwitcher/UserInvitationList.tsx

-166
This file was deleted.

0 commit comments

Comments
 (0)