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

refactor(Slider): replace Carbon TextInput #2085

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/components/Slider/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
import isEqual from 'lodash.isequal';
import { settings } from 'carbon-components';
import TextInput from '../TextInput';
import { sliderValuePropSync } from '../../internal/FeatureFlags';
import { componentsX } from '../../internal/FeatureFlags';

Expand Down Expand Up @@ -407,9 +406,14 @@ export default class Slider extends PureComponent {
className
);

const inputClasses = classNames(`${prefix}--slider-text-input`, {
[`${prefix}--text-input--light`]: light,
});
const inputClasses = classNames(
`${prefix}--text-input`,
`${prefix}--slider-text-input`,
{
[`${prefix}--text-input--light`]: light,
[`${prefix}--text-input--invalid`]: this.props.invalid,
}
);

const filledTrackStyle = {
transform: `translate(0%, -50%) scaleX(${left / 100})`,
Expand Down Expand Up @@ -483,7 +487,7 @@ export default class Slider extends PureComponent {
{formatLabel(max, maxLabel)}
</span>
{!hideTextInput && (
<TextInput
<input
type={inputType}
id={`${id}-input-for-slider`}
className={inputClasses}
Expand Down