Skip to content

Commit bc451f7

Browse files
Meryem Kaftarpanteliselef
authored andcommitted
fix(clerk-js): Keyless toast's collapse behavior (#4855)
Co-authored-by: panteliselef <panteliselef@outlook.com>
1 parent 002207a commit bc451f7

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

.changeset/shaggy-otters-hug.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
---
4+
5+
Updates Keyless UI to automatically expand when the application has been claimed.

packages/clerk-js/src/ui/components/KeylessPrompt/index.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
2424
const [isExpanded, setIsExpanded] = useState(true);
2525
const claimed = Boolean(useRevalidateEnvironment().authConfig.claimedAt);
2626

27+
const isForcedExpanded = claimed || isExpanded;
28+
2729
return (
2830
<Portal>
2931
<Flex
30-
data-expanded={isExpanded}
32+
data-expanded={isForcedExpanded}
3133
align='center'
3234
sx={t => ({
3335
position: 'fixed',
@@ -61,7 +63,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
6163
>
6264
<button
6365
type='button'
64-
aria-expanded={isExpanded}
66+
aria-expanded={isForcedExpanded}
6567
aria-controls={contentIdentifier}
6668
id={buttonIdentifier}
6769
onClick={() => !claimed && setIsExpanded(prev => !prev)}
@@ -103,7 +105,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
103105
width: 1rem;
104106
height: 1rem;
105107
transform-style: preserve-3d;
106-
animation: ${isExpanded ? 'coinFlipAnimation 12s infinite linear' : ' none'};
108+
animation: ${isForcedExpanded ? 'coinFlipAnimation 12s infinite linear' : ' none'};
107109
108110
@keyframes coinFlipAnimation {
109111
0%,
@@ -160,7 +162,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
160162

161163
<p
162164
data-text='Clerk is in keyless mode'
163-
aria-label={claimed && isExpanded ? 'Missing environment keys' : 'Clerk is in keyless mode'}
165+
aria-label={claimed ? 'Missing environment keys' : 'Clerk is in keyless mode'}
164166
css={css`
165167
color: #d9d9d9;
166168
font-size: 0.875rem;
@@ -191,7 +193,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
191193
background-clip: text;
192194
filter: blur(1.2px);
193195
animation: ${
194-
isExpanded
196+
isForcedExpanded
195197
? 'text-shimmer-expanded 3s infinite ease-out forwards'
196198
: 'text-shimmer 3s infinite ease-out forwards'
197199
};
@@ -220,7 +222,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
220222
background-size: 180% 100%;
221223
background-clip: text;
222224
animation: ${
223-
isExpanded
225+
isForcedExpanded
224226
? 'text-shimmer-expanded 3s infinite ease-out forwards'
225227
: 'text-shimmer 3s infinite ease-out forwards'
226228
};
@@ -316,7 +318,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
316318
role='region'
317319
id={contentIdentifier}
318320
aria-labelledby={buttonIdentifier}
319-
hidden={!isExpanded}
321+
hidden={!isForcedExpanded}
320322
>
321323
<p
322324
css={css`
@@ -371,7 +373,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
371373
href={claimed ? _props.copyKeysUrl : _props.claimUrl}
372374
target='_blank'
373375
rel='noopener noreferrer'
374-
data-expanded={isExpanded}
376+
data-expanded={isForcedExpanded}
375377
css={css`
376378
display: flex;
377379
align-items: center;

0 commit comments

Comments
 (0)