Skip to content

🚀 [Story performance] Move open page attachment UI to extension #37278

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

Merged
merged 39 commits into from
Jan 12, 2022

Conversation

mszylkowski
Copy link
Contributor

@mszylkowski mszylkowski commented Dec 28, 2021

Moves the open page attachment UI (the "swipe up" button / hint) to the amp-story-page-attachment extension.

Removes an extra 1.8kB of amp-story, and adds 2kB to amp-story-page-attachment.

dist/v0/amp-story-page-attachment-0.1.mjs: Δ +2.08KB
dist/v0/amp-story-page-attachment-0.1.js: Δ +2.20KB
dist/v0/amp-story-0.1.mjs: Δ -1.79KB
dist/v0/amp-story-1.0.mjs: Δ -1.79KB
dist/v0/amp-story-0.1.js: Δ -1.80KB
dist/v0/amp-story-1.0.js: Δ -1.80KB

@mszylkowski mszylkowski changed the title 🚀 [Story performance] Try remove attachment UI 🚀 [Story performance] Move open page attachment UI to extension Jan 4, 2022
@mszylkowski mszylkowski self-assigned this Jan 4, 2022
@mszylkowski mszylkowski marked this pull request as ready for review January 4, 2022 16:00
@amp-owners-bot
Copy link

amp-owners-bot bot commented Jan 4, 2022

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

extensions/amp-story-page-attachment/0.1/amp-story-open-page-attachment.css
extensions/amp-story-page-attachment/0.1/amp-story-open-page-attachment.js
extensions/amp-story-page-attachment/0.1/amp-story-page-attachment.css
extensions/amp-story-page-attachment/0.1/amp-story-page-attachment.js
extensions/amp-story-page-attachment/0.1/test/test-amp-story-open-page-attachment.js
extensions/amp-story-page-attachment/0.1/test/test-amp-story-page-attachment.js
extensions/amp-story/1.0/amp-story-page.js
extensions/amp-story/1.0/amp-story.css
extensions/amp-story/1.0/test/test-amp-story-page.js

@mszylkowski mszylkowski requested a review from gmajoulet January 4, 2022 16:02
@@ -94,14 +97,20 @@ const ctaLabelFromAttr = (element) =>
* @param {?string} label
* @return {?string}
*/
const openLabelOrFallback = (element, attachmentEl, label) =>
attachmentEl.tagName === 'AMP-STORY-SHOPPING-ATTACHMENT'
? localize(element, LocalizedStringId_Enum.AMP_STORY_SHOPPING_CTA_LABEL)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use the localize helper?

Copy link
Contributor Author

@mszylkowski mszylkowski Jan 4, 2022

Choose a reason for hiding this comment

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

The localize helper is used inside amp-story because part of it is "instantiate a new LocalizationService if not instantiated already" (since the amp-story bundle has that service, it's free to do that in there). On extensions we don't want to add the service in the bundle, just fetch it from the document, so we can't use that localize helper or we would be bundling it into all the extensions that need it.

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.

3 participants