Skip to content

Commit

Permalink
fix(clerk-js): Improve copy and add secondary CTA to Keyless Prompt (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kaftarmery authored Jan 24, 2025
1 parent 7f8b63d commit 11c6458
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 33 deletions.
5 changes: 5 additions & 0 deletions .changeset/green-ravens-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-js': minor
---

Improve Keyless prompt's copy and add secondary CTA button for navigating to API keys page in the Dashboard.
2 changes: 1 addition & 1 deletion packages/clerk-js/bundlewatch.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
{ "path": "./dist/userverification*.js", "maxSize": "5KB" },
{ "path": "./dist/onetap*.js", "maxSize": "1KB" },
{ "path": "./dist/waitlist*.js", "maxSize": "1.3KB" },
{ "path": "./dist/keylessPrompt*.js", "maxSize": "5.5KB" }
{ "path": "./dist/keylessPrompt*.js", "maxSize": "5.7KB" }
]
}
116 changes: 84 additions & 32 deletions packages/clerk-js/src/ui/components/KeylessPrompt/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {

const environment = useRevalidateEnvironment();
const claimed = Boolean(environment.authConfig.claimedAt);

const success = typeof _props.onDismiss === 'function' && claimed;
const appName = environment.displayConfig.applicationName;

Expand Down Expand Up @@ -129,7 +128,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
flexDirection: 'column',
alignItems: 'flex-center',
justifyContent: 'flex-center',
height: success ? 'fit-content' : '8.563rem',
height: claimed || success ? 'fit-content' : isSignedIn ? '11rem' : '12rem',
overflow: 'hidden',
width: 'fit-content',
minWidth: '16.125rem',
Expand Down Expand Up @@ -291,7 +290,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
xmlns='http://www.w3.org/2000/svg'
css={css`
color: #8c8c8c;
transition: color 130ms ease-out;
transition: color 120ms ease-out;
display: ${isExpanded && !claimed && !success ? 'block' : 'none'};
cursor: pointer;
Expand Down Expand Up @@ -379,7 +378,6 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
href='https://dashboard.clerk.com/last-active?path=user-authentication/email-phone-username'
sx={t => ({
color: t.colors.$whiteAlpha600,

textDecoration: 'underline solid',
transition: `${t.transitionTiming.$common} ${t.transitionDuration.$fast}`,
':hover': {
Expand All @@ -399,7 +397,7 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
<span>
{isSignedIn
? "You've created your first user! Link this application to your Clerk account to explore the Dashboard."
: 'We generated temporary API keys for you. Link this application to your Clerk account to configure it.'}
: 'This app uses Clerk for authentication. We generated temporary API keys for you. Link this application to your Clerk account to configure it.'}
</span>
)}
</p>
Expand All @@ -424,45 +422,99 @@ const _KeylessPrompt = (_props: KeylessPromptProps) => {
Dismiss
</button>
) : (
<a
href={urlToDashboard}
target='_blank'
rel='noopener noreferrer'
<Flex
data-expanded={isForcedExpanded}
css={css`
${mainCTAStyles};
animation: ${isForcedExpanded && isSignedIn
? 'show-button 800ms ease forwards'
: 'show-button 650ms ease-in forwards'};
sx={t => ({
flexDirection: 'column',
alignItems: 'center',
gap: t.space.$2x5,
})}
>
<a
href={urlToDashboard}
target='_blank'
rel='noopener noreferrer'
css={css`
${mainCTAStyles};
animation: ${isForcedExpanded && isSignedIn
? 'show-main-CTA 800ms ease forwards'
: 'show-main-CTA 650ms ease-in forwards'};
@keyframes show-button {
0%,
5% {
opacity: 0;
}
14%,
100% {
opacity: 1;
@keyframes show-main-CTA {
0%,
5% {
opacity: 0;
}
14%,
100% {
opacity: 1;
}
}
}
&:hover {
${claimed
? `
&:hover {
${claimed
? `
background: #4B4B4B;
transition: all 120ms ease-in-out;`
: `
: `
box-shadow:
0px 0px 6px 0px rgba(253, 224, 71, 0.24) inset,
0px 0px 0px 1px rgba(255, 255, 255, 0.04) inset,
0px 1px 0px 0px rgba(255, 255, 255, 0.04) inset,
0px 0px 0px 1px rgba(0, 0, 0, 0.12),
0px 1.5px 2px 0px rgba(0, 0, 0, 0.48);`}
}
`}
>
{claimed ? 'Get API keys' : 'Claim application'}
</a>
}
`}
>
{claimed ? 'Get API keys' : 'Claim application'}
</a>

{!claimed && (
<>
<span
css={css`
height: 1px;
background-color: #151515;
width: 100%;
box-shadow: 0px 1px 0px 0px #424242;
`}
/>

<a
href='https://dashboard.clerk.com/last-active?path=api-keys'
target='_blank'
rel='noopener noreferrer'
css={css`
${baseElementStyles};
color: #ffffff9e;
font-size: 0.75rem;
transition: color 120ms ease-out;
:hover {
color: #ffffffcf;
text-decoration: none;
}
animation: ${isForcedExpanded && isSignedIn
? 'show-secondary-CTA 800ms ease forwards'
: 'show-secondary-CTA 650ms ease-in forwards'};
@keyframes show-secondary-CTA {
0%,
9% {
opacity: 0;
}
19%,
100% {
opacity: 1;
}
}
`}
>
Already have a Clerk app? Get keys
</a>
</>
)}
</Flex>
))}
</Flex>
</Flex>
Expand Down

0 comments on commit 11c6458

Please sign in to comment.