Skip to content

Conversation

jeffcap1
Copy link
Owner

What does this PR do?

Adds functionality to provide a list of ItemKeys to be pinned in place within the list and will not change when the list is reordered.

Where should the reviewer start?

Please review the context provided in issue 6229 explaining why this feature was requested and the proposed change that was implemented. Then review Storybook and Jest tests for further context regarding functionality and implementation.
Finally a useMemo hook is used to derive the orderableItems from the pinnedItems which is used to replace the data object and the orderableIndex is found for each item. These replace the previously used data and index to find and set active items and updates from within the reorder function.

What testing has been done on this PR?

Tests have been written in Jest as well as a Storybook story. Tests verify that the pinned items are styled appropriately. Also, after a re-orderable item is moved that the pinned item does not change its position.

How should this be manually tested?

Do Jest tests follow these best practices?

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

Any background context you want to provide?

Pleas see the context provided in Issue 6229.

What are the relevant issues?

Issue #6229

Screenshots (if appropriate)

image

Do the grommet docs need to be updated?

Yes

Should this PR be mentioned in the release notes?

Yes

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

The only minor change that might be breaking is regarding the ItemKey. If the PrimaryKey is provided and not the ItemKey for an object, the PrimaryKey will be set as the ItemKey. Line number is 175.

// fixes issue where itemKey is undefined when only primaryKey is provided
const itemKey = defaultItemKey || primaryKey || null;

jeffcap1 and others added 16 commits July 13, 2022 01:53
* Fix Video Scrubber focus styles

* Update snapshots

Co-authored-by: Eric Soderberg <eric.soderberg@hpe.com>
* Fixed FileInput component cursor type behavior

* Code review fix

Co-authored-by: Eric Soderberg <eric.soderberg@hpe.com>
Co-authored-by: Eric Soderberg <eric.soderberg@hpe.com>
* Cancel debounce after formfield unmounts

* remove console.log

* use debounceDelay from theme

* change debounce to be inside of a useEffect to handle cleanup on unmount

* feedback from review

* move hook outside component

Co-authored-by: Eric Soderberg <eric.soderberg@hpe.com>
* Update Calendar to rely on Date object

* Fix typo

* Remove unnecessary useEffects

* Fix reference causing date to select the first

* Align reference logic with docs

* standardize date and reference as Date objects

* Update accessibility strings to use toLocaleDateString

* Fix keyboard and remove comments

* Convert date to ISOstring

* fix single selection

* Adjust DateInput to leverage new functionality

* Add comment

* normalization and progress on handling multiple dates bug

* Update DateInput reference date

* normalize date using supplied timestamp

* preserve callers datetime format

* handle multiple and range

* consolidate onClick logic

* fix adjust for timezone logic

* normalize output, refactor selected and handleRange

* Update calendar range

* Add snapshot tests

* Add DateInput fixes

* Handle offset from user timezone

* refactor handleRange

* remove last references to date and dates

* Add script to test across timezones

* Leave stories untouched

* Simplify test, remove unused functions

* Add daylight savings test

* Fix updating displayBounds

Co-authored-by: Matt Glissmann <mdglissmann@gmail.com>
* Changed DataChart to fix an issue with detail padding.

* Make Detail smarter about combining thickness and pad
Co-authored-by: Eric Soderberg <eric.soderberg@hpe.com>
@jeffcap1 jeffcap1 changed the title Feat/list pin items feat(pinned items): Issue #6229 Adds pinned functionality to List Component Jul 24, 2022
@jeffcap1 jeffcap1 merged commit b9d8b96 into master Jul 24, 2022
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.

7 participants