-
Notifications
You must be signed in to change notification settings - Fork 230
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
[POC] [WIP] AMP validation fixes #878
Closed
Closed
Changes from 10 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f7abd2c
adds AmpImage specialisation for Image component
ChrisBAshton 7416522
filters the isAmp boolean down to the Image
ChrisBAshton 8be9deb
successfully render amp-html markup for img
ChrisBAshton 8c92df2
dynamic ratio for amp-img
ChrisBAshton fa62cc2
pass ratio to the amp-img storybook version
ChrisBAshton 6ece41a
pass ratio to the amp-img snapshot version
ChrisBAshton d1864c5
fixes linting and updates snapshots
ChrisBAshton 9c237c3
merge with latest
ChrisBAshton ae9bc14
adds article snapshot
ChrisBAshton 5a6f5b4
merged with latest
ChrisBAshton 8f36e52
manage AMP/platform detection with a PlatformContext
ChrisBAshton 9b244f3
adds test and fixes failing tests
ChrisBAshton 4e51a7a
avoid inline JavaScript for AMP
ChrisBAshton 1571299
fix amp boilerplate css validation errors
ChrisBAshton 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
10 changes: 10 additions & 0 deletions
10
src/app/components/Figure/Image/__snapshots__/index.test.jsx.snap
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,14 @@ | ||
import React from 'react'; | ||
import { string, number } from 'prop-types'; | ||
|
||
const AmpImage = ({ alt, src, ratio }) => ( | ||
<amp-img alt={alt} src={src} height={ratio} width="100" layout="responsive"></amp-img> // eslint-disable-line react/self-closing-comp, prettier/prettier | ||
); | ||
|
||
AmpImage.propTypes = { | ||
alt: string.isRequired, | ||
src: string.isRequired, | ||
ratio: number.isRequired, | ||
}; | ||
|
||
export default AmpImage; |
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,15 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; // eslint-disable-line import/no-extraneous-dependencies | ||
import Image from './index'; | ||
import AmpImage from './amp/index'; | ||
|
||
const imageAlt = | ||
'Map of the UK displaying Syrian refugees and asylum seekers per 10000 population. Ranges from 0 to 17.'; | ||
const imageSrc = | ||
'https://ichef.bbci.co.uk/news/640/cpsprodpb/439A/production/_100960371_syrians_and_asylum_v2-nc.png'; | ||
|
||
storiesOf('Image', module) | ||
.add('default', () => <Image alt={imageAlt} src={imageSrc} />) | ||
.add('default - AMP version', () => ( | ||
<AmpImage alt={imageAlt} src={imageSrc} ratio="56.25" /> | ||
)); |
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
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
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.
Similar blocks of code found in 2 locations. Consider refactoring.