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

chore(connection-form): clean up connection form styles; address modal jumping behavior #5836

Merged
merged 6 commits into from
May 24, 2024

Conversation

gribnoysup
Copy link
Contributor

@gribnoysup gribnoysup commented May 23, 2024

Removes all the workarounds for the connection form sizing and changes them to css instead. Also a new behavior is added that makes the form to stretch to the whole available screen size when in modal to avoid jumps when switching the tabs in the advanced section

Kapture.2024-05-23.at.15.58.48.mp4

@paula-stacho
Copy link
Contributor

On a wide screen, the form gets very close to the bottom - maybe we can add min height?

Screenshot 2024-05-23 at 16 38 00

@gribnoysup
Copy link
Contributor Author

I don't think wide screen is what affects it, seems like I missed re-adding a padding back after refactoring the layout, will fix, thanks for spotting

setOpenRef.current?.(newValue);
return newValue;
});
}, []);
Copy link
Contributor

Choose a reason for hiding this comment

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

if I understand correctly, the localOpen is just to avoid having 'open' as a callback dependency? is that worth it since the component anyway re-renders when open changes? am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really, localOpen is needed so that the accordion can be used without the need to control the state, this is the common controlled / uncontrolled pattern for React components. In leafygreen they usually use open, setOpen as the optional props to control the state, if you're writing a input in React for example, you similarly don't need to pass it value and html elements would still work as expected

Copy link
Contributor

Choose a reason for hiding this comment

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

ah I see, thanks for the explanation!

width: '100%',
paddingLeft: spacing[1],
paddingRight: spacing[1],
const formHelpConatinerStyles = css({
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: s/formHelpConatinerStyles/formHelpContainerStyles

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for spotting, fixed!

paddingLeft: spacing[1],
paddingRight: spacing[1],
const formHelpConatinerStyles = css({
position: 'sticky',
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't know why I didn't think of or realise you can do position sticky inside here. I mean obviously when I think about it, but for some reason in my mind it was a relative to the screen thing.

@gribnoysup
Copy link
Contributor Author

@paula-stacho @lerouxb fixed the missing spacing at the bottom in two commits: first one just fixes a few inconsistencies in the existing form spacing so that it's easier to consistently apply bottom spacing and the next commit adds it

because margin doesn't add scrollable space
Copy link
Contributor

@lerouxb lerouxb left a comment

Choose a reason for hiding this comment

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

Amazing! So much better.

@gribnoysup gribnoysup merged commit a76292a into main May 24, 2024
13 of 15 checks passed
@gribnoysup gribnoysup deleted the connection-form-styles-refactor branch May 24, 2024 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants