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

fix(Slider): added event param to onChange #8970

Merged
merged 3 commits into from May 3, 2023

Conversation

thatblindgeye
Copy link
Contributor

What: Closes #8963

Additional issues:

@patternfly-build
Copy link
Contributor

patternfly-build commented Apr 18, 2023

@@ -55,6 +55,12 @@ export interface SliderProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onCh
min?: number;
/** Value change callback. This is called when the slider value changes. */
onChange?: (
event:
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you use type any in all these examples, is it maybe more worth our time here to create a new type that is a union of all these types that can be imported by consumers so they can be using that type rather than any?

I presume the only reason you used 'any' in the examples themselves was because the actual event type is so long?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah good call. Added a type for the event param in the latest push

Copy link
Contributor

@nicolethoen nicolethoen left a comment

Choose a reason for hiding this comment

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

I think we will need to define the SliderOnChangeEvent in the docs. If we cannot add it to the propComponents array, then adding it directly to the markdown as a code snippet or something will suffice for the short term.

@thatblindgeye
Copy link
Contributor Author

@nicolethoen couldn't add it to the propComponents currently, so put a section after "Examples" to describe it

@nicolethoen nicolethoen requested a review from tlabaj April 25, 2023 14:43
@@ -19,6 +19,13 @@ export interface SliderStepObject {
value: number;
}

export type SliderOnChangeEvent =
Copy link
Contributor

@tlabaj tlabaj Apr 28, 2023

Choose a reason for hiding this comment

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

I think this is ok... I don't know that is necessary. Would we want to update other event type definitions elsewhere to be the same for consistency? What ever we decide, I would like to revisit the slider docs once this org issue gets resolve. I don't love the hand generated "Types" section in the docs.

@tlabaj tlabaj merged commit 222e8f9 into patternfly:v5 May 3, 2023
10 checks passed
@patternfly-build
Copy link
Contributor

Your changes have been released in:

  • @patternfly/react-code-editor@5.0.0-alpha.87
  • @patternfly/react-core@5.0.0-alpha.86
  • @patternfly/react-docs@6.0.0-alpha.93
  • demo-app-ts@5.0.0-alpha.70
  • @patternfly/react-integration@5.0.0-alpha.35
  • @patternfly/react-table@5.0.0-alpha.88

Thanks for your contribution! 🎉

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.

Slider: Add event as the first parameter of onChange
5 participants