Skip to content

Commit 2ad4dc1

Browse files
committed
Adjust focus and hover styles
1 parent bba1cbe commit 2ad4dc1

File tree

3 files changed

+106
-52
lines changed

3 files changed

+106
-52
lines changed

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

Lines changed: 98 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -63,43 +63,90 @@ const EnableOrganizationsPromptInternal = ({
6363
gap: t.sizes.$2,
6464
})}
6565
>
66-
{isEnabled ? (
67-
<PromptSuccessIcon />
68-
) : (
69-
<svg
66+
<div
67+
css={css`
68+
perspective: 1000px;
69+
position: relative;
70+
width: 1.25rem;
71+
height: 1.25rem;
72+
transform-style: preserve-3d;
73+
transition: transform 0.6s ease-in-out;
74+
transform: ${isEnabled ? 'rotateY(180deg)' : 'rotateY(0)'};
75+
76+
@media (prefers-reduced-motion: reduce) {
77+
transition: none;
78+
transform: ${isEnabled ? 'rotateY(180deg)' : 'rotateY(0)'};
79+
}
80+
`}
81+
>
82+
<span
83+
aria-hidden
7084
css={css`
71-
width: 1.25rem;
72-
height: 1.25rem;
85+
position: absolute;
86+
width: 100%;
87+
height: 100%;
88+
backface-visibility: hidden;
89+
display: flex;
90+
align-items: center;
91+
justify-content: center;
7392
`}
74-
viewBox='0 0 20 20'
75-
fill='none'
76-
xmlns='http://www.w3.org/2000/svg'
7793
>
78-
<path
79-
opacity='0.2'
80-
d='M17.25 10C17.25 14.0041 14.0041 17.25 10 17.25C5.99594 17.25 2.75 14.0041 2.75 10C2.75 5.99594 5.99594 2.75 10 2.75C14.0041 2.75 17.25 5.99594 17.25 10Z'
81-
fill='#EAB308'
82-
/>
83-
<path
84-
fillRule='evenodd'
85-
clipRule='evenodd'
86-
d='M10 3.5C6.41015 3.5 3.5 6.41015 3.5 10C3.5 13.5899 6.41015 16.5 10 16.5C13.5899 16.5 16.5 13.5899 16.5 10C16.5 6.41015 13.5899 3.5 10 3.5ZM2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10Z'
87-
fill='#EAB308'
88-
/>
89-
<path
90-
fillRule='evenodd'
91-
clipRule='evenodd'
92-
d='M10 6C10.5523 6 11 6.44772 11 7V9C11 9.55228 10.5523 10 10 10C9.44772 10 9 9.55228 9 9V7C9 6.44772 9.44772 6 10 6Z'
93-
fill='#EAB308'
94-
/>
95-
<path
96-
fillRule='evenodd'
97-
clipRule='evenodd'
98-
d='M10 12C10.5523 12 11 12.4477 11 13V13.01C11 13.5623 10.5523 14.01 10 14.01C9.44772 14.01 9 13.5623 9 13.01V13C9 12.4477 9.44772 12 10 12Z'
99-
fill='#EAB308'
94+
<svg
95+
css={css`
96+
width: 1.25rem;
97+
height: 1.25rem;
98+
`}
99+
viewBox='0 0 20 20'
100+
fill='none'
101+
xmlns='http://www.w3.org/2000/svg'
102+
>
103+
<path
104+
opacity='0.2'
105+
d='M17.25 10C17.25 14.0041 14.0041 17.25 10 17.25C5.99594 17.25 2.75 14.0041 2.75 10C2.75 5.99594 5.99594 2.75 10 2.75C14.0041 2.75 17.25 5.99594 17.25 10Z'
106+
fill='#EAB308'
107+
/>
108+
<path
109+
fillRule='evenodd'
110+
clipRule='evenodd'
111+
d='M10 3.5C6.41015 3.5 3.5 6.41015 3.5 10C3.5 13.5899 6.41015 16.5 10 16.5C13.5899 16.5 16.5 13.5899 16.5 10C16.5 6.41015 13.5899 3.5 10 3.5ZM2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10Z'
112+
fill='#EAB308'
113+
/>
114+
<path
115+
fillRule='evenodd'
116+
clipRule='evenodd'
117+
d='M10 6C10.5523 6 11 6.44772 11 7V9C11 9.55228 10.5523 10 10 10C9.44772 10 9 9.55228 9 9V7C9 6.44772 9.44772 6 10 6Z'
118+
fill='#EAB308'
119+
/>
120+
<path
121+
fillRule='evenodd'
122+
clipRule='evenodd'
123+
d='M10 12C10.5523 12 11 12.4477 11 13V13.01C11 13.5623 10.5523 14.01 10 14.01C9.44772 14.01 9 13.5623 9 13.01V13C9 12.4477 9.44772 12 10 12Z'
124+
fill='#EAB308'
125+
/>
126+
</svg>
127+
</span>
128+
129+
<span
130+
aria-hidden
131+
css={css`
132+
position: absolute;
133+
width: 100%;
134+
height: 100%;
135+
backface-visibility: hidden;
136+
transform: rotateY(180deg);
137+
display: flex;
138+
align-items: center;
139+
justify-content: center;
140+
`}
141+
>
142+
<PromptSuccessIcon
143+
css={css`
144+
width: 1.25rem;
145+
height: 1.25rem;
146+
`}
100147
/>
101-
</svg>
102-
)}
148+
</span>
149+
</div>
103150

