-
Notifications
You must be signed in to change notification settings - Fork 460
chore(shared): Improve layout shift in payment element fallback #6387
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
Changes from 5 commits
408783f
c32abbc
7cb7775
5f454f2
0fcc947
adec63e
17c4939
b48369e
c05df28
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@clerk/shared': patch | ||
| --- | ||
|
|
||
| wip | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| import type { PropsWithChildren } from 'react'; | ||
|
|
||
| import { Box, Flex, Grid } from '@/ui/customizables'; | ||
|
|
||
| const SkeletonLine = (props: Parameters<typeof Box>[0]) => { | ||
| return ( | ||
| <Box | ||
| sx={[ | ||
| t => ({ | ||
| height: t.space.$2, | ||
| width: '100%', | ||
| borderRadius: t.radii.$md, | ||
| background: t.colors.$neutralAlpha100, | ||
| }), | ||
| props.sx, | ||
| ]} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| const SkeletonInput = () => { | ||
| return ( | ||
| <SkeletonLine | ||
| sx={t => ({ | ||
| height: t.space.$10, | ||
| width: '100%', | ||
| })} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| const LineGroup = (props: PropsWithChildren) => { | ||
| return ( | ||
| <Flex | ||
| direction='col' | ||
| gap={2} | ||
| > | ||
| {props.children} | ||
| </Flex> | ||
| ); | ||
| }; | ||
|
|
||
| const PaymentElementSkeleton = () => { | ||
| return ( | ||
| <Box | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @alexcarpenter Do you think we need descriptors here ? Theming is already using, and I feel like it's ok to be opinionated about the layout of a skeleton.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I agree, I don't see why you'd modify the layout as they wouldn't change based on your configuration. |
||
| sx={{ | ||
| position: 'relative', | ||
| minHeight: 0, | ||
| flex: 1, | ||
| overflowY: 'auto', | ||
| }} | ||
| > | ||
| <Flex | ||
| direction='col' | ||
| gap={5} | ||
| > | ||
| <LineGroup> | ||
| <SkeletonLine | ||
| sx={t => ({ | ||
| height: t.space.$3, | ||
| width: t.sizes.$24, | ||
| })} | ||
| /> | ||
| <SkeletonInput /> | ||
| </LineGroup> | ||
|
|
||
| <Grid | ||
| columns={2} | ||
| gap={4} | ||
| > | ||
| <LineGroup> | ||
| <SkeletonLine | ||
| sx={t => ({ | ||
| height: t.space.$3, | ||
| width: t.sizes.$20, | ||
| })} | ||
| /> | ||
|
|
||
| <SkeletonInput /> | ||
| </LineGroup> | ||
| <LineGroup> | ||
| <SkeletonLine | ||
| sx={t => ({ | ||
| height: t.space.$3, | ||
| width: t.sizes.$24, | ||
| })} | ||
| /> | ||
|
|
||
| <SkeletonInput /> | ||
| </LineGroup> | ||
| </Grid> | ||
|
|
||
| <LineGroup> | ||
| <SkeletonLine | ||
| sx={t => ({ | ||
| height: t.space.$3, | ||
| width: t.sizes.$16, | ||
| })} | ||
| /> | ||
|
|
||
| <SkeletonInput /> | ||
| </LineGroup> | ||
|
|
||
| <LineGroup> | ||
| <SkeletonLine /> | ||
| <SkeletonLine /> | ||
| <SkeletonLine sx={{ width: '66.666667%' }} /> | ||
| </LineGroup> | ||
| </Flex> | ||
| </Box> | ||
| ); | ||
| }; | ||
|
|
||
| export { PaymentElementSkeleton }; | ||
Uh oh!
There was an error while loading. Please reload this page.