-
Notifications
You must be signed in to change notification settings - Fork 4.1k
♻️ [Amp story shopping] Attachment as element child #36989
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
processprocess
merged 25 commits into
ampproject:main
from
processprocess:update-drawer
Nov 24, 2021
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
6c092af
Append drawer child
processprocess 19322cd
Lint
processprocess cd8e94d
lint
processprocess c31ef28
Remove dep
processprocess 2494534
Update layout.
processprocess 4a956ca
Remove layout from test
processprocess be3d84d
Non-working test
processprocess 2e58ad4
Rename test
processprocess 0359eac
Rename test
processprocess aaedcf7
add extension
processprocess f8d9812
Update test
processprocess 46da796
update test
processprocess eb3c18b
Update reference to impl.
processprocess 7cf4b56
Update tests and get impl.
processprocess 28fa051
Update tests.
processprocess e290868
Update testst
processprocess e178cee
lint
processprocess ccabfa7
Merge branch 'main' into update-drawer
processprocess 4eb53a8
Propagate theme
processprocess 85b632f
Comments.
processprocess b18f8ae
add shopping attchment exception to touch listeners.
processprocess dffeeaf
remove log
processprocess c39e1b4
remove log
processprocess 9803581
Update tests, if statement and variable rename.
processprocess 36ad2f9
typo
processprocess File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Append drawer child
- Loading branch information
commit 6c092af06439d4fc220d0d0e34d983587ac42e3f
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 27 additions & 16 deletions
43
extensions/amp-story-shopping/0.1/amp-story-shopping-attachment.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,43 @@ | ||
| import {Layout_Enum, applyFillContent} from '#core/dom/layout'; | ||
| import * as Preact from '#core/dom/jsx'; | ||
| import {Layout_Enum} from '#core/dom/layout'; | ||
| import {once} from '#core/types/function'; | ||
|
|
||
| import {AmpStoryPageAttachment} from 'extensions/amp-story/1.0/amp-story-page-attachment'; | ||
|
|
||
| const TAG = 'amp-story-shopping-attachment'; | ||
|
|
||
| export class AmpStoryShoppingAttachment extends AmpStoryPageAttachment { | ||
| export class AmpStoryShoppingAttachment extends AMP.BaseElement { | ||
processprocess marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /** @param {!AmpElement} element */ | ||
| constructor(element) { | ||
| super(element); | ||
|
|
||
| /** @private {string} */ | ||
| this.myText_ = TAG; | ||
| /** @private @return {extensions/amp-story/1.0/amp-story-page-attachment.js.AmpStoryPageAttachment} */ | ||
| this.attachmentEl_ = null; | ||
|
|
||
| /** @private {?Element} */ | ||
| this.container_ = null; | ||
| /** | ||
| * Caches a reference to the attachmnet's impl. | ||
| * @private @return {extensions/amp-story/1.0/amp-story-page-attachment.js.AmpStoryPageAttachment} | ||
| * */ | ||
| this.getAttachmentImpl_ = once(() => | ||
| customElements | ||
| .whenDefined('amp-story-page-attachment') | ||
| .then(() => this.attachmentEl_.getImpl()) | ||
| ); | ||
| } | ||
|
|
||
| /** @override */ | ||
| buildCallback() { | ||
| super.buildCallback(); | ||
| this.container_ = this.element.ownerDocument.createElement('div'); | ||
| this.container_.textContent = this.myText_; | ||
| this.element.appendChild(this.container_); | ||
| applyFillContent(this.container_, /* replacedContent */ true); | ||
| this.attachmentEl_ = ( | ||
| <amp-story-page-attachment layout="nodisplay"></amp-story-page-attachment> | ||
| ); | ||
| this.element.appendChild(this.attachmentEl_); | ||
| } | ||
|
|
||
| /** | ||
| * @param {boolean=} shouldAnimate | ||
processprocess marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| */ | ||
| open(shouldAnimate = true) { | ||
processprocess marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| this.getAttachmentImpl_().then((impl) => impl.open(shouldAnimate)); | ||
| } | ||
|
|
||
| /** @override */ | ||
| isLayoutSupported(layout) { | ||
| return layout == Layout_Enum.NODISPLAY; | ||
| return layout == Layout_Enum.FILL; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.