Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Commit

Permalink
Conditional primary srcset
Browse files Browse the repository at this point in the history
  • Loading branch information
amoore108 committed Dec 16, 2021
1 parent 3340925 commit 24db1f9
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ exports[`Image - imported as '{ Img }' should render image with custom dimension
<picture
class="emotion-0 emotion-1"
>
<source />
<img
alt="By Elisa Decker, from her series \\"Sidewalk\\""
class="emotion-2 emotion-3"
Expand Down Expand Up @@ -148,7 +147,6 @@ exports[`Image - imported as '{ Img }' should render landscape image correctly 1
<picture
class="emotion-0 emotion-1"
>
<source />
<img
alt="Student sitting an exam"
class="emotion-2 emotion-3"
Expand Down Expand Up @@ -177,7 +175,6 @@ exports[`Image - imported as '{ Img }' should render portrait image correctly 1`
<picture
class="emotion-0 emotion-1"
>
<source />
<img
alt="Map of the UK displaying Syrian refugees and asylum seekers per 10000 population. Ranges from 0 to 17."
class="emotion-2 emotion-3"
Expand Down Expand Up @@ -206,7 +203,6 @@ exports[`Image - imported as '{ Img }' should render square image correctly 1`]
<picture
class="emotion-0 emotion-1"
>
<source />
<img
alt="Tracks through the snow"
class="emotion-2 emotion-3"
Expand Down Expand Up @@ -270,7 +266,6 @@ exports[`Image - imported as default 'Image' should render image with custom dim
<picture
class="emotion-0 emotion-1"
>
<source />
<img
alt="By Elisa Decker, from her series \\"Sidewalk\\""
class="emotion-2 emotion-3"
Expand Down Expand Up @@ -367,7 +362,6 @@ exports[`Image - imported as default 'Image' should render landscape image corre
<picture
class="emotion-0 emotion-1"
>
<source />
<img
alt="Student sitting an exam"
class="emotion-2 emotion-3"
Expand Down Expand Up @@ -396,7 +390,6 @@ exports[`Image - imported as default 'Image' should render portrait image correc
<picture
class="emotion-0 emotion-1"
>
<source />
<img
alt="Map of the UK displaying Syrian refugees and asylum seekers per 10000 population. Ranges from 0 to 17."
class="emotion-2 emotion-3"
Expand Down Expand Up @@ -425,7 +418,6 @@ exports[`Image - imported as default 'Image' should render square image correctl
<picture
class="emotion-0 emotion-1"
>
<source />
<img
alt="Tracks through the snow"
class="emotion-2 emotion-3"
Expand Down Expand Up @@ -489,7 +481,6 @@ exports[`Image - with Fade-in effect' should render image with custom dimensions
<picture
class="emotion-0 emotion-1"
>
<source />
<img
alt="By Elisa Decker, from her series \\"Sidewalk\\""
class="emotion-2 emotion-3"
Expand Down Expand Up @@ -586,7 +577,6 @@ exports[`Image - with Fade-in effect' should render landscape image correctly 1`
<picture
class="emotion-0 emotion-1"
>
<source />
<img
alt="Student sitting an exam"
class="emotion-2 emotion-3"
Expand Down Expand Up @@ -615,7 +605,6 @@ exports[`Image - with Fade-in effect' should render portrait image correctly 1`]
<picture
class="emotion-0 emotion-1"
>
<source />
<img
alt="Map of the UK displaying Syrian refugees and asylum seekers per 10000 population. Ranges from 0 to 17."
class="emotion-2 emotion-3"
Expand Down Expand Up @@ -644,7 +633,6 @@ exports[`Image - with Fade-in effect' should render square image correctly 1`] =
<picture
class="emotion-0 emotion-1"
>
<source />
<img
alt="Tracks through the snow"
class="emotion-2 emotion-3"
Expand Down
6 changes: 3 additions & 3 deletions packages/components/psammead-image/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const Img = props => {

return (
<StyledPicture onLoad={onLoad}>
<source srcSet={srcset} type={primaryMimeType} />
{srcset && <source srcSet={srcset} type={primaryMimeType} />}
{fallbackSrcset && (
<source srcSet={fallbackSrcset} type={fallbackMimeType} />
)}
Expand Down Expand Up @@ -74,8 +74,8 @@ Img.defaultProps = {
sizes: null,
srcset: null,
fallbackSrcset: null,
primaryMimeType: null,
fallbackMimeType: null,
primaryMimeType: 'image/jpeg',
fallbackMimeType: 'image/jpeg',
width: null,
onLoad: () => {},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ exports[`Media Player: Placeholder should render a video placeholder 1`] = `
<picture
class="emotion-17 emotion-18"
>
<source />
<img
alt=""
class="emotion-19 emotion-20"
Expand Down Expand Up @@ -363,7 +362,6 @@ exports[`Media Player: Placeholder should render a video placeholder with guidan
<picture
class="emotion-19 emotion-20"
>
<source />
<img
alt=""
class="emotion-21 emotion-22"
Expand Down Expand Up @@ -521,7 +519,6 @@ exports[`Media Player: Placeholder should render a video placeholder without dur
<picture
class="emotion-15 emotion-16"
>
<source />
<img
alt=""
class="emotion-17 emotion-18"
Expand Down Expand Up @@ -695,7 +692,6 @@ exports[`Media Player: Placeholder should render an audio placeholder 1`] = `
<picture
class="emotion-17 emotion-18"
>
<source />
<img
alt=""
class="emotion-19 emotion-20"
Expand Down Expand Up @@ -856,7 +852,6 @@ exports[`Media Player: Placeholder should render an audio placeholder without du
<picture
class="emotion-15 emotion-16"
>
<source />
<img
alt=""
class="emotion-17 emotion-18"
Expand Down Expand Up @@ -1076,7 +1071,6 @@ exports[`Media Player: Placeholder should render no-js styles when noJsClassName
<picture
class="emotion-19 emotion-20"
>
<source />
<img
alt=""
class="emotion-21 emotion-22"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ exports[`Media Player: Canonical Entry renders a landscape container with a plac
<picture
class="emotion-19 emotion-20"
>
<source />
<img
alt=""
class="emotion-21 emotion-22"
Expand Down Expand Up @@ -501,7 +500,6 @@ exports[`Media Player: Canonical Entry renders a placeholder image with guidance
<picture
class="emotion-21 emotion-22"
>
<source />
<img
alt=""
class="emotion-23 emotion-24"
Expand Down Expand Up @@ -683,7 +681,6 @@ exports[`Media Player: Canonical Entry renders a portrait container with a place
<picture
class="emotion-19 emotion-20"
>
<source />
<img
alt=""
class="emotion-21 emotion-22"
Expand Down Expand Up @@ -990,7 +987,6 @@ exports[`Media Player: Canonical Entry renders with no-js styles when noJsClassN
<picture
class="emotion-21 emotion-22"
>
<source />
<img
alt=""
class="emotion-23 emotion-24"
Expand Down

0 comments on commit 24db1f9

Please sign in to comment.