diff --git a/examples/amp-story/grid-layer-presets.html b/examples/amp-story/grid-layer-presets.html index 8c5057a09860..3a3dac02d086 100644 --- a/examples/amp-story/grid-layer-presets.html +++ b/examples/amp-story/grid-layer-presets.html @@ -15,6 +15,9 @@ body { font-family: 'Poppins', sans-serif; } + amp-story-page { + background: black; + } .lower-title { color: white; padding: 0; @@ -32,6 +35,10 @@ .bordered { border: 2px solid #ffffff6f; } + .small span { + font-size: 0.3em; + color: white; + } .lower-title span { font-size: 0.2em; color: white; @@ -105,6 +112,42 @@

full-page

+ + + + + + + + Right + + + Left + + + Top + + + Bottom + + + Center + (test with #development=1!) + + + Top Right + + + Top Left + + + Bottom Right + + + Bottom Left + + diff --git a/examples/visual-tests/amp-story/amp-story-grid-layer-presets.html b/examples/visual-tests/amp-story/amp-story-grid-layer-presets.html new file mode 100644 index 000000000000..e81cc4f2dde3 --- /dev/null +++ b/examples/visual-tests/amp-story/amp-story-grid-layer-presets.html @@ -0,0 +1,74 @@ + + + + + + + amp-story-grid-layer[template="thirds"] visual diff + + + + + + + + + + + + + + + Right + + + Left + + + Top + + + Bottom + + + Center + + + Top Right + + + Top Left + + + Bottom Right + + + Bottom Left + + + + + + diff --git a/extensions/amp-story/1.0/amp-story.css b/extensions/amp-story/1.0/amp-story.css index 5fb10d57ce3e..e99208425a77 100644 --- a/extensions/amp-story/1.0/amp-story.css +++ b/extensions/amp-story/1.0/amp-story.css @@ -366,6 +366,23 @@ amp-story-grid-layer { pointer-events: none !important; } +amp-story-grid-layer[anchor*="left"] { + margin-left: 0 !important; +} + +amp-story-grid-layer[anchor*="top"] { + margin-top: 0 !important; +} + +amp-story-grid-layer[anchor*="bottom"] { + margin-bottom: 0 !important; +} + +amp-story-grid-layer[anchor*="right"] { + margin-right: 0 !important; + margin-left: auto !important; +} + /** * Click shield to make sure click events are never swallowed by videos on * Safari iOS 11.2, which would prevent the user from navigating through the diff --git a/test/visual-diff/visual-tests b/test/visual-diff/visual-tests index 5393ed3dd393..6123f26f0819 100644 --- a/test/visual-diff/visual-tests +++ b/test/visual-diff/visual-tests @@ -297,6 +297,24 @@ ".i-amphtml-story-grid-template-thirds" ] }, + { + "url": "examples/visual-tests/amp-story/amp-story-grid-layer-presets.html", + "name": "amp-story: Grid layer anchoring with preset (vertically)", + "viewport": {"width": 250, "height": 500}, + "loading_complete_selectors": [ + ".i-amphtml-story-loaded", + ".i-amphtml-story-grid-template-aspect" + ] + }, + { + "url": "examples/visual-tests/amp-story/amp-story-grid-layer-presets.html", + "name": "amp-story: Grid layer anchoring with preset (horizontally)", + "viewport": {"width": 400, "height": 500}, + "loading_complete_selectors": [ + ".i-amphtml-story-loaded", + ".i-amphtml-story-grid-template-aspect" + ] + }, { "url": "examples/visual-tests/amp-story/amp-story-cta-layer.html", "name": "amp-story: CTA layer",