104151
<h1
105152
css={[
@@ -281,7 +328,7 @@ const mainCTAStyles = css`
281328
width: 100%;
282329
height: 1.75rem;
283330
max-width: 14.625rem;
284-
padding: 0.25rem 0.625rem;
331+
padding: 0.375rem 0.625rem;
285332
border-radius: 0.375rem;
286333
font-size: 0.75rem;
287334
font-weight: 500;
@@ -292,15 +339,16 @@ const mainCTAStyles = css`
292339
user-select: none;
293340
min-width: 100%;
294341
color: white;
295-
transition:
296-
background 150ms cubic-bezier(0.2, 0.61, 0.1, 1),
297-
box-shadow 150ms cubic-bezier(0.2, 0.61, 0.1, 1),
298-
border-color 150ms cubic-bezier(0.2, 0.61, 0.1, 1);
342+
transition: all 120ms ease-in-out;
299343
300344
&:disabled {
301345
opacity: 0.6;
302346
cursor: not-allowed;
303347
}
348+
349+
&:focus-visible {
350+
outline: none;
351+
}
304352
`;
305353

306354
type PromptButtonVariant = 'solid' | 'outline';
@@ -330,10 +378,12 @@ const PromptButton = ({ variant = 'solid', ...props }: PromptButtonProps) => {
330378
}
331379
332380
&:focus:not(:disabled) {
333-
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 30.5%, rgba(0, 0, 0, 0.15) 100%), #5f5f5f;
381+
border: 1px solid rgba(115, 115, 115);
382+
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 30.5%, rgba(0, 0, 0, 0.05) 100%), #454545;
334383
box-shadow:
335-
0 0 3px 0 rgba(253, 224, 71, 0) inset,
336-
0 0 0 1px rgba(255, 255, 255, 0.04) inset,
384+
0 0 0 4px rgba(255, 255, 255, 0.05),
385+
0 0 3px 0 rgba(255, 255, 255, 0) inset,
386+
0 0 0 1px rgba(255, 255, 255, 0.25) inset,
337387
0 1px 0 0 rgba(255, 255, 255, 0.04) inset,
338388
0 0 0 1px rgba(0, 0, 0, 0.12),
339389
0 1.5px 2px 0 rgba(0, 0, 0, 0.48);
@@ -353,14 +403,14 @@ const PromptButton = ({ variant = 'solid', ...props }: PromptButtonProps) => {
353403
0px 1.5px 2px 0px rgba(0, 0, 0, 0.48);
354404
}
355405
406+
&:hover:not(:disabled) {
407+
border: 1px solid rgba(115, 115, 115);
408+
}
409+
356410
&:focus:not(:disabled) {
357-
box-shadow:
358-
0px 0px 6px 0px rgba(255, 255, 255, 0.04) inset,
359-
0px 0px 0px 1px rgba(255, 255, 255, 0.04) inset,
360-
0px 1px 0px 0px rgba(255, 255, 255, 0.04) inset,
361-
0px 0px 0px 1px rgba(0, 0, 0, 0.1),
362-
0px 1.5px 2px 0px rgba(0, 0, 0, 0.48);
363-
border-color: rgba(118, 118, 132, 0.4);
411+
border: 1px solid rgba(115, 115, 115);
412+
413+
box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
364414
}
365415
`;
366416

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,12 @@ const KeylessPromptInternal = (_props: KeylessPromptProps) => {
178178
})}
179179
>
180180
{success ? (
181-
<PromptSuccessIcon />
181+
<PromptSuccessIcon
182+
css={css`
183+
width: 1rem;
184+
height: 1rem;
185+
`}
186+
/>
182187
) : claimed ? (
183188
<svg
184189
width='1rem'

packages/clerk-js/src/ui/components/devPrompts/shared.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,10 @@ export const basePromptElementStyles = css`
5555
text-decoration: none;
5656
`;
5757

58-
export function PromptSuccessIcon() {
58+
export function PromptSuccessIcon(props: React.ComponentProps<'svg'>) {
5959
return (
6060
<svg
61-
width='1rem'
62-
height='1rem'
61+
{...props}
6362
viewBox='0 0 16 17'
6463
fill='none'
6564
aria-hidden

0 commit comments

Comments
 (0)