Skip to content

Commit

Permalink
fix(clerk-js): Fix layout shift for Social block buttons (#1838)
Browse files Browse the repository at this point in the history
* fix(clerk-js): Removed loading spinner padding and constrained the social image to the parent width

* chore(repo): Add changeset

* feat(clerk-js): Added new size variant for Spinner

* feat(clerk-js): Increase icon and spinner size for ArrowBlockButton component

* fix(clerk-js): Update Spinner size
  • Loading branch information
octoper committed Oct 10, 2023
1 parent c9b17f5 commit f20adc3
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 15 deletions.
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 },
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

0 comments on commit f20adc3

Please sign in to comment.