Skip to content

Conversation

abdulbasithqb
Copy link
Contributor

@abdulbasithqb abdulbasithqb commented May 29, 2024

What does this PR do?

fix: Storybook - RangeInput/Bounds example

Where should the reviewer start?

Storybook - RangeInput/Bounds example

What testing has been done on this PR?

Manually clicking the + and - to ensure the expected behavior.

How should this be manually tested?

go to Storybook - RangeInput/Bounds example then click + and - and validate it

Do Jest tests follow these best practices?

  • screen is used for querying.
  • The correct query is used. (Refer to this list of queries)
  • asFragment() is used for snapshot testing.

Any background context you want to provide?

What are the relevant issues?

fixes: #7242

Screenshots (if appropriate)

Screen.Recording.2024-06-03.at.9.36.30.AM.mov

Do the grommet docs need to be updated?

Should this PR be mentioned in the release notes?

Is this change backwards compatible or is it a breaking change?

No

Copy link
Collaborator

@jcfilben jcfilben left a comment

Choose a reason for hiding this comment

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

Thanks for working on this!

One small comment, as soon as the value hits the min or max the button should become disabled. In this PR the button only becomes disabled when we hit the min/max and then try to click the button again.

One potential solution is instead of the setIsSubtractDisabled(true) or setIsAddDisabled(true) being called in the onClick you could use a useEffect that gets called when the value changes and then check if the value is equal to the max/min and if it is set the button to be disabled.

@abdulbasithqb
Copy link
Contributor Author

abdulbasithqb commented Jun 3, 2024

Thanks for working on this!

One small comment, as soon as the value hits the min or max the button should become disabled. In this PR the button only becomes disabled when we hit the min/max and then try to click the button again.

One potential solution is instead of the setIsSubtractDisabled(true) or setIsAddDisabled(true) being called in the onClick you could use a useEffect that gets called when the value changes and then check if the value is equal to the max/min and if it is set the button to be disabled.

@jcfilben Done, please check

Copy link
Collaborator

@jcfilben jcfilben left a comment

Choose a reason for hiding this comment

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

@abdulbasithqb
Copy link
Contributor Author

abdulbasithqb commented Jun 4, 2024


[fix: lint fix](/grommet/grommet/pull/7244/commits/c6f14e8214ddf3263948a4de0783bcb174f50bd2)

Fixed

Copy link
Collaborator

@halocline halocline left a comment

Choose a reason for hiding this comment

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

@abdulbasithqb, thank you for your contribution!

@jcfilben jcfilben merged commit 8680751 into grommet:master Jun 4, 2024
undeletable pushed a commit to undeletable/grommet that referenced this pull request Jun 4, 2024
* fix: Storybook - RangeInput/Bounds example

* feedback: use usEeffect for disable buttons

* feedback: use usEeffect for disable buttons

* fix: lint fix
britt6612 pushed a commit that referenced this pull request Jun 13, 2024
* Move default parameters from defaultProps to function definitions

* Fix Bar component

* Update snapshots

* Remove defaultProps from styled components - first iteration

* Fix styledWithTheme HOC to return correct function

* Fix prototypes for styledWithTheme

* Fix theme

* Add TODOs

* Fix Menu test

* Add TODO

* Remove TODO

* Define hook for theme context with fallback to default one

* Pass default props to styled component

* Use attrs from styled-components

* Update snapshots

* Pass theme along with default props

* Fix props

* Fix syntax

* Fix theme in props

* Merge props

* Rename function

* Fix lint errors

* Switch from deepMerge to object copy

* Fix snapshots

* Try upgrading styled-components

* Roll back to previous styled-components version

* Roll back lockfile

* Only pass theme using attrs

* Fix snapshots

* Rename method

* Add comment.

DCO Remediation Commit for Max Shepel <max@undeletable.name>

I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: cd9a5b7
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 14838be
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 1766eed
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: b5e5d26
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: f005071
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 9f56eca
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 019d28b
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 45f81b2
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: b1ca758
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: be3a510
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: a8ed76e
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: e329a7a
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: ccd1a6c
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 87adfd3
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 164ac90
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 3926bc9
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 1abbf1b
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: bc92022
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 50478dd
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 9e94bce
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 2911f33
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 780ede8
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 74b3e2b
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 58770f0
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 7d584c8
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: b36c664
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: bd1a606
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 86687bf
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 302564b
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 3772235

Signed-off-by: Max Shepel <max@undeletable.name>

* Update snapshots

* Remove 'only' from test

* Remove attrs() usages where it's not required

* DCO Remediation Commit for Max Shepel <max@undeletable.name>

I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 6cc1019
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 429627c
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 5c80f67

Signed-off-by: Max Shepel <max@undeletable.name>

* Fix typo

Signed-off-by: Max Shepel <max@undeletable.name>

