-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Clean up spacing in login modal in Connect #48143
Conversation
* in ClusterLogin are able to span the whole width of the parent component. This way when they | ||
* slide, they slide from one slide to another, without disappearing behind padding. | ||
*/ | ||
export const dialogCss: StyleFunction<NoExtraProps> = props => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this to a separate file because otherwise it breaks fast refresh in @vitejs/plugin-react-swc
. Not sure how worthwhile this is, as within stories fast refresh is broken anyway as each story has a default export which is not a React component.
https://github.com/vitejs/vite-plugin-react-swc#consistent-components-exports
This pull request is automatically being deployed by Amplify Hosting (learn more). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning this up!
loginAttempt: { | ||
status: '', | ||
statusText: '', | ||
} as Attempt<void>, | ||
init: () => null, | ||
initAttempt: { | ||
status: 'success', | ||
statusText: '', | ||
data: { | ||
localAuthEnabled: true, | ||
authProviders: [], | ||
type: '', | ||
hasMessageOfTheDay: false, | ||
allowPasswordless: true, | ||
localConnectorName: '', | ||
authType: 'local', | ||
} as types.AuthSettings, | ||
} as const, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can avoid these assertions, which actually hide some types issues.
loginAttempt: { | |
status: '', | |
statusText: '', | |
} as Attempt<void>, | |
init: () => null, | |
initAttempt: { | |
status: 'success', | |
statusText: '', | |
data: { | |
localAuthEnabled: true, | |
authProviders: [], | |
type: '', | |
hasMessageOfTheDay: false, | |
allowPasswordless: true, | |
localConnectorName: '', | |
authType: 'local', | |
} as types.AuthSettings, | |
} as const, | |
loginAttempt: { | |
status: '', | |
statusText: '', | |
data: null, | |
}, | |
init: () => null, | |
initAttempt: { | |
status: 'success', | |
statusText: '', | |
data: { | |
localAuthEnabled: true, | |
authProviders: [], | |
hasMessageOfTheDay: false, | |
allowPasswordless: true, | |
localConnectorName: '', | |
authType: 'local', | |
}, | |
}, |
@@ -73,7 +81,7 @@ export default function LoginForm(props: Props) { | |||
|
|||
if (!localAuthEnabled) { | |||
return ( | |||
<FlexBordered p={4}> | |||
<FlexBordered px={outermostPadding}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ravicious See the table below for backport results.
|
Closes #48059.
The spacing in
ClusterConnect
was a little bit all over the place with individual elements setting their own paddings and margins. I tried to limit it as much as possible, only to discover that it's not as simple as setting a uniform padding indialogCss
inClusterConnect
.That's because the login modal utilizes
StepSlider
which has individual children that slide from one side to another. In order for the animation to look seamless, those individual children need to occupy the whole width of the parent component. Otherwise they'll slide within the boundaries set by the padding of the parent, as seen in the video below.An example of how padding affects animation
In the first implementation, the whole form slides from side to side. In the other implementation, it hides behind the parent padding when going offscreen.
modal-spacing.mov
Unfortunately, a lot of our design elements set margins by themselves which is not useful when you want to set gaps uniformly with
gap
. This means that despite switching a lot of places to use<Flex gap={…}>
, I still had to specify things likem={0}
in a lot of places.In addition, I tried to curb the spacing a little bit, this is most clearly shown when comparing
ClusterAdd
to the previous implementation. The idea is that if the outermost padding is set to 4, components within the dialog should not use this spacing value (or bigger) to space out elements, especially when it comes to vertical spacing. Otherwise it can lead to situations where an element is closer to a modal border than it is to another element in the modal, making those two elements appear disjointed and out of place. Spacing should be used to group elements meant to appear together.Demo
In the first tab there's a version from master, in the second tab there's the version from this branch.
cluster-connect-spacing-2.mov