Skip to content
This repository has been archived by the owner on Dec 23, 2022. It is now read-only.

Add support for start and end adornments #255

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

me245
Copy link

@me245 me245 commented Dec 13, 2018

Initial work was designed for supporting different input variants (IE. outlined and filled inputs). Mostly style changes, however there was some items being overwritten on alternative variants of inputs. Due to those differences, code was changed to make the rendering more uniform across different input styles

Also adds color to the chip renderer by default. Should not be an breaking API change as it includes the same default value and is within an param object.

Allows for some more style overriding for chips, and for start/end adornments

@me245
Copy link
Author

me245 commented Dec 13, 2018

This addresses #248

@me245
Copy link
Author

me245 commented Dec 13, 2018

This may also address #241 because I noticed the same issue with what I was working on. YMMV since I wasn't working on that per se

@coveralls
Copy link

Coverage Status

Coverage decreased (-2.2%) to 73.867% when pulling 54c5c61 on me245:master into 49bc058 on TeamWertarbyte:master.

@leMaik
Copy link
Member

leMaik commented Dec 18, 2018

@me245 Thank you very much for your PR! 🎉 I'm pretty busy currently but I'll come back to it this weekend.

@leMaik
Copy link
Member

leMaik commented Dec 28, 2018

"This weekend" is now. 🙈

Copy link
Member

@leMaik leMaik left a comment

Choose a reason for hiding this comment

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

@me245 Thanks again for this great first PR! 🎉 It's been a while, but I really like it. Maybe you could just update the few things I commented?

A usage example of this feature as a new story (in the storybook) would be really useful, too. 👍

src/ChipInput.js Outdated
@@ -423,6 +479,7 @@ class ChipInput extends React.Component {
helperText,
id,
InputProps = {},
inputAdornmentRender = defaultInputAdornmentRenderer,
Copy link
Member

Choose a reason for hiding this comment

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

This should be called renderer

Suggested change
inputAdornmentRender = defaultInputAdornmentRenderer,
inputAdornmentRenderer = defaultInputAdornmentRenderer,

@@ -575,6 +653,8 @@ ChipInput.propTypes = {
chipRenderer: PropTypes.func,
/** Whether the input value should be cleared if the `value` prop is changed. */
clearInputValueOnChange: PropTypes.bool,
/** The color to render the chip based on the color palette **/
Copy link
Member

Choose a reason for hiding this comment

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

The other new props, i.e. startAdornment, endAdornment and adornmentRenderer should also be added and documented here.

<Chip
key={key}
className={className}
style={{ pointerEvents: isDisabled ? 'none' : undefined, backgroundColor: isFocused ? blue[300] : undefined }}
onClick={handleClick}
onDelete={handleDelete}
label={text}
color={color || 'default'}
Copy link
Member

Choose a reason for hiding this comment

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

The default value for color could be specified in the component's defaultProps so that it appears in the documentation, too.

/>
)

export const defaultInputAdornmentRenderer = (inputAdornment, additionalClasses) => {
Copy link
Member

Choose a reason for hiding this comment

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

Not using this function would probably break a lot of things. Is a prop for customizing the renderer actually needed ? 🤔

Copy link
Author

Choose a reason for hiding this comment

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

The biggest item for this would be to resolve the classes for styling. It was loosely based on what was happening from any of the inputs in Material-ui compared to BaseInput.

When you say not using this function, can you clarify what issue you are seeing? It is a default renderer function and if someone were to override it, I would be expecting them to resolve the styling issues in their manual implementation anyhow. I was opting for customization capability more than anything.

Copy link
Author

Choose a reason for hiding this comment

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

But I could easily just hide this from being a prop if that is what you are going after. Let me know if you want me to do that instead

@me245
Copy link
Author

me245 commented Jan 7, 2019

I added some story book stories and noticed some glaring style issues and needed to fix those. Let me know if there is something else that you want me to take a look at

@leMaik
Copy link
Member

leMaik commented Feb 1, 2019

@me245 Sorry, I've been pretty busy (and also I don't get Slack notifications for new comments anymore. Thank you for the new stories. I'll review this this weekend and probably merge the PR. Thank you very much! 🎉

@viart
Copy link

viart commented Apr 10, 2019

@leMaik any chances for this to get merged? :)

@leMaik
Copy link
Member

leMaik commented Apr 24, 2019

@viart Yes. As soon as either

  1. someone who needs this gets this rebased and updates it according to the previous review 💯 😎 👍
  2. I find some time to implement this 😓

If you want to give this a shot, I'd really appreciate a succeeding PR! (You can fork the fork 😉)

Cc @geilecj

@Mortuie
Copy link

Mortuie commented Aug 13, 2020

Any chance this is getting merged, or I could have a shot fixing it and merging it, if that's ok, I'd need a few pointers due to my newness to OpenSource

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants