Skip to content
Merged
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
eccc65a
added shopping tag flip on specific position
jshamble Dec 13, 2021
9e8731a
removed a few console logs, added better code flow with less varaible…
jshamble Dec 13, 2021
5a17827
added calls to measure and mutate elemetn
jshamble Dec 14, 2021
dfac763
resolved merge conflict
jshamble Jan 7, 2022
2e2c0b7
added rtl fix
jshamble Jan 7, 2022
ae7caf2
fixed a few typos
jshamble Jan 7, 2022
0655d49
Merge branch 'main' into shoptagposition
jshamble Jan 12, 2022
0426ef9
added tag flip working for non rtl order
jshamble Jan 13, 2022
e2da174
rmeoved gitignore file
jshamble Jan 14, 2022
c622b38
added tag flip and onresize callback for tag flip, added helper funct…
jshamble Jan 14, 2022
128c4d0
added tag flip fix
jshamble Jan 14, 2022
f426d8c
using page size to determine, might need to fix page size bug to not …
jshamble Jan 18, 2022
ee3c407
Merge branch 'main' into shoptagposition
jshamble Jan 18, 2022
b32d1f0
added refactor of measure element
jshamble Jan 19, 2022
ba110ee
added getlyaoutbox
jshamble Jan 19, 2022
828b623
added get layout box calculation adn page size
jshamble Jan 19, 2022
3bb9156
fixed merge conflicts
jshamble Jan 20, 2022
86aeb86
Merge branch 'main' into shoptagposition
jshamble Jan 21, 2022
bc89057
added correct measurements for transforms, added correct placement fo…
jshamble Jan 24, 2022
ed6af3c
removed space
jshamble Jan 24, 2022
6f48eab
added main files
jshamble Jan 25, 2022
2d9a3d1
removed trailing whitespace
jshamble Jan 25, 2022
4d67d41
added proper rtl test
jshamble Jan 27, 2022
de65f8b
fixed allto initialize and rtl visual diff test
jshamble Jan 27, 2022
45da724
fixed store service page size dimensions for unit test
jshamble Jan 27, 2022
5762255
fixed mutatelement for shopping tag flip
jshamble Jan 27, 2022
7354224
migrated resize code to another PR
jshamble Jan 29, 2022
878bf67
resolved mrege conflicts
jshamble Jan 29, 2022
b3b6570
Merge branch 'main' into shoptagposition
jshamble Jan 31, 2022
85acd92
fixed settings
jshamble Jan 31, 2022
a604cfa
added space
jshamble Jan 31, 2022
d9d801a
removed space
jshamble Jan 31, 2022
b8158e1
fixed merge conflict
jshamble Feb 1, 2022
46ab9b8
added shopping tag position
jshamble Feb 1, 2022
20e168a
added iamphtml to classes
jshamble Feb 1, 2022
b45a992
added fix for double measure ele,metn callback
jshamble Feb 1, 2022
3a6e823
Merge branch 'main' into shoptagposition
jshamble Feb 1, 2022
1f8711c
Merge branch 'main' into shoptagposition
jshamble Feb 1, 2022
a2c35d7
added page 1 visual diff test
jshamble Feb 2, 2022
3877e03
added rtl to visual test file
jshamble Feb 2, 2022
3193a15
added RTL direction
jshamble Feb 2, 2022
609cec8
removed non rtl exampel form story
jshamble Feb 2, 2022
6c4997c
removed trl exmaples
jshamble Feb 2, 2022
9ad13f5
removed trl exmaples
jshamble Feb 2, 2022
599cc42
removed non rtl exampel from story
jshamble Feb 2, 2022
02dd8da
removed non rtl exampel from story
jshamble Feb 2, 2022
69b204b
added back in interactive tests
jshamble Feb 2, 2022
98a2809
added back in interactive tests
jshamble Feb 2, 2022
fd3cc81
added back in interactive tests
jshamble Feb 2, 2022
fced266
added back in interactive tests
jshamble Feb 2, 2022
b2e6548
added back in interactive tests
jshamble Feb 2, 2022
6a58fcd
resolved merge conflict
jshamble Feb 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 4 additions & 66 deletions examples/amp-story/amp-story-shopping.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,19 @@
<script async custom-element="amp-story-page-attachment" src="https://cdn.ampproject.org/v0/amp-story-page-attachment-0.1.js"></script>
<script async custom-element="amp-story-shopping" src="https://cdn.ampproject.org/v0/amp-story-shopping-0.1.js"></script>
<style amp-custom>
[data-product-id="lamp"],
[data-product-id="lamp-rtl"] {
[data-product-id="lamp"] {
top: 31%;
left: 1%;
}
[data-product-id="art"],
[data-product-id="art-rtl"] {
[data-product-id="art"] {
top: 15%;
left: 40%;
}
[data-product-id="chair"],
[data-product-id="chair-rtl"] {
[data-product-id="chair"] {
top: 53%;
left: 30%;
}
[data-product-id="flowers"],
[data-product-id="flowers-rtl"] {
[data-product-id="flowers"] {
top: 46%;
left: 83%;
}
Expand Down Expand Up @@ -145,64 +141,6 @@
</amp-story-grid-layer>
<amp-story-shopping-attachment theme="dark"></amp-story-shopping-attachment>
</amp-story-page>
<amp-story-page id="inline-light-theme-two" dir="rtl">
<!--
RTL example
-->
<amp-story-shopping-config layout="nodisplay">
<script type="application/json">
{
"items" : [
{
"productId": "lamp-rtl",
"productTitle": "Brass Lamp",
"productBrand": "Lamp Co",
"productPrice": 799.00,
"productPriceCurrency": "AED",
"productTagText": " حبا حبا حبا سعادةا سعادة",
"productImages": ["https://source.unsplash.com/Ry9WBo3qmoc/500x500"]
},
{
"productId": "art-rtl",
"productTitle": "Abstract Art",
"productBrand": "V. Artsy",
"productPriceCurrency": "AED",
"productPrice": 1200.00,
"productTagText": "حبا حب سعادة قط حبا حب سعادة قط ",
"productImages": ["https://source.unsplash.com/BdVQU-NDtA8/500x500"]
},
{
"productId": "chair-rtl",
"productTitle": "Yellow chair",
"productBrand": "Chair Co.",
"productPrice": 1000.00,
"productPriceCurrency": "AED",
"productImages": ["https://source.unsplash.com/DgQGKKLaVhY/500x500"]
},
{
"productId": "flowers-rtl",
"productTitle": "Flowers",
"productBrand": "Very Long Flower Company Name",
"productPrice": 10.00,
"productPriceCurrency": "AED",
"productIcon": "/examples/visual-tests/amp-story/img/shopping/icon.png",
"productImages": ["https://source.unsplash.com/SavQfLRm4Do/500x500"]
}
]
}
</script>
</amp-story-shopping-config>
<amp-story-grid-layer template="fill">
<amp-img layout="fill" src="https://source.unsplash.com/_HqHX3LBN18/1000x2000"></amp-img>
</amp-story-grid-layer>
<amp-story-grid-layer template="vertical">
<amp-story-shopping-tag data-product-id="lamp-rtl" ></amp-story-shopping-tag>
<amp-story-shopping-tag data-product-id="art-rtl" ></amp-story-shopping-tag>
<amp-story-shopping-tag data-product-id="chair-rtl" ></amp-story-shopping-tag>
<amp-story-shopping-tag data-product-id="flowers-rtl" ></amp-story-shopping-tag>
</amp-story-grid-layer>
<amp-story-shopping-attachment></amp-story-shopping-attachment>
</amp-story-page>
<amp-story-page id="inline-no-product">
<!--
Example of:
Expand Down
71 changes: 4 additions & 67 deletions examples/visual-tests/amp-story/amp-story-shopping-lang-de.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,19 @@
<script async custom-element="amp-story" src="https://cdn.ampproject.org/v0/amp-story-1.0.js"></script>
<script async custom-element="amp-story-shopping" src="https://cdn.ampproject.org/v0/amp-story-shopping-0.1.js"></script>
<style amp-custom>
[data-product-id="lamp"],
[data-product-id="lamp-rtl"] {
[data-product-id="lamp"] {
top: 31%;
left: 1%;
}
[data-product-id="art"],
[data-product-id="art-rtl"] {
[data-product-id="art"] {
top: 15%;
left: 40%;
}
[data-product-id="chair"],
[data-product-id="chair-rtl"] {
[data-product-id="chair"] {
top: 53%;
left: 30%;
}
[data-product-id="flowers"],
[data-product-id="flowers-rtl"] {
[data-product-id="flowers"] {
top: 46%;
left: 83%;
}
Expand Down Expand Up @@ -146,65 +142,6 @@
</amp-story-grid-layer>
<amp-story-shopping-attachment theme="dark"></amp-story-shopping-attachment>
</amp-story-page>
<amp-story-page id="inline-light-theme-two" dir="rtl">
<!--
RTL example
-->
<amp-story-shopping-config layout="nodisplay">
<script type="application/json">
{
"items" : [
{
"productId": "lamp-rtl",
"productTitle": "Brass Lamp",
"productBrand": "Lamp Co",
"productPrice": 799.00,
"productPriceCurrency": "AED",
"productTagText": " حبا حبا حبا سعادةا سعادة",
"productImages": ["https://source.unsplash.com/Ry9WBo3qmoc/500x500"]
},
{
"productId": "art-rtl",
"productTitle": "Abstract Art",
"productBrand": "V. Artsy",
"productPriceCurrency": "AED",
"productPrice": 1200.00,
"productTagText": "حبا حب سعادة قط حبا حب سعادة قط ",
"productImages": ["https://source.unsplash.com/BdVQU-NDtA8/500x500"]
},
{
"productId": "chair-rtl",
"productTitle": "Yellow chair",
"productBrand": "Chair Co.",
"productPrice": 1000.00,
"productPriceCurrency": "AED",
"productIcon": "/examples/visual-tests/amp-story/img/shopping/nest-home-icon.png",
"productImages": ["https://source.unsplash.com/DgQGKKLaVhY/500x500"]
},
{
"productId": "flowers-rtl",
"productTitle": "Flowers",
"productBrand": "Very Long Flower Company Name",
"productPrice": 10.00,
"productPriceCurrency": "AED",
"productIcon": "/examples/visual-tests/amp-story/img/shopping/icon.png",
"productImages": ["https://source.unsplash.com/SavQfLRm4Do/500x500"]
}
]
}
</script>
</amp-story-shopping-config>
<amp-story-grid-layer template="fill">
<amp-img layout="fill" src="https://source.unsplash.com/_HqHX3LBN18/1000x2000"></amp-img>
</amp-story-grid-layer>
<amp-story-grid-layer template="vertical">
<amp-story-shopping-tag data-product-id="lamp-rtl" ></amp-story-shopping-tag>
<amp-story-shopping-tag data-product-id="art-rtl" ></amp-story-shopping-tag>
<amp-story-shopping-tag data-product-id="chair-rtl" ></amp-story-shopping-tag>
<amp-story-shopping-tag data-product-id="flowers-rtl" ></amp-story-shopping-tag>
</amp-story-grid-layer>
<amp-story-shopping-attachment></amp-story-shopping-attachment>
</amp-story-page>
<amp-story-page id="inline-no-product">
<!--
Example of:
Expand Down
163 changes: 163 additions & 0 deletions examples/visual-tests/amp-story/amp-story-shopping-rtl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
<!doctype html>
Comment thread
jshamble marked this conversation as resolved.
<html amp lang="en" dir="rtl">
<head>
<meta charset="utf-8">
<title>Shopping</title>
<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>
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-story" src="https://cdn.ampproject.org/v0/amp-story-1.0.js"></script>
<script async custom-element="amp-story-shopping" src="https://cdn.ampproject.org/v0/amp-story-shopping-0.1.js"></script>
<style amp-custom>
[data-product-id="lamp"] {
top: 31%;
left: 1%;
}
[data-product-id="art"] {
top: 15%;
left: 40%;
}
[data-product-id="chair"] {
top: 53%;
left: 30%;
}
[data-product-id="flowers"] {
top: 46%;
left: 83%;
}
</style>
</head>
<body>
<amp-story
standalone
title="Story Shopping Component"
publisher="AMP Story Shopping"
publisher-logo-src="example.com/logo.png"
poster-portrait-src="example.com/poster.jpg">
<amp-story-page id="inline-light-theme">
<!--
Example of Inline config. Multiple product tags with icon defined.
-->
<amp-story-shopping-config layout="nodisplay">
<script type="application/json">
{
"items" : [
{
"productId": "lamp",
"productTitle": "Brass Lamp",
"productBrand": "Lamp Co",
"productPrice": 799.00,
"productPriceCurrency": "USD",
"productImages": ["https://source.unsplash.com/Ry9WBo3qmoc/500x500"]
},
{
"productId": "art",
"productTitle": "Abstract Art",
"productBrand": "V. Artsy",
"productPrice": 1200.00,
"productPriceCurrency": "INR",
"productImages": ["https://source.unsplash.com/BdVQU-NDtA8/500x500"]
},
{
"productId": "chair",
"productTitle": "Yellow chair",
"productBrand": "Chair Co.",
"productPrice": 1000.00,
"productPriceCurrency": "BRL",
"productTagText": "The perfectly imperfect yellow chair",
"productImages": ["https://source.unsplash.com/DgQGKKLaVhY/500x500"]
},
{
"productId": "flowers",
"productTitle": "Flowers",
"productBrand": "Very Long Flower Company Name",
"productPrice": 10.00,
"productPriceCurrency": "USD",
"productIcon": "/examples/visual-tests/amp-story/img/shopping/icon.png",
"productImages": ["https://source.unsplash.com/SavQfLRm4Do/500x500"]
}
]
}
</script>
</amp-story-shopping-config>
<amp-story-grid-layer template="fill">
<amp-img layout="fill" src="https://source.unsplash.com/_HqHX3LBN18/1000x2000"></amp-img>
</amp-story-grid-layer>
<amp-story-grid-layer template="vertical">
<amp-story-shopping-tag data-product-id="lamp" ></amp-story-shopping-tag>
<amp-story-shopping-tag data-product-id="art" ></amp-story-shopping-tag>
<amp-story-shopping-tag data-product-id="chair" ></amp-story-shopping-tag>
<amp-story-shopping-tag data-product-id="flowers" ></amp-story-shopping-tag>
</amp-story-grid-layer>
<amp-story-shopping-attachment></amp-story-shopping-attachment>
</amp-story-page>
<amp-story-page id="remote-dark-theme">
<!--
Example of Remote JSON with inline fallback. Single product tag without icon.
-->
<amp-story-shopping-config layout="nodisplay" src="/examples/amp-story/shopping/remote.json" >
<script type="application/json">
{
"items" : [
{
"productId": "art",
"productTitle": "Abstract Art",
"productBrand": "V. Artsy",
"productPrice": 1200.00,
"productPriceCurrency": "JPY",
"productImages": ["https://source.unsplash.com/BdVQU-NDtA8/500x500"]
},
]
}
</script>
</amp-story-shopping-config>
<amp-story-grid-layer template="fill">

<amp-img layout="fill" src="https://source.unsplash.com/_HqHX3LBN18/1000x2000"></amp-img>
</amp-story-grid-layer>
<amp-story-grid-layer template="vertical">
<amp-story-shopping-tag data-product-id="art" ></amp-story-shopping-tag>
</amp-story-grid-layer>
<amp-story-shopping-attachment theme="dark"></amp-story-shopping-attachment>
</amp-story-page>
<amp-story-page id="remote-with-product">
<!--
Example of:
CTA Button rendering due to remote product tag existing, but no inline.
-->
<amp-story-shopping-config layout="nodisplay" src="/examples/amp-story/shopping/remote.json" >
<script type="application/json">
{
"items" : []
}
</script>
</amp-story-shopping-config>
<amp-story-grid-layer template="fill">
<amp-img layout="fill" src="https://source.unsplash.com/_HqHX3LBN18/1000x2000"></amp-img>
</amp-story-grid-layer>
<amp-story-grid-layer template="vertical">
<amp-story-shopping-tag data-product-id="art" ></amp-story-shopping-tag>
</amp-story-grid-layer>
<amp-story-shopping-attachment theme="dark"></amp-story-shopping-attachment>
</amp-story-page>
<amp-story-page id="inline-no-product">
<!--
Example of:
CTA Button not rendering due to no product tags.
-->
<amp-story-shopping-config layout="nodisplay">
<script type="application/json">
{
"items" : []
}
</script>
</amp-story-shopping-config>

<amp-story-grid-layer template="fill">
<amp-img layout="fill" src="https://source.unsplash.com/_HqHX3LBN18/1000x2000"></amp-img>
</amp-story-grid-layer>
<amp-story-shopping-attachment></amp-story-shopping-attachment>
</amp-story-page>
</amp-story>
</body>
</html>
Loading