Skip to content

Commit

Permalink
feat(clerk-js): Update ui of OrganizationSwitcher to better match Org…
Browse files Browse the repository at this point in the history
…anizationList (#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
  • Loading branch information
panteliselef authored Sep 5, 2023
1 parent 5be0c62 commit 1426e5e
Show file tree
Hide file tree
Showing 12 changed files with 355 additions and 409 deletions.
7 changes: 7 additions & 0 deletions .changeset/popular-sloths-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@clerk/localizations': patch
'@clerk/clerk-js': patch
'@clerk/types': patch
---

Organization Switcher now diplays organization invitations and suggestions in a more compact form.
31 changes: 31 additions & 0 deletions packages/clerk-js/src/ui/common/InfiniteListSpinner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { forwardRef } from 'react';

import { Box, Spinner } from '../customizables';

export const InfiniteListSpinner = forwardRef<HTMLDivElement>((_, ref) => {
return (
<Box
ref={ref}
sx={t => ({
width: '100%',
height: t.space.$12,
position: 'relative',
})}
>
<Box
sx={{
margin: 'auto',
position: 'absolute',
left: '50%',
top: '50%',
transform: 'translateY(-50%) translateX(-50%)',
}}
>
<Spinner
size='md'
colorScheme='primary'
/>
</Box>
</Box>
);
});
1 change: 1 addition & 0 deletions packages/clerk-js/src/ui/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export * from './BlockButtons';
export * from './constants';
export * from './CalloutWithAction';
export * from './forms';
export * from './InfiniteListSpinner';
export * from './redirects';
export * from './verification';
export * from './withRedirectToHome';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import { Plus } from '../../../ui/icons';
import { useCoreUser } from '../../contexts';
import { descriptors, localizationKeys } from '../../customizables';
import { Action, SecondaryActions } from '../../elements';
import { UserInvitationList } from './UserInvitationList';
import { UserInvitationSuggestionList } from './UserInvitationSuggestionList';
import type { UserMembershipListProps } from './UserMembershipList';
import { UserMembershipList } from './UserMembershipList';
import { UserSuggestionList } from './UserSuggestionList';

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

return (
<SecondaryActions elementDescriptor={descriptors.organizationSwitcherPopoverActions}>
<UserMembershipList {...{ onPersonalWorkspaceClick, onOrganizationClick }} />
<UserInvitationList />
<UserSuggestionList />
<CreateOrganizationButton {...{ onCreateOrganizationClick }} />
</SecondaryActions>
<>
<UserInvitationSuggestionList />
<SecondaryActions elementDescriptor={descriptors.organizationSwitcherPopoverActions}>
<UserMembershipList {...{ onPersonalWorkspaceClick, onOrganizationClick }} />
<CreateOrganizationButton {...{ onCreateOrganizationClick }} />
</SecondaryActions>
</>
);
};

This file was deleted.

Loading

0 comments on commit 1426e5e

Please sign in to comment.