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

Multiline Input and consistent alignment #4270

Merged
merged 10 commits into from
Sep 14, 2016
Merged

Conversation

chromakode
Copy link
Contributor

@chromakode chromakode commented Sep 13, 2016

This branch adds a bunch of fiddly tweaks to the <Input> element to enable it to serve as a multi-line input, allowing us to remove <MultiLineInput>, which is currently a separate code path. The styling of the hint position, spacing between underline and input text, and floating text position have been tweaked to better match the style guide as well as each other in the different combinations of multiline / floating label / hint. Special attention was paid to lining up the gray placeholder text baseline with the black value text.

It's a big improvement, but it isn't perfect -- in the interest of time, this is a 90% effort. We're kind of pushing the limits of what's convenient to style in the Material-UI <TextField>. The next step would be to write our own component, but I've tried hard not to resort to that here, merely taking out some of the hacks and fiddling with the styling to get it mostly right. In the future pass we should probably write a component that serves our needs precisely.

One compromise I had to make to merge the inputs was dropping support for expanding inputs to fit the size of their hint text. Previously, the paper key inputs would expand to contain a multi-line hint with the full length of a paper key. Now the hint gets constrained to the space of the single-line empty input. I've discussed this change w/ design and it's ok to move forward with.

unlock_folders-paperkey_input-1d9961156f9b

I've checked the impact of these changes by running local visdiffs during development and resolved the problems I could find.

This changeset will benefit from the Lato fonts update which will resolve some text measurement glitchiness.

👓 @keybase/react-hackers

Also clean up alignment of floating labels / hints / text.
Due to the internals of the material-ui TextField, it is difficult for
us to expand the height of an input field to contain the hint. As a
quick and dirty workaround, let's compromise by clipping the hint to the
size of the input.
Copy link
Contributor

@MarcoPolo MarcoPolo left a comment

Choose a reason for hiding this comment

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

q

@@ -6,7 +6,7 @@ export type SmallInputProps = {
hintText: string,
label: string,
value: ?string,
onChange: (next: string) => void,
onChange?: (next: string) => void,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this optional now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this since <Input>'s onChange is similarly optional. I noticed this because I didn't specify handlers in the dumb sheet. It looks like in general we don't require event handlers in the other events of the <Input> flowtype.

@MarcoPolo
Copy link
Contributor

👍

Copy link
Contributor

@MarcoPolo MarcoPolo left a comment

Choose a reason for hiding this comment

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

👍

@@ -6,7 +6,7 @@ export type SmallInputProps = {
hintText: string,
label: string,
value: ?string,
onChange: (next: string) => void,
onChange?: (next: string) => void,
Copy link
Contributor

Choose a reason for hiding this comment

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

change plz

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@chromakode chromakode merged commit 8ac81b0 into master Sep 14, 2016
@chromakode chromakode deleted the mgood/DESKTOP-1837 branch September 14, 2016 22:55
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.

2 participants