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

[RNMobile] Gallery - Add append logic to MediaPlaceholder #18262

Conversation

mkevins
Copy link
Contributor

@mkevins mkevins commented Nov 4, 2019

Description

This PR modifies the MediaPlaceholder component to append media for the native Gallery implementation.

On web, when new media is added to a gallery, the current selection of items in the gallery is available to the media selection interface, and can be presented as such to the user. The selector behaves more like a "gallery editor", in the sense that the selection is modified (users can add and / or remove items). On mobile, the interface for selecting media items is handled by the "parent apps", and does not "know" about what is currently selected as part of the gallery.

This PR adds the addToGallery prop to the MediaPlaceholder component, and conditionally appends media items to the current selection, passing the resulting collection back through onSelect when the addToGallery flag is set. When the addToGallery flag is not set, onSelect behavior is not modified.

Note: In this implementation, duplicates are removed from the collection via the id property, since this is used as a key in the list of elements that renders these items.

The changeset here is used in the related "parent" PR: #18111, which includes these changes integrated with related changes in other components necessary for the gallery block.

To test

Test this component via the main draft PR.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@mkevins mkevins added [Status] In Progress Tracking issues with work in progress Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Block] Gallery Affects the Gallery Block - used to display groups of images labels Nov 4, 2019
@mkevins mkevins changed the base branch from master to try/gallery-draft-add-native-gallery November 7, 2019 01:51
@mkevins mkevins marked this pull request as ready for review November 7, 2019 01:51
@mkevins mkevins removed the [Status] In Progress Tracking issues with work in progress label Nov 7, 2019
@mkevins mkevins merged this pull request into try/gallery-draft-add-native-gallery Nov 7, 2019
@mkevins mkevins deleted the try/gallery-draft-mediaplaceholder branch November 7, 2019 01:53
@mkevins
Copy link
Contributor Author

mkevins commented Nov 7, 2019

Merged into Native Gallery PR to reduce the number of PRs in the PR hierarchy for mobile Gallery block. Tracked here: #18176.

mkevins added a commit that referenced this pull request Nov 7, 2019
* Add append logic to MediaPlaceholder for gallery

* Fix lint errors
mkevins added a commit that referenced this pull request Nov 12, 2019
* Add append logic to MediaPlaceholder for gallery

* Fix lint errors
mkevins added a commit that referenced this pull request Nov 19, 2019
* Add append logic to MediaPlaceholder for gallery

* Fix lint errors
mkevins added a commit that referenced this pull request Nov 22, 2019
* Add append logic to MediaPlaceholder for gallery

* Fix lint errors
mkevins added a commit that referenced this pull request Nov 25, 2019
* Add append logic to MediaPlaceholder for gallery

* Fix lint errors
mkevins added a commit that referenced this pull request Nov 26, 2019
* Add append logic to MediaPlaceholder for gallery

* Fix lint errors
mkevins added a commit that referenced this pull request Nov 28, 2019
* Add append logic to MediaPlaceholder for gallery

* Fix lint errors
mkevins added a commit that referenced this pull request Dec 3, 2019
* Add append logic to MediaPlaceholder for gallery

* Fix lint errors
mkevins added a commit that referenced this pull request Dec 4, 2019
* Add append logic to MediaPlaceholder for gallery

* Fix lint errors
mkevins added a commit that referenced this pull request Dec 4, 2019
* Add append logic to MediaPlaceholder for gallery

* Fix lint errors
mkevins added a commit that referenced this pull request Dec 4, 2019
* Add append logic to MediaPlaceholder for gallery

* Fix lint errors
mkevins added a commit that referenced this pull request Dec 4, 2019
* Add native gallery

* Add native gallery block behind DEV flag

* Refactor gallery to accept props more directly

* Pass isBlockSelected prop to gallery-image

* Pass isCropped prop to gallery-image

* Limit displayed columns on mobile for gallery

* Fix lint errors

* Use renamed tiles spacing prop in native gallery component

* [RNMobile] Gallery - Add append logic to MediaPlaceholder (#18262)

* Add append logic to MediaPlaceholder for gallery

* Fix lint errors

* Add margin-bottom to tiles in native gallery

* Limit displayed gallery columns to 4 for viewports < large

* Fix lint

* Add darkmode styles for MediaPlaceholder appender

* Use child-first approach for gallery image UI components

* Limit displayed columns in gallery to 4 on native

* Add block-level caption to native gallery

* Fix scss imports for jest

* Fix lint

* Use "narrow" instead of "mobile" semantics for viewport flag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant