Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

feat(Slider): add experimental slider #1683

Merged
merged 12 commits into from
Jan 22, 2019

Conversation

emyarod
Copy link
Member

@emyarod emyarod commented Dec 21, 2018

Closes IBM/carbon-components-react#1682

This PR will add the new experimental slider changes

related https://github.com/IBM/carbon-components-react/issues/1681

@netlify
Copy link

netlify bot commented Dec 21, 2018

Deploy preview for carbon-components-react ready!

Built with commit 6d88eed

https://deploy-preview-1683--carbon-components-react.netlify.com

@@ -154,12 +153,6 @@ export default class Slider extends PureComponent {
};
}

UNSAFE_componentWillReceiveProps(nextProps) {
if (!sliderValuePropSync && !isEqual(nextProps, this.props)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The removal here seems a breaking change, please see: #1370

Copy link
Contributor

@asudoh asudoh left a comment

Choose a reason for hiding this comment

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

Great progress @emyarod! Great to get in sync with TJ wrt the markup change.

<span className={`${prefix}--slider__range-label`}>
{formatLabel(max, maxLabel)}
</span>
{!hideTextInput && (
<TextInput
type={inputType}
id="input-for-slider"
id={`input-for-slider${id}`}
Copy link
Contributor

Choose a reason for hiding this comment

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

We tend to use ${id} as a prefix instead of a suffix (e.g. https://github.com/IBM/carbon-components-react/blob/v6.39.0/src/components/Select/Select.js#L31) - Wondering if it'd make sense to align the convention.

@emyarod emyarod force-pushed the 1682-experimental-slider branch 2 times, most recently from d09f186 to 37f63fa Compare January 2, 2019 19:20
@emyarod emyarod changed the title feat(Slider): add experimental slider [WIP] feat(Slider): add experimental slider Jan 7, 2019
Copy link
Contributor

@asudoh asudoh left a comment

Choose a reason for hiding this comment

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

LGTM 👍 if the change works with v9 style. Do you think this is still blocked by #1681? Thanks @emyarod !

@emyarod
Copy link
Member Author

emyarod commented Jan 8, 2019

@asudoh probably is not blocked but the topic discussed in #1681 is still something to consider in the future I believe

@emyarod
Copy link
Member Author

emyarod commented Jan 9, 2019

@asudoh the visual bug we are seeing in the React implementation is caused by the problem addressed in https://github.com/IBM/carbon-components-react/issues/1681 and #1684

Our React <TextInput> includes a form item/<FormItem> wrapper which affects the styles that should be applied to the input field

so we end up rendering

<div class="bx--form-item">
  <input>
</div>

rather than just

<input>

@asudoh
Copy link
Contributor

asudoh commented Jan 9, 2019

@emyarod As we discussed the slider element order issue is caused by https://github.com/IBM/carbon-components/pull/1315/files#diff-f8f1a0577791a85d255a9cdf4e2f791fR30 - Did you see it differently, or were you talking about another issue? Any more background?

@emyarod
Copy link
Member Author

emyarod commented Jan 10, 2019

@asudoh from what I can tell, the issue is caused by our <TextInput> component's wrapper div.

https://github.com/IBM/carbon-components-react/blob/master/src/components/Slider/Slider.js#L464

https://github.com/IBM/carbon-components-react/blob/master/src/components/TextInput/TextInput.js#L77

removing this wrapper causes the input box to be positioned correctly

I believe this line is also relevant in why a wrapper div would ruin the order of the elements https://github.com/IBM/carbon-components/pull/1315/files#diff-f8f1a0577791a85d255a9cdf4e2f791fR38

@asudoh
Copy link
Contributor

asudoh commented Jan 10, 2019

Thank you for the details @emyarod! I think the last link explains the issue the best. That said, when you remove the wrapper div, would you try adding display:flex to the new parent node in DOM inspector and see what happens?

@emyarod
Copy link
Member Author

emyarod commented Jan 11, 2019

@asudoh it looks like the new parent node already contains display: flex after removing the wrapper div, since the new parent node is .bx--slider-container

@asudoh
Copy link
Contributor

asudoh commented Jan 12, 2019

@emyarod Thank you for taking a look - Further investigation revealed that I was confused div.bx--form-item around text input vs. div.bx--form-item around slider, my apologies.

From that, I see two approaches to fix the problem:

  1. Direct usage of <input> instead of using <TextInput>
  2. Adding a CSS class for ordering <TextInput> within div.bx--form-item around slider

Thoughts...?

@emyarod
Copy link
Member Author

emyarod commented Jan 14, 2019

@asudoh I am leaning towards option 2 right now, but eventually I would like to address this in a future release after reopening the discussion on #1684

@emyarod
Copy link
Member Author

emyarod commented Jan 16, 2019

blocked by carbon-design-system/carbon#1640

@emyarod emyarod force-pushed the 1682-experimental-slider branch 2 times, most recently from 4184c4e to 9c97e21 Compare January 21, 2019 15:57
Copy link
Contributor

@asudoh asudoh left a comment

Choose a reason for hiding this comment

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

LGTM 👍 - Thanks @emyarod!

@emyarod
Copy link
Member Author

emyarod commented Jan 22, 2019

updated to include changes from carbon-design-system/carbon#1640

@asudoh asudoh merged commit 5d4b040 into carbon-design-system:master Jan 22, 2019
@carbon-bot
Copy link

🎉 This PR is included in version 6.81.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

4 participants