Skip to content

Commit

Permalink
feat(clerk-js,types): Update OrganizationPreview appearance descripto…
Browse files Browse the repository at this point in the history
…rs for OrganizationSwitcher (#2158)

* feat(clerk-js,types): Add id's to the organizationPreview descriptor to allow better customization

* feat(clerk-js): Apply changes to ui.retheme

* chore(repo): Added Changeset

* fix(clerk-js): Use the correct element id for the invitation preview
  • Loading branch information
octoper authored and desiprisg committed Nov 23, 2023
1 parent e569dea commit 75b9625
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .changeset/wise-lions-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@clerk/clerk-js': major
'@clerk/types': patch
---

Introducing some changes and some addition for the appearence descriptors for the organization preview in `<OrganizationSwitcher/>`:
- `.cl-organizationPreview__organizationSwitcher` has been renamed to `.cl-organizationPreview__organizationSwitcherTrigger`.
- `.cl-organizationPreview__organizationSwitcherListedOrganization` was added to allow you to customize the appearance of all the listed organization previews.
- `.cl-organizationPreview__organizationSwitcherActiveOrganizationn` was added to allow you to customize the appearance of the active organization.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const OrganizationSwitcherPopover = React.forwardRef<HTMLDivElement, Orga
{currentOrg ? (
<>
<OrganizationPreview
elementId={'organizationSwitcher'}
elementId={'organizationSwitcherActiveOrganization'}
gap={4}
organization={currentOrg}
user={user}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const OrganizationSwitcherTrigger = withAvatarShimmer(
>
{organization && (
<OrganizationPreview
elementId={'organizationSwitcher'}
elementId={'organizationSwitcherTrigger'}
gap={3}
size={'sm'}
organization={organization}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const InvitationPreview = withCardStateProvider(
})}
>
<OrganizationPreview
elementId='organizationSwitcher'
elementId='organizationSwitcherListedOrganization'
avatarSx={t => ({ margin: `0 calc(${t.space.$3}/2)` })}
organization={publicOrganizationData}
size='sm'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const UserMembershipList = (props: UserMembershipListProps) => {
role='menuitem'
>
<OrganizationPreview
elementId='organizationSwitcher'
elementId='organizationSwitcherListedOrganization'
avatarSx={t => ({ margin: `0 calc(${t.space.$3}/2)` })}
organization={organization}
size='sm'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const OrganizationSwitcherPopover = React.forwardRef<HTMLDivElement, Orga
{currentOrg ? (
<>
<OrganizationPreview
elementId={'organizationSwitcher'}
elementId={'organizationSwitcherActiveOrganization'}
gap={4}
organization={currentOrg}
user={user}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const OrganizationSwitcherTrigger = withAvatarShimmer(
>
{organization && (
<OrganizationPreview
elementId={'organizationSwitcher'}
elementId={'organizationSwitcherTrigger'}
gap={3}
size={'sm'}
organization={organization}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const InvitationPreview = withCardStateProvider(
})}
>
<OrganizationPreview
elementId='organizationSwitcher'
elementId='organizationSwitcherListedOrganization'
avatarSx={t => ({ margin: `0 calc(${t.space.$3}/2)` })}
organization={publicOrganizationData}
size='sm'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const UserMembershipList = (props: UserMembershipListProps) => {
role='menuitem'
>
<OrganizationPreview
elementId='organizationSwitcher'
elementId='organizationSwitcherListedOrganization'
avatarSx={t => ({ margin: `0 calc(${t.space.$3}/2)` })}
organization={organization}
size='sm'
Expand Down
6 changes: 5 additions & 1 deletion packages/types/src/elementIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ export type ProfileSectionId =
export type ProfilePageId = 'account' | 'security' | 'organizationSettings' | 'organizationMembers';

export type UserPreviewId = 'userButton' | 'personalWorkspace';
export type OrganizationPreviewId = 'organizationSwitcher' | 'organizationList';
export type OrganizationPreviewId =
| 'organizationSwitcherTrigger'
| 'organizationList'
| 'organizationSwitcherListedOrganization'
| 'organizationSwitcherActiveOrganization';

export type FooterActionId = 'havingTrouble' | 'alternativeMethods' | 'signUp' | 'signIn';

Expand Down

0 comments on commit 75b9625

Please sign in to comment.