Skip to content

Commit 1949c6d

Browse files
committed
Display box icon as fallback
1 parent 40f96f9 commit 1949c6d

4 files changed

Lines changed: 45 additions & 13 deletions

File tree

packages/react/src/isomorphicClerk.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ import { inBrowser } from '@clerk/shared/browser';
22
import { clerkEvents, createClerkEventBus } from '@clerk/shared/clerkEventBus';
33
import { loadClerkJSScript, loadClerkUIScript } from '@clerk/shared/loadClerkJsScript';
44
import type {
5+
__experimental_ConfigureSSOProps,
56
__internal_AttemptToEnableEnvironmentSettingParams,
67
__internal_AttemptToEnableEnvironmentSettingResult,
78
__internal_CheckoutProps,
89
__internal_EnableOrganizationsPromptProps,
9-
OAuthConsentProps,
10+
__internal_OAuthConsentProps,
1011
__internal_PlanDetailsProps,
1112
__internal_SubscriptionDetailsProps,
1213
__internal_UserVerificationModalProps,
@@ -25,7 +26,6 @@ import type {
2526
ClerkOptions,
2627
ClerkStatus,
2728
ClientResource,
28-
__experimental_ConfigureSSOProps,
2929
CreateOrganizationParams,
3030
CreateOrganizationProps,
3131
DomainOrProxyUrl,
@@ -37,7 +37,6 @@ import type {
3737
ListenerOptions,
3838
LoadedClerk,
3939
OAuthApplicationNamespace,
40-
OAuthConsentProps,
4140
OrganizationListProps,
4241
OrganizationProfileProps,
4342
OrganizationResource,
@@ -161,7 +160,7 @@ export class IsomorphicClerk implements IsomorphicLoadedClerk {
161160
private premountPricingTableNodes = new Map<HTMLDivElement, PricingTableProps | undefined>();
162161
private premountAPIKeysNodes = new Map<HTMLDivElement, APIKeysProps | undefined>();
163162
private premountConfigureSSONodes = new Map<HTMLDivElement, __experimental_ConfigureSSOProps | undefined>();
164-
private premountOAuthConsentNodes = new Map<HTMLDivElement, OAuthConsentProps | undefined>();
163+
private premountOAuthConsentNodes = new Map<HTMLDivElement, __internal_OAuthConsentProps | undefined>();
165164
private premountTaskChooseOrganizationNodes = new Map<HTMLDivElement, TaskChooseOrganizationProps | undefined>();
166165
private premountTaskResetPasswordNodes = new Map<HTMLDivElement, TaskResetPasswordProps | undefined>();
167166
private premountTaskSetupMFANodes = new Map<HTMLDivElement, TaskSetupMFAProps | undefined>();
@@ -1305,7 +1304,7 @@ export class IsomorphicClerk implements IsomorphicLoadedClerk {
13051304
}
13061305
};
13071306

1308-
__internal_mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
1307+
__internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
13091308
if (this.clerkjs && this.loaded) {
13101309
this.clerkjs.__internal_mountOAuthConsent(node, props);
13111310
} else {
@@ -1321,7 +1320,7 @@ export class IsomorphicClerk implements IsomorphicLoadedClerk {
13211320
}
13221321
};
13231322

1324-
mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
1323+
mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
13251324
this.__internal_mountOAuthConsent(node, props);
13261325
};
13271326

packages/ui/src/components/ConfigureSSO/ConfigureSSO.tsx

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
import { useOrganization } from '@clerk/shared/react/index';
12
import type { __experimental_ConfigureSSOProps } from '@clerk/shared/types';
23
import React from 'react';
34

45
import { useEnvironment, withCoreUserGuard } from '@/contexts';
5-
import { Col, Flex, Flow, localizationKeys, Text } from '@/customizables';
6+
import { Box, Col, Flex, Flow, Icon, localizationKeys, Text, useAppearance } from '@/customizables';
67
import { ApplicationLogo } from '@/elements/ApplicationLogo';
78
import { withCardStateProvider } from '@/elements/contexts';
89
import { NavBar, NavbarContextProvider } from '@/elements/Navbar';
910
import { ProfileCard } from '@/elements/ProfileCard';
11+
import { BoxIcon } from '@/icons';
1012
import { Route, Switch } from '@/router';
11-
import { useOrganization } from '@clerk/shared/react/index';
1213

1314
const ConfigureSSOInternal = () => {
1415
return (
@@ -26,8 +27,10 @@ const ConfigureSSOInternal = () => {
2627

2728
const AuthenticatedContent = withCoreUserGuard(() => {
2829
const contentRef = React.useRef<HTMLDivElement>(null);
29-
const { applicationName } = useEnvironment().displayConfig;
30+
const { applicationName, logoImageUrl } = useEnvironment().displayConfig;
3031
const { organizationSettings } = useEnvironment();
32+
const { parsedOptions } = useAppearance();
33+
const hasLogo = Boolean(parsedOptions.logoImageUrl || logoImageUrl);
3134

3235
return (
3336
<ProfileCard.Root
@@ -37,17 +40,40 @@ const AuthenticatedContent = withCoreUserGuard(() => {
3740
<NavBar
3841
header={
3942
<Flex
43+
align='center'
4044
sx={t => ({
4145
gap: t.space.$2,
4246
padding: `${t.space.$none} ${t.space.$3}`,
4347
maxWidth: '100%',
4448
})}
4549
>
46-
<ApplicationLogo
47-
sx={t => ({ width: t.space.$9, height: t.space.$9, borderRadius: t.radii.$md, overflow: 'hidden' })}
48-
/>
50+
{hasLogo ? (
51+
<ApplicationLogo
52+
sx={t => ({ width: t.space.$9, height: t.space.$9, borderRadius: t.radii.$md, overflow: 'hidden' })}
53+
/>
54+
) : (
55+
<Box
56+
sx={t => ({
57+
width: t.space.$9,
58+
height: t.space.$9,
59+
flexShrink: 0,
60+
borderRadius: t.radii.$md,
61+
backgroundColor: t.colors.$primary500,
62+
color: t.colors.$colorPrimaryForeground,
63+
display: 'flex',
64+
alignItems: 'center',
65+
justifyContent: 'center',
66+
})}
67+
aria-hidden
68+
>
69+
<Icon
70+
icon={BoxIcon}
71+
sx={t => ({ width: t.sizes.$4, height: t.sizes.$4 })}
72+
/>
73+
</Box>
74+
)}
4975

50-
<Col sx={t => ({ gap: t.space.$0x5, minWidth: 0 })}>
76+
<Col sx={{ minWidth: 0 }}>
5177
<Text
5278
as='p'
5379
truncate
@@ -71,6 +97,11 @@ const AuthenticatedContent = withCoreUserGuard(() => {
7197

7298
const OrganizationSubtitle = () => {
7399
const { organization } = useOrganization();
100+
101+
if (!organization) {
102+
return null;
103+
}
104+
74105
return (
75106
<Text
76107
as='span'

packages/ui/src/icons/box.svg

Lines changed: 1 addition & 0 deletions
Loading

packages/ui/src/icons/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export { default as ArrowsUpDown } from './arrows-up-down.svg';
1313
export { default as AuthApp } from './auth-app.svg';
1414
export { default as Billing } from './billing.svg';
1515
export { default as Block } from './block.svg';
16+
export { default as BoxIcon } from './box.svg';
1617
export { default as Caret } from './caret.svg';
1718
export { default as CaretLeft } from './caret-left.svg';
1819
export { default as CaretRight } from './caret-right.svg';

0 commit comments

Comments
 (0)