-
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
initialize amp-list from amp-state, finishing touches #27180
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3065aeb
amp-list: add example for initialization from amp-state
samouri 6c83ebb
improve example, and add amp-state to allowed protocols
samouri cbf57d1
add documentation
samouri 649fe6e
remove feature flag
samouri cef1194
unique ids
samouri 3f07676
lint
samouri fe352c4
format amp-list.md
samouri 34e24dd
remove accidental additions
samouri 5e92cc7
address choumx feedback
samouri 427d127
revert experiments-config.js
samouri f07127f
ben rewrite
samouri 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
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!doctype html> | ||
<html ⚡> | ||
<head> | ||
<meta charset="utf-8"> | ||
<script async src="https://cdn.ampproject.org/v0.js"></script> | ||
<script async custom-element="amp-list" src="https://cdn.ampproject.org/v0/amp-list-0.1.js"></script> | ||
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-latest.js"></script> | ||
<script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script> | ||
<link rel="canonical" href="https://amp.dev/documentation/examples/components/amp-list/"> | ||
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> | ||
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> | ||
<style amp-custom> | ||
amp-list { | ||
margin-left: 16px; | ||
} | ||
.list-overflow { | ||
width: 160px; | ||
margin-left: auto; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div on="tap:list1.refresh,list2.refresh,list3.refresh"> | ||
Refresh All Lists | ||
</div> | ||
|
||
<h3>Static amp-list, inlined state. | ||
<button on="tap:AMP.setState({'listExample': {'items': listExample.items.concat([{'title': 'appended item'}])}}),list1.refresh"> Append items</button> | ||
</h3> | ||
<amp-list id="list1" width="auto" height="100" [height]="20 * listExample.items.length" | ||
layout="fixed-height" src="amp-state:listExample"> | ||
<template type="amp-mustache" id="amp-template-id"> | ||
<div><a href="{{url}}">{{title}}</a></div> | ||
</template> | ||
</amp-list> | ||
|
||
<h3>Static amp-list, async state</h3> | ||
<amp-list id="list2" width="auto" height="100" layout="fixed-height" src="amp-state:listAsyncExample" reset-on-refresh> | ||
<template type="amp-mustache" id="amp-template-id"> | ||
<div><a href="{{url}}">{{title}}</a></div> | ||
</template> | ||
</amp-list> | ||
|
||
<h3>Paging amp-list</h3> | ||
<amp-list id="list3" width="auto" height="200" layout="fixed-height" src="amp-state:listAsyncExample" template="amp-template-id" class="m1" load-more="auto" load-more-bookmark="next"> | ||
<div overflow role="button" aria-label="Show more"> | ||
Show more | ||
</div> | ||
</amp-list> | ||
|
||
<amp-state id="listAsyncExample" src="./list.example.json"></amp-state> | ||
<amp-state id="listExample"> | ||
<script type="application/json"> | ||
{ | ||
"items": [ | ||
{ "title": "amp-carousel" }, | ||
{ "title": "amp-img" }, | ||
{ "title": "amp-ad" }, | ||
{ "title": "amp-accordion" } | ||
], | ||
"next": "./list.example.json" | ||
} | ||
</script> | ||
</amp-state> | ||
|
||
</body> | ||
</html> |
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -98,6 +98,7 @@ tags: { # <amp-list> with mandatory src and/or [src] attr | |
mandatory_anyof: "['src','[src]','data-amp-bind-src']" | ||
value_url: { | ||
protocol: "https" | ||
protocol: "amp-state" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
allow_relative: true # Will be set to false at a future date. | ||
} | ||
blacklisted_value_regex: "__amp_source_origin" | ||
|
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.
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.
You can consider adding this to
examples/bind/list.amp.html
. Also feel free to reorganize these example files if you'd like. They're pretty messy.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.
It feels as though it equally belongs with
amp-list
andamp-bind
, but potentially more so withamp-list
. Mind if I move all of the amp-list examples toexamples/amp-list/*.html
after this PR goes through?