Skip to content
This repository has been archived by the owner on Feb 27, 2020. It is now read-only.

Task/jenkins 42109 text input icons #148

Merged
merged 7 commits into from Feb 22, 2017

Conversation

cliffmeyers
Copy link
Collaborator

@cliffmeyers cliffmeyers commented Feb 16, 2017

Description

Submitter checklist

  • Link to JIRA ticket in description, if appropriate.
  • Change is code complete and matches issue description
  • Appropriate unit or acceptance tests or explanation to why this change has no tests

Reviewer checklist

  • Run the changes and verified the change matches the issue description
  • Reviewed the code
  • Verified that the appropriate tests have been written or valid explanation given

@reviewbybees

Cliff Meyers added 4 commits February 3, 2017 15:36
…re TextInput: splitting them up would probably lead to tedium long term as we add features like "clearButton" (the "X" on the right side that user can click to clear text)
@cliffmeyers
Copy link
Collaborator Author

cliffmeyers commented Feb 16, 2017

cc @sophistifunk I actually went in a different direction from our last chat. Explanation:

I suspect we're going to need a prop like clearButton which gives the user a little "X" on the right after they type into it, which can click to clear the text. I haven't seen it in the comps (yet) but it seems like a pretty obvious thing to have.

So, if icons are only supported by a separate IconTextInput then it seems odd to require a developer to use IconTextInput just to get that "clear" button... the impl details almost kinda leak up to the API at that point.

Now, maybe it's just a naming thing... and maybe AdvancedTextInput should support these extra fancy features while TextInput remains very barebones. That said, the code to get this working was pretty darn simple, so it seem fair to leave in there. At any rate, the refactoring here was worthwhile (especially the changes to TextControl) so if we decide we really should split out ATI then I think I can do that without too much pain.

I left this as WIP only because I wanted to get your feedback before I go any further. I think the only thing left though is to support our small / medium / large text sizes by scaling up the icon and tweaking its position. Will refactor that evil margin-left/right CSS into a mixin so it reads better.

@cliffmeyers
Copy link
Collaborator Author

@sophistifunk perhaps you can review this one when you are online today? Thanks :)

}


.icon-rules(@icon-size, @icon-padding) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@sophistifunk
Copy link
Collaborator

This is less code than I was expecting, nice wun bwuvva. 🐝

return React.cloneElement(
child,
{
placeholder: this.props.placeholder,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might be useful to pass this.props.inputProps or something along for all the other stuff that might be needed, e.g. onFocus etc.

export class TextInput extends React.Component {

render() {
const classLeft = this.props.iconLeft ? 'u-icon-left' : '';
Copy link
Collaborator

Choose a reason for hiding this comment

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

what if you need multiple icons? (already had the column filter design needing that... well, really just needing extra elements)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can you point me to the design for that? You're saying there are multiple icons on the left or right?

return (
<TextControl {...this.props} className={`TextInput ${this.props.className}`}>
<TextControl {...this.props} className={`TextInput ${this.props.className} ${classLeft} ${classRight}`}>
{ classLeft && <NestedIcon className={classLeft} icon={this.props.iconLeft} /> }
Copy link
Collaborator

Choose a reason for hiding this comment

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

what happens if you want these icons to be clickable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll certainly add that in once we have a use case for it. Right now I'm supporting "icons as decoration" only.

@cliffmeyers
Copy link
Collaborator Author

cliffmeyers commented Feb 22, 2017

@kzantow your comments here are valid, although I think they're all around future use cases and we can refine them as we go. Need to get this one through as it is blocking #151 and jenkinsci/blueocean-plugin#845. I will make sure this good feedback is taken into account when the time comes.

@cliffmeyers cliffmeyers merged commit e868237 into master Feb 22, 2017
@cliffmeyers cliffmeyers deleted the task/JENKINS-42109-text-input-icons branch February 22, 2017 19:32
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

3 participants