Skip to content

Commit 0893768

Browse files
feat: animate height of switch (#7263)
Co-authored-by: Laura Beatris <48022589+LauraBeatris@users.noreply.github.com>
1 parent 82618fd commit 0893768

File tree

1 file changed

+30
-10
lines changed
  • packages/clerk-js/src/ui/components/devPrompts/EnableOrganizationsPrompt

1 file changed

+30
-10
lines changed

packages/clerk-js/src/ui/components/devPrompts/EnableOrganizationsPrompt/index.tsx

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Modal } from '@/ui/elements/Modal';
1111
import { common, InternalThemeProvider } from '@/ui/styledSystem';
1212

1313
import { DevTools } from '../../../../core/resources/DevTools';
14-
import { Flex, Span } from '../../../customizables';
14+
import { Box, Flex, Span } from '../../../customizables';
1515
import { Portal } from '../../../elements/Portal';
1616
import { basePromptElementStyles, handleDashboardUrlParsing, PromptContainer, PromptSuccessIcon } from '../shared';
1717

@@ -291,15 +291,35 @@ const EnableOrganizationsPromptInternal = ({
291291
)}
292292
</Flex>
293293

294-
{!isEnabled && hasPersonalAccountsEnabled && (
295-
<Flex sx={t => ({ marginTop: t.sizes.$3 })}>
296-
<Switch
297-
label='Allow personal account'
298-
description='This is an uncommon setting, meant for applications that sell to both organizations and individual users. Most B2B applications require users to be part of an organization, and should keep this setting disabled.'
299-
checked={allowPersonalAccount}
300-
onChange={() => setAllowPersonalAccount(prev => !prev)}
301-
/>
302-
</Flex>
294+
{hasPersonalAccountsEnabled && (
295+
<Box
296+
sx={t => ({
297+
display: 'grid',
298+
gridTemplateRows: isEnabled ? '0fr' : '1fr',
299+
transition: `grid-template-rows ${t.transitionDuration.$slower} ${t.transitionTiming.$slowBezier}`,
300+
marginInline: '-0.5rem',
301+
overflow: 'hidden',
302+
})}
303+
{...(isEnabled && { inert: '' })}
304+
>
305+
<Flex
306+
sx={t => ({
307+
minHeight: 0,
308+
paddingInline: '0.5rem',
309+
opacity: isEnabled ? 0 : 1,
310+
transition: `opacity ${t.transitionDuration.$slower} ${t.transitionTiming.$slowBezier}`,
311+
})}
312+
>
313+
<Flex sx={t => ({ marginTop: t.sizes.$2 })}>
314+
<Switch
315+
label='Allow personal account'
316+
description='Allow users to work outside of an organization by providing a personal account. We do not recommend for B2B SaaS apps.'
317+
checked={allowPersonalAccount}
318+
onChange={() => setAllowPersonalAccount(prev => !prev)}
319+
/>
320+
</Flex>
321+
</Flex>
322+
</Box>
303323
)}
304324
</Flex>
305325

0 commit comments

Comments
 (0)