Skip to content

Commit

Permalink
fix(clerk-js): Keyless toast's collapse behavior (#4855)
Browse files Browse the repository at this point in the history
Co-authored-by: panteliselef <panteliselef@outlook.com>
  • Loading branch information
kaftarmery and panteliselef authored Jan 8, 2025
1 parent 44cab60 commit 4260611
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/shaggy-otters-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-js': patch
---

Updates Keyless UI to automatically expand when the application has been claimed.
18 changes: 10 additions & 8 deletions packages/clerk-js/src/ui/components/KeylessPrompt/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
const [isExpanded, setIsExpanded] = useState(true);
const claimed = Boolean(useRevalidateEnvironment().authConfig.claimedAt);

const isForcedExpanded = claimed || isExpanded;

return (
<Portal>
<Flex
data-expanded={isExpanded}
data-expanded={isForcedExpanded}
align='center'
sx={t => ({
position: 'fixed',
Expand Down Expand Up @@ -61,7 +63,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
>
<button
type='button'
aria-expanded={isExpanded}
aria-expanded={isForcedExpanded}
aria-controls={contentIdentifier}
id={buttonIdentifier}
onClick={() => !claimed && setIsExpanded(prev => !prev)}
Expand Down Expand Up @@ -103,7 +105,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
width: 1rem;
height: 1rem;
transform-style: preserve-3d;
animation: ${isExpanded ? 'coinFlipAnimation 12s infinite linear' : ' none'};
animation: ${isForcedExpanded ? 'coinFlipAnimation 12s infinite linear' : ' none'};
@keyframes coinFlipAnimation {
0%,
Expand Down Expand Up @@ -160,7 +162,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {

<p
data-text='Clerk is in keyless mode'
aria-label={claimed && isExpanded ? 'Missing environment keys' : 'Clerk is in keyless mode'}
aria-label={claimed ? 'Missing environment keys' : 'Clerk is in keyless mode'}
css={css`
color: #d9d9d9;
font-size: 0.875rem;
Expand Down Expand Up @@ -191,7 +193,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
background-clip: text;
filter: blur(1.2px);
animation: ${
isExpanded
isForcedExpanded
? 'text-shimmer-expanded 3s infinite ease-out forwards'
: 'text-shimmer 3s infinite ease-out forwards'
};
Expand Down Expand Up @@ -220,7 +222,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
background-size: 180% 100%;
background-clip: text;
animation: ${
isExpanded
isForcedExpanded
? 'text-shimmer-expanded 3s infinite ease-out forwards'
: 'text-shimmer 3s infinite ease-out forwards'
};
Expand Down Expand Up @@ -316,7 +318,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
role='region'
id={contentIdentifier}
aria-labelledby={buttonIdentifier}
hidden={!isExpanded}
hidden={!isForcedExpanded}
>
<p
css={css`
Expand Down Expand Up @@ -371,7 +373,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
href={claimed ? _props.copyKeysUrl : _props.claimUrl}
target='_blank'
rel='noopener noreferrer'
data-expanded={isExpanded}
data-expanded={isForcedExpanded}
css={css`
display: flex;
align-items: center;
Expand Down

0 comments on commit 4260611

Please sign in to comment.