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

🚀 [Story performance] Move building share menu to share-menu.js #37209

Merged
merged 15 commits into from
Dec 20, 2021

Conversation

mszylkowski
Copy link
Contributor

@mszylkowski mszylkowski commented Dec 13, 2021

Closes #37205
Closes #37204
Closes #29773
Contributes to I2I #37198

Moves all the logic, templates and styles necessary to create the Desktop (fallback) sharing menu into amp-story-share-menu.js, and creates the share menu when clicked on the share icon for the first time only (meaning it installs AmpSocialShare also when clicked on the share icon for the first time).
Removes unnecessary styles like widget-scrollable which is not used (I think it was used in bookends but not anymore).

Functionality:

  • amp-story-share.js bundled in amp-story-1.0.js will take care of the native sharing, and determining whether we should build the fallback menu. To build the share menu it creates a host element and then calls new AmpStoryShareMenu(hostEl), which will happen in the new extension once we split the bundles (by moving this line to the extension we will have split the share menu from the bundle, on follow-up PR). It takes care of analytics as well, so that native sharing and fallback sharing both report in the same way.
  • amp-story-share-menu.js is still bundled in amp-story-1.0.js for now but it doesn't care about system sharing (if an AmpStoryShareMenu is created, it will build and show). The share menu subscribes to the store service to know when to open/close and the desktop/mobile UI, and listens to ESC key events.

@mszylkowski mszylkowski self-assigned this Dec 14, 2021
@mszylkowski mszylkowski marked this pull request as ready for review December 14, 2021 20:17
@amp-owners-bot
Copy link

amp-owners-bot bot commented Dec 14, 2021

Hey @gmajoulet, @newmuis! These files were changed:

extensions/amp-story/1.0/amp-story-share.js
extensions/amp-story/1.0/amp-story.js
extensions/amp-story/1.0/test/test-amp-story-share-menu.js
extensions/amp-story/1.0/test/test-amp-story-share.js
extensions/amp-story/1.0/test/test-amp-story.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants