-
Notifications
You must be signed in to change notification settings - Fork 3
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
Percentage slider -> Aligned min/max dividers #427
Percentage slider -> Aligned min/max dividers #427
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment this is using a nested terniary which makes it very hard to read. It's better to break this logic in to different conditionals so it's easier to identify the cases it's being used for, perhaps instance (or line) for the normal case and then another for the end cases.
Also, I would like to add a prop to this component to make this alignment of the end numbers option (as there are cases where it will need to be aligned as it is originally). Thank you.
…the percentage slider
Thank you for your feedback. I appreciate your suggestion to improve readability by breaking down the nested ternary logic. I have refactored the code to use separate conditionals for better clarity, distinguishing between normal and end cases. Additionally, I have implemented a new prop for the component to provide an option for aligning the end numbers, as you've suggested. This will allow more flexibility in controlling the alignment based on specific use cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have only one comment in the new variable, since we want to continue to support the feature for previous versions let's make it optional.
Since the SliderInput base is modified please also update the story of the SliderInput
@@ -53,6 +53,7 @@ interface IPercentageSliderProps { | |||
inputCallback?: (value: number) => void | |||
updateThumbColor?: (value: number) => IFeedbackColor | |||
updateTitle?: (value: number) => string | |||
isCenterAlignedEndNum: boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a new prop, you might want to make it optional an also set it to false, since previously it was not center.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@isacoder, Feedback changes have been implemented, kindly review once again and let me know if any change is required.
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once Isabel's feedback has been followed, I'm happy to approve this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@isacoder san, I have pushed requested changes, can you please check it once and let me know if any changes needed |
I did a full review of the component, since the update is not working as expected. I think is better to use the logic that was already in the component since adding extra logic will increase maintenance of the component. I have made a commit to revert the previous logic. Also Updated the name of the variable isCenterAlignedEndNum -> allMarksCentered to reflect this change. @fti-rchaniya if you don't have a problem with this update we can move on with this PR |
@isacoder san, Thank you for your detailed review and efforts on addressing the update issue with the Slider component. I agree with your decision to leverage the existing logic in the component rather than introducing additional logic to avoid increasing maintenance overhead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated and approved
Description
This PR has following enhancement in the PercentageSlider component:
In our current component, it was noticed in the demo by @h2suzuki san that the alignment of the min (0%) and max(100%) values are not proper as shown in below attached snapshot,
So, I have aligned min (0%) and max(100%) values as shown in the below attached snapshot,