Skip to content

Commit bd8b697

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

3 files changed

Lines changed: 40 additions & 7 deletions

File tree

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)