Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update prop chart to include prefixCls #601

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update prop chart to include prefixCls #601

wants to merge 1 commit into from

Conversation

SebastianKurp
Copy link

@SebastianKurp SebastianKurp commented Oct 31, 2019

Hey!
Noticed that prefixCls is a prop that is exposed, but not documented. So I added it to the props chart in the readMe.
Here's an example code snippet of it in use, with a screenshot of the HTML to show that it is passing in the prefixCls to the className.

  <Slider
    prefixCls="predixClsTest"
  />

image

@tlehtimaki
Copy link

tlehtimaki commented May 19, 2020

This seems not to be the only one missing from the README.md. If you look at the src/Slider.tsx

slider/src/Slider.tsx

Lines 7 to 47 in b5a337e

export interface SliderProps {
value?: number;
defaultValue?: number;
min?: number;
max?: number;
step?: number;
prefixCls?: string;
onChange?: (value: number) => void;
onBeforeChange?: (value: number) => void;
onAfterChange?: (value: number) => void;
vertical?: boolean;
included?: boolean;
disabled?: boolean;
reverse?: boolean;
minimumTrackStyle?: React.CSSProperties;
trackStyle?: React.CSSProperties;
handleStyle?: React.CSSProperties;
tabIndex?: number;
ariaLabelForHandle?: string;
ariaLabelledByForHandle?: string;
ariaValueTextFormatterForHandle?: string;
startPoint?: number;
handle: (props: {
className: string;
prefixCls?: string;
vertical?: boolean;
offset: number;
value: number;
dragging?: boolean;
disabled?: boolean;
min?: number;
max?: number;
reverse?: boolean;
index: number;
tabIndex?: number;
ariaLabel: string;
ariaLabelledBy: string;
ariaValueTextFormatter: string;
style?: React.CSSProperties;
ref?: React.Ref<any>;
}) => React.ReactElement;

The docs do not match with the interface very well or am I missing somehing? Maybe there should be a seperate issue and fix all at once.

And here it seems that the defaults set can be seen from src/common/createSlider.tsx

static defaultProps = {
...Component.defaultProps,
prefixCls: 'rc-slider',
className: '',
min: 0,
max: 100,
step: 1,
marks: {},
handle(props) {
const { index, ...restProps } = props;
delete restProps.dragging;
if (restProps.value === null) {
return null;
}
return <Handle {...restProps} key={index} />;
},
onBeforeChange: noop,
onChange: noop,
onAfterChange: noop,
included: true,
disabled: false,
dots: false,
vertical: false,
reverse: false,
trackStyle: [{}],
handleStyle: [{}],
railStyle: {},
dotStyle: {},
activeDotStyle: {},
};

@yoyo837
Copy link
Member

yoyo837 commented Apr 15, 2023

Rebase please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants