Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(clerk-js): Fix layout shift for Social block buttons #1838

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/honest-countries-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-js': patch
---

Updated the OAuth buttons in the SignIn and SignUp components to prevent layout shifts while loading.
2 changes: 1 addition & 1 deletion packages/clerk-js/src/ui/common/InfiniteListSpinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const InfiniteListSpinner = forwardRef<HTMLDivElement>((_, ref) => {
}}
>
<Spinner
size='md'
size='sm'
colorScheme='primary'
/>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const PreviewListSpinner = forwardRef<HTMLDivElement>((_, ref) => {
}}
>
<Spinner
size='md'
size='sm'
colorScheme='primary'
/>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const DomainList = (props: DomainListProps) => {
}}
>
<Spinner
size='md'
size='sm'
colorScheme='primary'
/>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion packages/clerk-js/src/ui/elements/Actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const Action = (props: ActionProps) => {
sx={theme => ({ flex: `0 0 ${theme.sizes.$11}` })}
>
{status.isLoading ? (
<Spinner size='sm' />
<Spinner size='xs' />
) : (
<Icon
elementDescriptor={iconElementDescriptor}
Expand Down
9 changes: 2 additions & 7 deletions packages/clerk-js/src/ui/elements/ArrowBlockButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,13 @@ export const ArrowBlockButton = (props: ArrowBlockButtonProps) => {
<Flex
as='span'
center
sx={theme => ({ flex: `0 0 ${theme.space.$4}` })}
sx={theme => ({ flex: `0 0 ${theme.space.$5}` })}
>
{isLoading ? (
<Spinner
elementDescriptor={spinnerElementDescriptor}
elementId={spinnerElementId}
size={'md'}
sx={theme => [
{
padding: theme.space.$2,
},
]}
/>
) : !isIconElement && leftIcon ? (
<Icon
Expand All @@ -94,7 +89,7 @@ export const ArrowBlockButton = (props: ArrowBlockButtonProps) => {
sx={[
theme => ({
color: theme.colors.$blackAlpha600,
width: theme.sizes.$4,
width: theme.sizes.$5,
position: 'absolute',
}),
leftIconSx,
Expand Down
2 changes: 1 addition & 1 deletion packages/clerk-js/src/ui/elements/SocialButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const SocialButtons = React.memo((props: SocialButtonsRootProps) => {
isDisabled={card.isLoading}
src={strategyToDisplayData[strategy].iconUrl}
alt={`Sign in with ${strategyToDisplayData[strategy].name}`}
sx={theme => ({ width: theme.sizes.$5 })}
sx={theme => ({ width: theme.sizes.$5, height: 'auto', maxWidth: '100%' })}
/>
}
/>
Expand Down
7 changes: 4 additions & 3 deletions packages/clerk-js/src/ui/primitives/Spinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ const { applyVariants, filterProps } = createVariants(theme => {
md: { [thickness]: theme.sizes.$1 },
},
size: {
sm: { [size]: theme.sizes.$3 },
md: { [size]: theme.sizes.$4 },
xs: { [size]: theme.sizes.$3 },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Are we using this somewhere ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is used here packages/clerk-js/src/ui/elements/Actions.tsx

sm: { [size]: theme.sizes.$4 },
md: { [size]: theme.sizes.$5 },
lg: { [size]: theme.sizes.$6 },
xl: { [size]: theme.sizes.$8 },
},
Expand All @@ -50,7 +51,7 @@ const { applyVariants, filterProps } = createVariants(theme => {
defaultVariants: {
speed: 'normal',
thickness: 'sm',
size: 'md',
size: 'sm',
},
};
});
Expand Down