From cee08c7641495789a84524fececf0633380a990f Mon Sep 17 00:00:00 2001 From: Stefanos Anagnostou Date: Fri, 15 Dec 2023 03:14:06 +0200 Subject: [PATCH] fix(clerk-js): Use the new rethemed badge (#2370) * fix(clerk-js): Use the new rethemed badge * fix(clerk-js): Remove the checkmark from the active user avatar --- .changeset/gentle-berries-teach.md | 2 ++ .../src/ui/common/NotificationCountBadge.tsx | 14 ++++++-------- .../OrganizationSwitcherPopover.tsx | 9 +++++++-- .../OrganizationSwitcherTrigger.tsx | 8 +++++++- .../OtherOrganizationActions.tsx | 1 + .../ui/components/UserButton/SessionActions.tsx | 1 + .../ui/components/UserButton/UserButtonPopover.tsx | 14 +++----------- packages/clerk-js/src/ui/elements/Actions.tsx | 7 +------ packages/clerk-js/src/ui/primitives/Button.tsx | 8 ++++++++ .../src/ui/primitives/NotificationBadge.tsx | 10 +++++----- 10 files changed, 41 insertions(+), 33 deletions(-) create mode 100644 .changeset/gentle-berries-teach.md diff --git a/.changeset/gentle-berries-teach.md b/.changeset/gentle-berries-teach.md new file mode 100644 index 0000000000..a845151cc8 --- /dev/null +++ b/.changeset/gentle-berries-teach.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/clerk-js/src/ui/common/NotificationCountBadge.tsx b/packages/clerk-js/src/ui/common/NotificationCountBadge.tsx index a3b609a055..03a752a5c0 100644 --- a/packages/clerk-js/src/ui/common/NotificationCountBadge.tsx +++ b/packages/clerk-js/src/ui/common/NotificationCountBadge.tsx @@ -1,4 +1,4 @@ -import { Box, NotificationBadge } from '../customizables'; +import { Flex, NotificationBadge } from '../customizables'; import { useDelayedVisibility, usePrefersReducedMotion } from '../hooks'; import type { ThemableCssProp } from '../styledSystem'; import { animations } from '../styledSystem'; @@ -21,19 +21,17 @@ export const NotificationCountBadge = ({ notificationCount, containerSx }: Notif }); return ( - ({ - position: 'absolute', - top: `-${t.space.$2}`, - right: `-${t.space.$1}`, - width: t.sizes.$2, - height: t.sizes.$2, + marginLeft: t.space.$1x5, }), containerSx, ]} > {showNotification && {notificationCount}} - + ); }; diff --git a/packages/clerk-js/src/ui/components/OrganizationSwitcher/OrganizationSwitcherPopover.tsx b/packages/clerk-js/src/ui/components/OrganizationSwitcher/OrganizationSwitcherPopover.tsx index 86013ff0c1..accc19ef68 100644 --- a/packages/clerk-js/src/ui/components/OrganizationSwitcher/OrganizationSwitcherPopover.tsx +++ b/packages/clerk-js/src/ui/components/OrganizationSwitcher/OrganizationSwitcherPopover.tsx @@ -127,7 +127,7 @@ export const OrganizationSwitcherPopover = React.forwardRef} + trailing={} /> ); @@ -205,6 +205,7 @@ export const OrganizationSwitcherPopover = React.forwardRef ({ padding: `${t.space.$4} ${t.space.$5}`, borderBottom: `${t.borders.$normal} ${t.colors.$blackAlpha100}`, + width: '100%', })} title={localizationKeys('organizationSwitcher.personalWorkspace')} /> @@ -232,9 +233,13 @@ const NotificationCountBadgeManageButton = withGate( membershipRequests: isDomainsEnabled || undefined, }); + if (!membershipRequests?.count) { + return null; + } + return ( ); diff --git a/packages/clerk-js/src/ui/components/OrganizationSwitcher/OrganizationSwitcherTrigger.tsx b/packages/clerk-js/src/ui/components/OrganizationSwitcher/OrganizationSwitcherTrigger.tsx index 8b8ff0502c..afe8ed2852 100644 --- a/packages/clerk-js/src/ui/components/OrganizationSwitcher/OrganizationSwitcherTrigger.tsx +++ b/packages/clerk-js/src/ui/components/OrganizationSwitcher/OrganizationSwitcherTrigger.tsx @@ -91,10 +91,16 @@ const NotificationCountBadgeSwitcherTrigger = () => { const notificationCount = (userInvitations.count || 0) + (userSuggestions.count || 0) + (membershipRequests?.count || 0); + if (!notificationCount) { + return null; + } + return ( ({ - marginLeft: `${t.space.$2}`, + position: 'absolute', + top: `-${t.space.$2}`, + right: 0, })} notificationCount={notificationCount} /> diff --git a/packages/clerk-js/src/ui/components/OrganizationSwitcher/OtherOrganizationActions.tsx b/packages/clerk-js/src/ui/components/OrganizationSwitcher/OtherOrganizationActions.tsx index d5c4c0e0b7..ea566e99a5 100644 --- a/packages/clerk-js/src/ui/components/OrganizationSwitcher/OtherOrganizationActions.tsx +++ b/packages/clerk-js/src/ui/components/OrganizationSwitcher/OtherOrganizationActions.tsx @@ -33,6 +33,7 @@ const CreateOrganizationButton = ({ label={localizationKeys('organizationSwitcher.action__createOrganization')} onClick={onCreateOrganizationClick} sx={t => ({ + borderBottom: 'none', color: t.colors.$blackAlpha600, ':hover': { color: t.colors.$blackAlpha600, diff --git a/packages/clerk-js/src/ui/components/UserButton/SessionActions.tsx b/packages/clerk-js/src/ui/components/UserButton/SessionActions.tsx index 470cd2e566..b4e95eefdf 100644 --- a/packages/clerk-js/src/ui/components/UserButton/SessionActions.tsx +++ b/packages/clerk-js/src/ui/components/UserButton/SessionActions.tsx @@ -48,6 +48,7 @@ export const SingleSessionActions = (props: SessionActionsProps) => { t => ({ borderBottomLeftRadius: t.radii.$lg, borderBottomRightRadius: t.radii.$lg, + borderBottom: 'none', ':hover': { backgroundColor: t.colors.$danger50, color: t.colors.$danger400, diff --git a/packages/clerk-js/src/ui/components/UserButton/UserButtonPopover.tsx b/packages/clerk-js/src/ui/components/UserButton/UserButtonPopover.tsx index 061643f13a..6e99a56c16 100644 --- a/packages/clerk-js/src/ui/components/UserButton/UserButtonPopover.tsx +++ b/packages/clerk-js/src/ui/components/UserButton/UserButtonPopover.tsx @@ -3,9 +3,9 @@ import type { ActiveSessionResource } from '@clerk/types'; import React from 'react'; import { useEnvironment, useUserButtonContext } from '../../contexts'; -import { descriptors, Icon, localizationKeys } from '../../customizables'; +import { descriptors, localizationKeys } from '../../customizables'; import { Action, Actions, PopoverCard, PreviewButton, RootBox, SecondaryActions, UserPreview } from '../../elements'; -import { Add, CheckmarkFilled, SignOut, SwitchArrowRight } from '../../icons'; +import { Add, SignOut, SwitchArrowRight } from '../../icons'; import type { PropsOfComponent } from '../../styledSystem'; import { MultiSessionActions, SingleSessionActions } from './SessionActions'; import { useMultisessionActions } from './useMultisessionActions'; @@ -69,7 +69,7 @@ export const UserButtonPopover = React.forwardRef ({ - color: t.colors.$blackAlpha700, + color: t.colors.$blackAlpha600, padding: `${t.space.$2} ${t.space.$3}`, borderBottom: 'none', borderRadius: t.radii.$lg, @@ -85,7 +85,6 @@ export const UserButtonPopover = React.forwardRef ({ - height: t.sizes.$20, borderRadius: 0, borderBottom: `${t.borders.$normal} ${t.colors.$blackAlpha100}`, backgroundColor: t.colors.$colorBackground, @@ -116,13 +115,6 @@ export const UserButtonPopover = React.forwardRef ({ padding: `${t.space.$4} ${t.space.$5}`, })} - icon={ - ({ width: t.sizes.$3x5, height: t.sizes.$3x5 })} - /> - } - iconSx={t => ({ left: 'unset', right: 0, color: t.colors.$primary500 })} /> {authConfig.singleSessionMode ? ( ) => { elementDescriptor={iconBoxElementDescriptor} elementId={iconBoxElementId} justify='center' - // sx={[theme => ({ flex: `0 0 ${theme.sizes.$9}` }), iconBoxSx]} > {status.isLoading ? ( { return (