-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Support layout=container in amp-list #27159
Conversation
ba53966
to
cea0978
Compare
Is this ready for review? |
@choumx Yes go ahead. :) Thanks! |
Hey @ampproject/wg-caching, these files were changed:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just needs documentation next?
extensions/amp-list/amp-list.md
Outdated
[filter formats="websites, stories"] | ||
In several cases, we may need the `<amp-list>` to resize on user interaction. For example, when the `<amp-list>` contains an amp-accordion that a user may tap on, when the contents of the `<amp-list>` change size due to bound CSS classes, or when the number of items inside an `<amp-list>` changes due to a bound `[src]` attribute. The `changeToLayoutContainer` action handles this by changing the amp list to `layout="CONTAINER"` when triggering this action. See the following example: | ||
Before support for `layout="CONTAINER"` was added, in several cases, we needed the `<amp-list>` to resize on user interaction. For example, when the `<amp-list>` contains an amp-accordion that a user may tap on, when the contents of the `<amp-list>` change size due to bound CSS classes, or when the number of items inside an `<amp-list>` changes due to a bound `[src]` attribute. The `changeToLayoutContainer` action handles this by changing the amp list to `layout="CONTAINER"` when triggering this action. See the following example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think API documentation probably always reflect the latest state; describing new features usually is done in a blog or release notes.
It may be more useful to explain when to use layout=container
and when to use changeToLayoutContainer
action here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, this is tricky to explain. Let's get this in and iterate.
We can also revisit in V2. changeToLayoutContainer
and [is-layout-container]
probably should be changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Just nits :)
extensions/amp-list/0.1/amp-list.js
Outdated
* Applicable for layout=container. | ||
* @private | ||
*/ | ||
unlockHeight_() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: somehow communicate that this should be done inside a mutate callback, I usually add a suffix.
unlockHeight_() { | |
unlockHeightInsideMutate_() { |
Co-Authored-By: Alan Orozco <alanorozco@users.noreply.github.com>
Co-Authored-By: Alan Orozco <alanorozco@users.noreply.github.com>
* Prototype for container layout in amp-list. * Remove unused import * Don't apply fillContent for layout=container * Restore old example page * Move layout=container example to new document * Move isLayoutSizeDefined_ to buildCallback * Add line * Set isLayoutSizeDefined when changing to container * Check layout is defined * Replace isLayoutSizeDefined with isLayoutContainer * Fix some tests, comment out 4 * Remove bottom padding for sample * Move resize logic to attemptToFit * Set styles on refresh * Uncomment tests * Restore line * Will comments * Handle changeToLayoutContainer action * Only set height for layout=container * Validate layout=container * Assert placeholder presence for layout=container * Fix indent * Move height locking to helper methods * Unit test for unlock * Unlock height inside render * Move measure to `lockHeightAndMutate` * Catch errors inside attemptToFit * Remove arrow * Always measure height * Will comments * Add documentation * Update md language * Update info link Co-Authored-By: Alan Orozco <alanorozco@users.noreply.github.com> * Re-shrink boilerplate code Co-Authored-By: Alan Orozco <alanorozco@users.noreply.github.com> * Rename unlockHeight Co-authored-by: William Chou <willchou@google.com> Co-authored-by: Alan Orozco <alanorozco@users.noreply.github.com>
* cl/302030563 Revision bump for #27280 * cl/302033641 Remove trailing whitespace from protoascii * cl/302035592 Revision bump for #27159 * cl/302061262 github commit msg missing or malformed * revert * revert * revert * revert * revert * trying to kickstart travis Co-authored-by: Greg Grothaus <greggrothaus@google.com>
This reverts commit b0187b7.
This reverts commit b0187b7.
Builds off #26888, Closes #26873
PR deploy bot demo