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

[core] feat(InputGroup): add leftElement prop #4063

Merged
merged 5 commits into from
Apr 20, 2020
Merged

[core] feat(InputGroup): add leftElement prop #4063

merged 5 commits into from
Apr 20, 2020

Conversation

justinbhopper
Copy link
Contributor

@justinbhopper justinbhopper commented Apr 13, 2020

Fixes #4039

Checklist

  • Update documentation

Changes proposed in this pull request:

Related discussion: #4039 (comment)

This PR adds a new leftElement to the InputGroup, which should allow users a better option for injecting left-aligned content than the current leftIcon prop. The current leftIcon prop allows content, but is not styled in a good enough way to align things correctly.

Reviewers should focus on:

This PR uses the same approach as rightElement currently does for calculating necessary padding.

It also adds the styling for the icon (color, margins, etc) that is currently being applied to leftIcon. I chose to do this because I feel it may be common to add <Icon> in leftElement, for example when a custom icon is specified.

I modified the example in the docs to have one usage. I felt it was good to illustrate how it can be used, but of course feel free to ask me to revert it.

Another note - this PR actually fixes another bug with InputGroup when small={true}. The padding-right calculations for rightElement was causing the InputGroup to always have a right-padding of 10px by default, but the small variant was supposed to have 8px. My changes in this PR ensures that calculated padding is now only applied when custom content is provided.

@adidahiya adidahiya self-requested a review April 16, 2020 17:37
Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

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

mostly looks good, requesting some changes

packages/core/src/common/classes.ts Outdated Show resolved Hide resolved
@adidahiya adidahiya changed the title Added leftElement to InputGroup [core] feat(InputGroup): add leftElement prop Apr 20, 2020
@adidahiya adidahiya merged commit fac6fd4 into palantir:develop Apr 20, 2020
@justinbhopper justinbhopper deleted the input-group-leftElement branch April 21, 2020 01:22
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.

custom leftIcon in InputGroup is renderer outside of element
2 participants