Conversation
|
Hey @ampproject/wg-caching! These files were changed: |
caroqliu
left a comment
There was a problem hiding this comment.
This is a great start and almost there. I had a few comments and suggestions, but otherwise ready to go. 👍 👍 👍
Bento components are required to be R1. We have an equivalent static getPreconnects(element) in R1 designed to take care of this. Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
ampproject#34838 Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com>
No need to override `init` if no changes were made to it except calling parent class's `init`. Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com>
…children` Since `passthrough` gives a `<slot>` reference to the children prop in all cases, let's make this passthroughNonEmpty -- which will only give a `<slot>` if there are children in the given markup. Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com>
No need to explicitly specify boolean `true` for conditional block. Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com>
Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com>
`height`, `heights`, `media`, `sizes`, and `width` are not needed to pass through as these attributes are specific to AMP's layout system and handled by the runtime. Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com>
`height`, `heights`, `media`, `sizes`, and `width` are not needed to pass through as these attributes are specific to AMP's layout system and handled by the runtime. Thus they do not need to be specify in typedef. Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com>
There was a problem hiding this comment.
For some reason I'm not able to comment on the comment thread on IframeEmbed -- there's not currently a way to execute the unmount logic in the IframeEmbed. We can add onMount/onUnmount props to that component so that the Soundcloud component can pass these in, though the current approach is fine as-is as well.
One last recommendation - I noticed that there are unit tests for the Preact layer but not the AMP layer. Please also add extensions/amp-soundcloud/1.0/test/test-amp-soundcloud.js. It can have similar test cases to the one in 0.1, though the iframe reference will come from shadow instead (see amp-instagram unit tests for an example of waiting for render and retrieving the iframe)
extensions/amp-soundcloud/1.0/test/validator-amp-soundcloud.out
Outdated
Show resolved
Hide resolved
Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com>
| useEffect(() => { | ||
| /** Unmount Procedure */ | ||
| return () => { | ||
| // Pause widget | ||
| iframeRef.current?.contentWindow?./*OK*/ postMessage( | ||
| JSON.stringify(dict({'method': 'pause'})), | ||
| 'https://w.soundcloud.com' | ||
| ); | ||
|
|
||
| // Release iframe resources | ||
| iframeRef.current = null; | ||
| }; | ||
| }, []); |
There was a problem hiding this comment.
@jridgewell Should this section be implemented via BaseElement['unloadOnPause'] or by providing a pause API? Asking based on this logic here, not seeing good examples of how/when to use:
amphtml/src/preact/base-element.js
Lines 846 to 856 in fcc6528
|
Looks like CI is stuck on the lint phase -- please run |
|
It looks like it is still having trouble on the lint step: https://app.circleci.com/pipelines/github/ampproject/amphtml/11890/workflows/5e9b2c18-36fd-4d4e-aa63-677a7efe6bc1/jobs/188651 Have you tried merging with |
|
Thank you so much to draw attention 👍🏻 |
|
I am not sure why |
It looks like an issue unrelated to your PR. I triggered a rerun and will keep an eye on it today so we can get this merged. :) |
* Initial Commit * Property mappings and Cleanup * Minor fixes, Formatting and Comments * More readable variable name * Test Cases for Bento * Updated test-cases and Storybook * Added base CSS File * Bug Fix: Layout System and Unit * Parent element changed from <div> to <> * Type correction for 'visual' parameter * Bug fix for color parameter in storybook * Update extensions/amp-soundcloud/1.0/base-element.js Bento components are required to be R1. We have an equivalent static getPreconnects(element) in R1 designed to take care of this. Co-authored-by: Justin Ridgewell <justin@ridgewell.name> * ♻️ Add 'wrapper' designation to bento ampproject#34838 Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com> * 🚮 Delete init/constructor of `amp-soundcloud` No need to override `init` if no changes were made to it except calling parent class's `init`. Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com> * ♻️ Use `passthroughNonEmpty` which only give `<slot>` for non empty `children` Since `passthrough` gives a `<slot>` reference to the children prop in all cases, let's make this passthroughNonEmpty -- which will only give a `<slot>` if there are children in the given markup. Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com> * ♻️ Warning for required props when not present * ♻️ Warning for required pros when not present * ♻️ Warning for required props when not present * ♻️ `trackId` and `playlistId` order chek Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com> * ♻️ `trackId` and `playlistId` order check Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com> * ♻️ Removed explicitly specify boolean `true` for conditional block No need to explicitly specify boolean `true` for conditional block. Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com> * ♻️ Added default value for `visual` prop in Preact component Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com> * 🚮 Removed props handled by AMP's layout system `height`, `heights`, `media`, `sizes`, and `width` are not needed to pass through as these attributes are specific to AMP's layout system and handled by the runtime. Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com> * 🚮 Removed unnecessary typedef `height`, `heights`, `media`, `sizes`, and `width` are not needed to pass through as these attributes are specific to AMP's layout system and handled by the runtime. Thus they do not need to be specify in typedef. Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com> * 🚮 Removed interface as no API exposed * ♻️ Moved `converter.js` into storybook * 🚮 Removed `layout` from Preact example, ♻️ Added `height` into style * 🚮 Removed empty CSS and `hasCss` from `bundles.config.extensions.json` * 🐛 `htmlFor` import fix for test case, ♻️ added `data-trackid` attribute * ♻️ Replaced `<iframe>` with `<IframeEmbed>` * ♻️ Updated specification for validation * 🏗 Added `npm` to `bundles.config.extensions.json` Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com> * ♻️ New line at EOF in `validator-amp-soundcloud.out` * Added 'loadable' to indicate a resource intensive component * 🏗 Fixes reported by 'amp lint' for CI * 🏗 Fixes for aliased imports for CI Co-authored-by: Justin Ridgewell <justin@ridgewell.name> Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com>
This PR adds a bento component for
amp-soundcloud.amp-soundcloudamp-soundcloudFixes #34734