Skip to content

Commit

Permalink
chore: withTooltip->hasTooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
Arucard89 committed Jan 31, 2024
1 parent 2766e9b commit d491f2a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/components/Slider/Slider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $block: '.#{variables.$ns-new}slider';
var(--g-text-body-1-line-height) + 6px + #{slider-variables.$slider-tooltip-offset}
);
display: none;
&_withTooltip {
&_hasTooltip {
display: block;
}
&_size_xl {
Expand Down
8 changes: 4 additions & 4 deletions src/components/Slider/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const Slider = React.forwardRef(function Slider(
step = 1,
infoPointCount = 0,
availableValues,
withTooltip = false,
hasTooltip = false,
error,
disabled = false,
keyboard = true,
Expand Down Expand Up @@ -88,12 +88,12 @@ export const Slider = React.forwardRef(function Slider(
size,
error: Boolean(error) && !disabled,
disabled,
withTooltip: Boolean(withTooltip),
hasTooltip: Boolean(hasTooltip),
};

return (
<div className={b(null, className)}>
<div className={b('top', {size, withTooltip})}></div>
<div className={b('top', {size, hasTooltip})}></div>
<BaseSlider
ref={baseSliderRef}
value={innerState.value}
Expand All @@ -115,7 +115,7 @@ export const Slider = React.forwardRef(function Slider(
tabIndex={tabIndex}
data-qa={qa}
handleRender={
withTooltip
hasTooltip
? (originHandle, handleProps) => {
return (
<React.Fragment>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Slider/SliderTooltip/SliderTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type SliderTooltipProps = {
value: number;
className?: string;
style?: React.CSSProperties;
styleModifiers: Omit<StyleModifiers, 'withTooltip'>;
styleModifiers: Omit<StyleModifiers, 'hasTooltip'>;
};

export const SliderTooltip = ({value, className, style, styleModifiers}: SliderTooltipProps) => {
Expand Down
12 changes: 6 additions & 6 deletions src/components/Slider/__stories__/SliderShowcase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,28 @@ export const SliderShowcase = () => {
/>
</div>
<div className={blockCn}>
<ShowcaseBlock title="tooltip" withTooltip defaultValue={20} />
<ShowcaseBlock title="Range tooltip" withTooltip defaultValue={[20, 40]} />
<ShowcaseBlock title="tooltip" hasTooltip defaultValue={20} />
<ShowcaseBlock title="Range tooltip" hasTooltip defaultValue={[20, 40]} />
</div>
<div className={blockCn}>
<ShowcaseBlock title="tooltip disabled" withTooltip disabled defaultValue={20} />
<ShowcaseBlock title="tooltip disabled" hasTooltip disabled defaultValue={20} />
<ShowcaseBlock
title="Range tooltip disabled"
withTooltip
hasTooltip
disabled
defaultValue={[20, 40]}
/>
</div>
<div className={blockCn}>
<ShowcaseBlock
title="tooltip error"
withTooltip
hasTooltip
error={'Error description'}
defaultValue={20}
/>
<ShowcaseBlock
title="Range tooltip error"
withTooltip
hasTooltip
error={'Error description'}
defaultValue={[20, 40]}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Slider/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type SliderProps<ValueType = number | [number, number]> = {
//не используется, если есть availableValues
infoPointCount?: number;
availableValues?: number[];
withTooltip?: boolean;
hasTooltip?: boolean;

disabled?: boolean;
keyboard?: boolean;
Expand All @@ -44,7 +44,7 @@ export type StyleModifiers = {
size: SliderSize;
error: boolean;
disabled: boolean;
withTooltip: boolean;
hasTooltip: boolean;
};

export type BaseSliderRefType = RcSliderRef;

0 comments on commit d491f2a

Please sign in to comment.