Skip to content

Commit

Permalink
refactor(SliderStep): use token instead for hardcoded value (#9651)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamviktora authored Sep 20, 2023
1 parent ff467ee commit cfd927c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/react-core/src/components/Slider/SliderStep.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import styles from '@patternfly/react-styles/css/components/Slider/slider';
import { css } from '@patternfly/react-styles';
import sliderStepLeft from '@patternfly/react-tokens/dist/esm/c_slider__step_Left';

export interface SliderStepProps extends Omit<React.HTMLProps<HTMLDivElement>, 'label'> {
/** Additional classes added to the slider step. */
Expand All @@ -26,7 +27,7 @@ export const SliderStep: React.FunctionComponent<SliderStepProps> = ({
isActive = false,
...props
}: SliderStepProps) => {
const style = { '--pf-v5-c-slider__step--Left': `${value}%` } as React.CSSProperties;
const style = { [sliderStepLeft.name]: `${value ? value : sliderStepLeft.value}%` } as React.CSSProperties;
return (
<div className={css(styles.sliderStep, isActive && styles.modifiers.active, className)} style={style} {...props}>
{!isTickHidden && <div className={css(styles.sliderStepTick)} />}
Expand Down

0 comments on commit cfd927c

Please sign in to comment.