* Add missing attrs() call. Add enhancePropsWithTheme declaration

Signed-off-by: Max Shepel <max@undeletable.name>

* Fix Menu test

Signed-off-by: Max Shepel <max@undeletable.name>

* Don't mark values prop of Distribution as required as it has default parameter value

Signed-off-by: Max Shepel <max@undeletable.name>

* empty commit to tty and trigger chromatic

* fix: Storybook - RangeInput/Bounds example (#7244)

* fix: Storybook - RangeInput/Bounds example

* feedback: use usEeffect for disable buttons

* feedback: use usEeffect for disable buttons

* fix: lint fix

* add tests for components outside grommet wrapper

* add tests for components outside grommet wrapper

* add tests for components outside grommet wrapper

* Add fallback to default theme where it also might be necessary

Signed-off-by: Max Shepel <max@undeletable.name>

* Revert "add tests for components outside grommet wrapper"

This reverts commit 3fd3a11.

* Revert "add tests for components outside grommet wrapper"

This reverts commit f492adb.

* Revert "add tests for components outside grommet wrapper"

This reverts commit a954793.

* Third-Party DCO Remediation Commit for Basith <134603758+abdulbasithqb@users.noreply.github.com>

On behalf of Basith <134603758+abdulbasithqb@users.noreply.github.com>, I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 2a4e9ac

Signed-off-by: Max Shepel <max@undeletable.name>

* Third-Party DCO Remediation Commit for Brittany Archibeque <brittanyarchibeque@Brittanys-MBP-2.home>

On behalf of Brittany Archibeque <brittanyarchibeque@Brittanys-MBP-2.home>, I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: a954793
On behalf of Brittany Archibeque <brittanyarchibeque@Brittanys-MBP-2.home>, I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: f492adb
On behalf of Brittany Archibeque <brittanyarchibeque@Brittanys-MBP-2.home>, I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 3fd3a11

Signed-off-by: Max Shepel <max@undeletable.name>

* Third-Party DCO Remediation Commit for Jessica Filben <54560994+jcfilben@users.noreply.github.com>

On behalf of Jessica Filben <54560994+jcfilben@users.noreply.github.com>, I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 60d5ece

Signed-off-by: Max Shepel <max@undeletable.name>

* DCO Remediation Commit for Max Shepel <max@undeletable.name>

I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: a1a5a03
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: a092b71
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: fa50a41

Signed-off-by: Max Shepel <max@undeletable.name>

* Add missing snapshots

Signed-off-by: Max Shepel <max@undeletable.name>

---------

Signed-off-by: Max Shepel <max@undeletable.name>
Co-authored-by: Jessica Filben <54560994+jcfilben@users.noreply.github.com>
Co-authored-by: Basith <134603758+abdulbasithqb@users.noreply.github.com>
Co-authored-by: Brittany Archibeque <brittanyarchibeque@Brittanys-MBP-2.home>
jcfilben added a commit that referenced this pull request Jul 1, 2024
* Remove grommet wrapper (#7249)

* re-trigger token circle ci

* add tests for components outside grommet wrapper

* add tests for components outside grommet wrapper

* add tests for components outside grommet wrapper

* Update src/js/components/Calendar/__tests__/Calendar-test.tsx

Co-authored-by: Jessica Filben <54560994+jcfilben@users.noreply.github.com>

* Update src/js/components/FormField/__tests__/FormField-test.js

Co-authored-by: Jessica Filben <54560994+jcfilben@users.noreply.github.com>

* Update src/js/components/ThumbsRating/__tests__/ThumbsRating.tsx

Co-authored-by: Jessica Filben <54560994+jcfilben@users.noreply.github.com>

* remove data friends tests

* remove data friends tests

* update tests

* update tests

---------

Co-authored-by: Brittany Archibeque <brittanyarchibeque@Brittanys-MBP-2.home>
Co-authored-by: Jessica Filben <54560994+jcfilben@users.noreply.github.com>

* Remove defaultProps usages for functional components (#7224)

* Move default parameters from defaultProps to function definitions

* Fix Bar component

* Update snapshots

* Remove defaultProps from styled components - first iteration

* Fix styledWithTheme HOC to return correct function

* Fix prototypes for styledWithTheme

* Fix theme

* Add TODOs

* Fix Menu test

* Add TODO

* Remove TODO

* Define hook for theme context with fallback to default one

* Pass default props to styled component

* Use attrs from styled-components

* Update snapshots

* Pass theme along with default props

* Fix props

* Fix syntax

* Fix theme in props

* Merge props

* Rename function

* Fix lint errors

* Switch from deepMerge to object copy

* Fix snapshots

* Try upgrading styled-components

* Roll back to previous styled-components version

* Roll back lockfile

* Only pass theme using attrs

* Fix snapshots

* Rename method

* Add comment.

DCO Remediation Commit for Max Shepel <max@undeletable.name>

I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: cd9a5b7
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 14838be
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 1766eed
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: b5e5d26
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: f005071
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 9f56eca
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 019d28b
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 45f81b2
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: b1ca758
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: be3a510
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: a8ed76e
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: e329a7a
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: ccd1a6c
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 87adfd3
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 164ac90
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 3926bc9
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 1abbf1b
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: bc92022
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 50478dd
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 9e94bce
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 2911f33
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 780ede8
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 74b3e2b
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 58770f0
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 7d584c8
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: b36c664
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: bd1a606
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 86687bf
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 302564b
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 3772235

Signed-off-by: Max Shepel <max@undeletable.name>

* Update snapshots

* Remove 'only' from test

* Remove attrs() usages where it's not required

* DCO Remediation Commit for Max Shepel <max@undeletable.name>

I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 6cc1019
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 429627c
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 5c80f67

Signed-off-by: Max Shepel <max@undeletable.name>

* Fix typo

Signed-off-by: Max Shepel <max@undeletable.name>

* Add missing attrs() call. Add enhancePropsWithTheme declaration

Signed-off-by: Max Shepel <max@undeletable.name>

* Fix Menu test

Signed-off-by: Max Shepel <max@undeletable.name>

* Don't mark values prop of Distribution as required as it has default parameter value

Signed-off-by: Max Shepel <max@undeletable.name>

* empty commit to tty and trigger chromatic

* fix: Storybook - RangeInput/Bounds example (#7244)

* fix: Storybook - RangeInput/Bounds example

* feedback: use usEeffect for disable buttons

* feedback: use usEeffect for disable buttons

* fix: lint fix

* add tests for components outside grommet wrapper

* add tests for components outside grommet wrapper

* add tests for components outside grommet wrapper

* Add fallback to default theme where it also might be necessary

Signed-off-by: Max Shepel <max@undeletable.name>

* Revert "add tests for components outside grommet wrapper"

This reverts commit 3fd3a11.

* Revert "add tests for components outside grommet wrapper"

This reverts commit f492adb.

* Revert "add tests for components outside grommet wrapper"

This reverts commit a954793.

* Third-Party DCO Remediation Commit for Basith <134603758+abdulbasithqb@users.noreply.github.com>

On behalf of Basith <134603758+abdulbasithqb@users.noreply.github.com>, I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 2a4e9ac

Signed-off-by: Max Shepel <max@undeletable.name>

* Third-Party DCO Remediation Commit for Brittany Archibeque <brittanyarchibeque@Brittanys-MBP-2.home>

On behalf of Brittany Archibeque <brittanyarchibeque@Brittanys-MBP-2.home>, I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: a954793
On behalf of Brittany Archibeque <brittanyarchibeque@Brittanys-MBP-2.home>, I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: f492adb
On behalf of Brittany Archibeque <brittanyarchibeque@Brittanys-MBP-2.home>, I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 3fd3a11

Signed-off-by: Max Shepel <max@undeletable.name>

* Third-Party DCO Remediation Commit for Jessica Filben <54560994+jcfilben@users.noreply.github.com>

On behalf of Jessica Filben <54560994+jcfilben@users.noreply.github.com>, I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: 60d5ece

Signed-off-by: Max Shepel <max@undeletable.name>

* DCO Remediation Commit for Max Shepel <max@undeletable.name>

I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: a1a5a03
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: a092b71
I, Max Shepel <max@undeletable.name>, hereby add my Signed-off-by to this commit: fa50a41

Signed-off-by: Max Shepel <max@undeletable.name>

* Add missing snapshots

Signed-off-by: Max Shepel <max@undeletable.name>

---------

Signed-off-by: Max Shepel <max@undeletable.name>
Co-authored-by: Jessica Filben <54560994+jcfilben@users.noreply.github.com>
Co-authored-by: Basith <134603758+abdulbasithqb@users.noreply.github.com>
Co-authored-by: Brittany Archibeque <brittanyarchibeque@Brittanys-MBP-2.home>

* Remove isRequired from propTypes (#7252)

* remove isRequired from propTypes

* revert unnecessary removals of isRequired

* add isrequired to fromTarget and toTarget and link diagram proptypes to the diagram component

* refactor routed components for react 19 compatibility (#7253)

* Upgrade react version

* rename function to withTheme

* incorporate review comments

---------

Signed-off-by: Max Shepel <max@undeletable.name>
Co-authored-by: Brittany <42451602+britt6612@users.noreply.github.com>
Co-authored-by: Brittany Archibeque <brittanyarchibeque@Brittanys-MBP-2.home>
Co-authored-by: Max Shepel <undeletable@users.noreply.github.com>
Co-authored-by: Basith <134603758+abdulbasithqb@users.noreply.github.com>
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.

Storybook - RangeInput/Bounds example
3 participants