Skip to content

Commit fafe1f9

Browse files
committed
Add mobile header
1 parent 0796911 commit fafe1f9

2 files changed

Lines changed: 109 additions & 0 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { Route, Switch } from '@/router';
1616

1717
import { ConfigureSSOProvider, useConfigureSSO } from './ConfigureSSOContext';
1818
import { ConfigureSSOHeader } from './ConfigureSSOHeader';
19+
import { ConfigureSSOMobileHeader } from './ConfigureSSOMobileHeader';
1920
import { ConfigureSSONavbar } from './ConfigureSSONavbar';
2021
import { ConfigureSSOSkeleton } from './ConfigureSSOSkeleton';
2122
import { ProfileCardFooter, ProfileCardHeader } from './elements/ProfileCard';
@@ -58,6 +59,7 @@ const AuthenticatedContent = withCoreUserGuard(() => {
5859
flex: 1,
5960
})}
6061
>
62+
<ConfigureSSOMobileHeader />
6163
<ConfigureSSOContent contentRef={contentRef} />
6264
</Col>
6365
</ConfigureSSONavbar>
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
import { __internal_useOrganizationBase } from '@clerk/shared/react';
2+
3+
import { useEnvironment } from '@/contexts';
4+
import { Box, Col, Flex, Heading, Icon, localizationKeys, Text, useAppearance } from '@/customizables';
5+
import { ApplicationLogo } from '@/elements/ApplicationLogo';
6+
import { BoxIcon } from '@/icons';
7+
import { mqu } from '@/styledSystem';
8+
9+
export const ConfigureSSOMobileHeader = () => {
10+
const { parsedOptions } = useAppearance();
11+
const {
12+
organizationSettings,
13+
displayConfig: { applicationName, logoImageUrl },
14+
} = useEnvironment();
15+
16+
const hasLogo = Boolean(parsedOptions.logoImageUrl || logoImageUrl);
17+
18+
return (
19+
<Col
20+
as='header'
21+
sx={t => ({
22+
display: 'none',
23+
[mqu.md]: {
24+
display: 'flex',
25+
},
26+
gap: t.space.$4,
27+
padding: t.space.$5,
28+
borderBottomWidth: t.borderWidths.$normal,
29+
borderBottomStyle: t.borderStyles.$solid,
30+
borderBottomColor: t.colors.$borderAlpha100,
31+
})}
32+
>
33+
<Flex
34+
align='center'
35+
sx={t => ({
36+
gap: t.space.$2,
37+
maxWidth: '100%',
38+
})}
39+
>
40+
{hasLogo ? (
41+
<ApplicationLogo
42+
sx={t => ({
43+
width: t.space.$9,
44+
height: t.space.$9,
45+
borderRadius: t.radii.$md,
46+
overflow: 'hidden',
47+
})}
48+
/>
49+
) : (
50+
<Box
51+
sx={t => ({
52+
width: t.space.$9,
53+
height: t.space.$9,
54+
flexShrink: 0,
55+
borderRadius: t.radii.$md,
56+
backgroundColor: t.colors.$primary500,
57+
color: t.colors.$colorPrimaryForeground,
58+
display: 'flex',
59+
alignItems: 'center',
60+
justifyContent: 'center',
61+
})}
62+
aria-hidden
63+
>
64+
<Icon
65+
icon={BoxIcon}
66+
sx={t => ({ width: t.sizes.$4, height: t.sizes.$4 })}
67+
/>
68+
</Box>
69+
)}
70+
71+
<Col sx={{ minWidth: 0 }}>
72+
<Text
73+
as='p'
74+
truncate
75+
>
76+
{applicationName}
77+
</Text>
78+
{organizationSettings.enabled && <OrganizationSubtitle />}
79+
</Col>
80+
</Flex>
81+
82+
<Heading
83+
as='h3'
84+
localizationKey={localizationKeys('configureSSO.navbar.title')}
85+
sx={t => ({ fontSize: t.fontSizes.$lg })}
86+
/>
87+
</Col>
88+
);
89+
};
90+
91+
const OrganizationSubtitle = (): JSX.Element | null => {
92+
const organization = __internal_useOrganizationBase();
93+
94+
if (!organization) {
95+
return null;
96+
}
97+
98+
return (
99+
<Text
100+
as='span'
101+
truncate
102+
sx={t => ({ color: t.colors.$colorMutedForeground })}
103+
>
104+
{organization.name}
105+
</Text>
106+
);
107+
};

0 commit comments

Comments
 (0)