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

Percentage slider -> Aligned min/max dividers #427

Merged
merged 7 commits into from
Dec 19, 2023

Conversation

fti-rchaniya
Copy link
Collaborator

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,
    image

  • So, I have aligned min (0%) and max(100%) values as shown in the below attached snapshot,
    image

@fti-rchaniya fti-rchaniya requested review from fti-bcarpenter, a user and fti-pfarne October 19, 2023 12:05
Copy link
Collaborator

@atomworks atomworks left a 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.

@fti-rchaniya
Copy link
Collaborator Author

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.

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.
Kindly verify changes and let me know if it's match your suggestion
Thank you.

@atomworks atomworks requested a review from isacoder December 5, 2023 09:34
Copy link
Collaborator

@isacoder isacoder left a 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
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Copy link
Collaborator

@atomworks atomworks left a 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

Copy link
Collaborator

@isacoder isacoder left a comment

Choose a reason for hiding this comment

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

Hi! Thank you for updating the Slider Input Story, it's helping with this review.
I see that the last value in the example is very missed aligned. Please modify the code to cover this case too.

Screen Shot 2023-12-11 at 13 07 49

@isacoder isacoder self-requested a review December 11, 2023 04:32
@fti-rchaniya
Copy link
Collaborator Author

Hi! Thank you for updating the Slider Input Story, it's helping with this review. I see that the last value in the example is very missed aligned. Please modify the code to cover this case too.

Screen Shot 2023-12-11 at 13 07 49

Hi! Thank you for updating the Slider Input Story, it's helping with this review. I see that the last value in the example is very missed aligned. Please modify the code to cover this case too.

Screen Shot 2023-12-11 at 13 07 49

@isacoder san, I have pushed requested changes, can you please check it once and let me know if any changes needed
Thanks:woman-bowing:

@isacoder
Copy link
Collaborator

Hi! Thank you for updating the Slider Input Story, it's helping with this review. I see that the last value in the example is very missed aligned. Please modify the code to cover this case too.
Screen Shot 2023-12-11 at 13 07 49

Hi! Thank you for updating the Slider Input Story, it's helping with this review. I see that the last value in the example is very missed aligned. Please modify the code to cover this case too.
Screen Shot 2023-12-11 at 13 07 49

@isacoder san, I have pushed requested changes, can you please check it once and let me know if any changes needed Thanks:woman-bowing:

I did a full review of the component, since the update is not working as expected.
The Slider component was already capable of having the marks centered. This functionality was not available to UIKIT users because of design concerns. However since now is a requirement I think adding the prop to make it available is fine.

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 isacoder requested a review from a user December 15, 2023 05:19
@fti-rchaniya
Copy link
Collaborator Author

Hi! Thank you for updating the Slider Input Story, it's helping with this review. I see that the last value in the example is very missed aligned. Please modify the code to cover this case too.
Screen Shot 2023-12-11 at 13 07 49

Hi! Thank you for updating the Slider Input Story, it's helping with this review. I see that the last value in the example is very missed aligned. Please modify the code to cover this case too.
Screen Shot 2023-12-11 at 13 07 49

@isacoder san, I have pushed requested changes, can you please check it once and let me know if any changes needed Thanks:woman-bowing:

I did a full review of the component, since the update is not working as expected. The Slider component was already capable of having the marks centered. This functionality was not available to UIKIT users because of design concerns. However since now is a requirement I think adding the prop to make it available is fine.

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.
I support the proposed changes, and let's move forward with this pull request.
Thanks

Copy link
Collaborator

@isacoder isacoder left a comment

Choose a reason for hiding this comment

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

Updated and approved

@isacoder isacoder merged commit 82e9177 into main-v1.x Dec 19, 2023
1 check passed
@isacoder isacoder deleted the refactor/percentage_slider_divider_placement branch December 19, 2023 14:52
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.

4 participants