-
Notifications
You must be signed in to change notification settings - Fork 4.1k
🖍 [Story performance] Added CSS rules for units, and exaple stories #36007
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
Closed
+129
−14
Closed
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
51e1ed9
Added CSS rules for units
mszylkowski 00e2b1c
Removed 50vw
mszylkowski 17f6cf7
Merge branch 'main' of github.com:ampproject/amphtml into css_units_m…
mszylkowski 9942c91
Added font and example files
mszylkowski 6bd9a22
Removed noamp example
mszylkowski 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
Added font and example files
- Loading branch information
commit 9942c919d3987946c39be681727d59b5e76ff653
There are no files selected for viewing
This file contains hidden or 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,120 @@ | ||
| <!-- Imports the story prestyle CSS so it can be laid out before the JS loads --> | ||
| <!doctype html> | ||
| <html ⚡ lang="en"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <link rel="canonical" href="lcp.html"> | ||
| <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> | ||
| <title>Boilerplate test</title> | ||
| <!-- <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> --> | ||
| <!-- Fonts --> | ||
| <link rel="preconnect" href="https://fonts.googleapis.com"> | ||
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
| <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap" rel="stylesheet"> | ||
| <link rel="stylesheet" href="/dist/v0/amp-story-1.0.css"> | ||
|
|
||
| <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-story-page { | ||
| font-family: 'Poppins', sans-serif; | ||
| color: black; | ||
| background-color: white; | ||
| } | ||
| h1 { | ||
| color: black; | ||
| font-size: 2em; | ||
| } | ||
| h1.preset { | ||
| font-size: 0.5em; | ||
| } | ||
| [preset="2021-foreground"] { | ||
| align-content: end; | ||
| padding: .5em; | ||
| } | ||
| p { | ||
| font-size: 1em; | ||
| } | ||
| [preset="2021-foreground"] p { | ||
| font-size: 0.25em; | ||
| } | ||
| html { | ||
| background: red; | ||
| } | ||
| body { | ||
| background: blue; | ||
| } | ||
| </style> | ||
| <style> | ||
| /* Temporary styles to show story from start. */ | ||
| html.i-amphtml-singledoc.i-amphtml-standalone body, body, | ||
| html.i-amphtml-singledoc.i-amphtml-standalone, html { | ||
| animation:none !important; | ||
| height: 100% !important; | ||
| width: 100% !important; | ||
| margin: 0; | ||
| overflow: hidden; | ||
| } | ||
| .i-amphtml-notbuilt { | ||
| color: initial !important; | ||
| } | ||
| .i-amphtml-notbuilt > * { | ||
| display: initial; | ||
| } | ||
| amp-story-page:first-of-type, | ||
| amp-story-page:first-of-type amp-story-grid-layer:not(.i-amphtml-layout) { | ||
| height: 100%; | ||
| width: 100%; | ||
| margin: 0; | ||
| animation: none; | ||
| } | ||
| amp-story-page { | ||
| top: 9000vh; | ||
| } | ||
| amp-story[standalone], amp-story:not(.i-amphtml-story-loaded) amp-story-page:first-of-type, | ||
| amp-story:not(.i-amphtml-story-loaded) amp-story-page:first-of-type amp-story-grid-layer { | ||
| position: absolute !important; | ||
| top: 0; | ||
| left: 0; | ||
| height: 100%; | ||
| width: 100%; | ||
| margin: 0; | ||
| animation: none; | ||
| } | ||
| amp-story[standalone] { | ||
| background-color: black !important; | ||
| } | ||
| amp-story:not(.i-amphtml-story-loaded) amp-story-page:not([active]) { | ||
| transform: none !important; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <amp-story standalone id="cats" | ||
| title="LCP test" publisher="The AMP team" | ||
| publisher-logo-src="./img/amplogo.png" | ||
| poster-portrait-src="./img/overview.jpg"> | ||
|
|
||
| <amp-story-page id="cover"> | ||
| <amp-story-grid-layer template="fill"> | ||
| <amp-img | ||
| id="img1" | ||
| width="400" | ||
| height="750" | ||
| src="https://images.unsplash.com/photo-1558591710-4b4a1ae0f04d?fit=crop&w=720&h=1280&q=30&fm=webp" | ||
| layout="fill"> | ||
| </amp-img> | ||
| </amp-story-grid-layer> | ||
| <amp-story-grid-layer template="vertical"> | ||
| <h1 class="hello-world">Story Prestyle + JS</h1> | ||
| <p>This is how a story looks with the prestyle+JS<br></p> | ||
| <p style="color: dimgray">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> | ||
| </amp-story-grid-layer> | ||
| <amp-story-grid-layer template="vertical" preset="2021-foreground"> | ||
| <p style="color: dimgray">This text is positioned with an aspect-ratio layer</p> | ||
| </amp-story-grid-layer> | ||
| </amp-story-page> | ||
| </amp-story> | ||
| </body> | ||
| </html> |
This file contains hidden or 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,120 @@ | ||
| <!-- Imports the story prestyle CSS so it can be laid out before the JS loads --> | ||
| <!doctype html> | ||
| <html ⚡ lang="en"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <link rel="canonical" href="lcp.html"> | ||
| <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> | ||
| <title>Boilerplate test</title> | ||
| <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> | ||
| <!-- Fonts --> | ||
| <link rel="preconnect" href="https://fonts.googleapis.com"> | ||
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
| <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap" rel="stylesheet"> | ||
| <link rel="stylesheet" href="https://cdn.ampproject.org/v0/amp-story-1.0.css"> | ||
|
|
||
| <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-story-page { | ||
| font-family: 'Poppins', sans-serif; | ||
| color: black; | ||
| background-color: white; | ||
| } | ||
| h1 { | ||
| color: black; | ||
| font-size: 2em; | ||
| } | ||
| h1.preset { | ||
| font-size: 0.5em; | ||
| } | ||
| [preset="2021-foreground"] { | ||
| align-content: end; | ||
| padding: .5em; | ||
| } | ||
| p { | ||
| font-size: 1em; | ||
| } | ||
| [preset="2021-foreground"] p { | ||
| font-size: 0.25em; | ||
| } | ||
| html { | ||
| background: red; | ||
| } | ||
| body { | ||
| background: blue; | ||
| } | ||
| </style> | ||
| <style> | ||
| /* Temporary styles to show story from start. */ | ||
| html.i-amphtml-singledoc.i-amphtml-standalone body, body, | ||
| html.i-amphtml-singledoc.i-amphtml-standalone, html { | ||
| animation:none !important; | ||
| height: 100% !important; | ||
| width: 100% !important; | ||
| margin: 0; | ||
| overflow: hidden; | ||
| } | ||
| .i-amphtml-notbuilt { | ||
| color: initial !important; | ||
| } | ||
| .i-amphtml-notbuilt > * { | ||
| display: initial; | ||
| } | ||
| amp-story-page:first-of-type, | ||
| amp-story-page:first-of-type amp-story-grid-layer:not(.i-amphtml-layout) { | ||
| height: 100%; | ||
| width: 100%; | ||
| margin: 0; | ||
| animation: none; | ||
| } | ||
| amp-story-page { | ||
| top: 9000vh; | ||
| } | ||
| amp-story[standalone], amp-story:not(.i-amphtml-story-loaded) amp-story-page:first-of-type, | ||
| amp-story:not(.i-amphtml-story-loaded) amp-story-page:first-of-type amp-story-grid-layer { | ||
| position: absolute !important; | ||
| top: 0; | ||
| left: 0; | ||
| height: 100%; | ||
| width: 100%; | ||
| margin: 0; | ||
| animation: none; | ||
| } | ||
| amp-story[standalone] { | ||
| background-color: black !important; | ||
| } | ||
| amp-story:not(.i-amphtml-story-loaded) amp-story-page:not([active]) { | ||
| transform: none !important; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <amp-story standalone id="cats" | ||
| title="LCP test" publisher="The AMP team" | ||
| publisher-logo-src="./img/amplogo.png" | ||
| poster-portrait-src="./img/overview.jpg"> | ||
|
|
||
| <amp-story-page id="cover"> | ||
| <amp-story-grid-layer template="fill"> | ||
| <amp-img | ||
| id="img1" | ||
| width="400" | ||
| height="750" | ||
| src="https://images.unsplash.com/photo-1558591710-4b4a1ae0f04d?fit=crop&w=720&h=1280&q=30&fm=webp" | ||
| layout="fill"> | ||
| </amp-img> | ||
| </amp-story-grid-layer> | ||
| <amp-story-grid-layer template="vertical"> | ||
| <h1 class="hello-world">Story Prestyle + JS</h1> | ||
| <p>This is how a story looks with the prestyle+JS<br></p> | ||
| <p style="color: dimgray">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> | ||
| </amp-story-grid-layer> | ||
| <amp-story-grid-layer template="vertical" preset="2021-foreground"> | ||
| <p style="color: dimgray">This text is positioned with an aspect-ratio layer</p> | ||
| </amp-story-grid-layer> | ||
| </amp-story-page> | ||
| </amp-story> | ||
| </body> | ||
| </html> |
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.