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

Commit

Permalink
Merge pull request #4608 from bbc/image-mime-type
Browse files Browse the repository at this point in the history
Add `primaryMimeType` and `fallbackMimeType` props to `psammead-image`
  • Loading branch information
amoore108 authored Dec 16, 2021
2 parents eb1864f + 24db1f9 commit 041479e
Show file tree
Hide file tree
Showing 30 changed files with 173 additions and 42 deletions.
1 change: 1 addition & 0 deletions packages/components/psammead-bulletin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- prettier-ignore -->
| Version | Description |
|---------|-------------|
| 5.0.55 | [PR#4608](https://github.com/bbc/psammead/pull/4608) Bump dependencies |
| 5.0.54 | [PR#4606](https://github.com/bbc/psammead/pull/4606) Bump dependencies |
| 5.0.53 | [PR#4600](https://github.com/bbc/psammead/pull/4600) Fix TalkBack reading nested spans incorrectly |
| 5.0.52 | [PR#4601](https://github.com/bbc/psammead/pull/4601) Bumps dependencies |
Expand Down
4 changes: 2 additions & 2 deletions packages/components/psammead-bulletin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bbc/psammead-bulletin",
"version": "5.0.54",
"version": "5.0.55",
"main": "dist/index.js",
"module": "esm/index.js",
"sideEffects": false,
Expand All @@ -22,7 +22,7 @@
"@bbc/gel-foundations": "7.0.0",
"@bbc/psammead-assets": "3.1.10",
"@bbc/psammead-live-label": "2.0.32",
"@bbc/psammead-story-promo": "8.0.35",
"@bbc/psammead-story-promo": "8.0.36",
"@bbc/psammead-styles": "8.0.1",
"@bbc/psammead-visually-hidden-text": "2.0.7"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,11 @@ exports[`Bulletin should render audio correctly 1`] = `
>
<source
srcset="https://ichef.bbci.co.uk/news/300/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 300w, https://ichef.bbci.co.uk/news/450/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 450w, https://ichef.bbci.co.uk/news/600/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 600w, https://ichef.bbci.co.uk/news/1024/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 1024w"
type="image/webp"
/>
<source
srcset="https://ichef.bbci.co.uk/news/300/cpsprodpb/11897/production/_106613817_999_al_.jpg 300w, https://ichef.bbci.co.uk/news/450/cpsprodpb/11897/production/_106613817_999_al_.jpg 450w, https://ichef.bbci.co.uk/news/600/cpsprodpb/11897/production/_106613817_999_al_.jpg 600w, https://ichef.bbci.co.uk/news/1024/cpsprodpb/11897/production/_106613817_999_al_.jpg 1024w"
type="image/jpeg"
/>
<img
alt="Iron man"
Expand Down Expand Up @@ -625,9 +627,11 @@ exports[`Bulletin should render audio correctly with lang prop passed in 1`] = `
>
<source
srcset="https://ichef.bbci.co.uk/news/300/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 300w, https://ichef.bbci.co.uk/news/450/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 450w, https://ichef.bbci.co.uk/news/600/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 600w, https://ichef.bbci.co.uk/news/1024/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 1024w"
type="image/webp"
/>
<source
srcset="https://ichef.bbci.co.uk/news/300/cpsprodpb/11897/production/_106613817_999_al_.jpg 300w, https://ichef.bbci.co.uk/news/450/cpsprodpb/11897/production/_106613817_999_al_.jpg 450w, https://ichef.bbci.co.uk/news/600/cpsprodpb/11897/production/_106613817_999_al_.jpg 600w, https://ichef.bbci.co.uk/news/1024/cpsprodpb/11897/production/_106613817_999_al_.jpg 1024w"
type="image/jpeg"
/>
<img
alt="Iron man"
Expand Down Expand Up @@ -986,9 +990,11 @@ exports[`Bulletin should render live audio correctly 1`] = `
>
<source
srcset="https://ichef.bbci.co.uk/news/300/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 300w, https://ichef.bbci.co.uk/news/450/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 450w, https://ichef.bbci.co.uk/news/600/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 600w, https://ichef.bbci.co.uk/news/1024/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 1024w"
type="image/webp"
/>
<source
srcset="https://ichef.bbci.co.uk/news/300/cpsprodpb/11897/production/_106613817_999_al_.jpg 300w, https://ichef.bbci.co.uk/news/450/cpsprodpb/11897/production/_106613817_999_al_.jpg 450w, https://ichef.bbci.co.uk/news/600/cpsprodpb/11897/production/_106613817_999_al_.jpg 600w, https://ichef.bbci.co.uk/news/1024/cpsprodpb/11897/production/_106613817_999_al_.jpg 1024w"
type="image/jpeg"
/>
<img
alt="Iron man"
Expand Down Expand Up @@ -1355,9 +1361,11 @@ exports[`Bulletin should render live video correctly 1`] = `
>
<source
srcset="https://ichef.bbci.co.uk/news/300/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 300w, https://ichef.bbci.co.uk/news/450/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 450w, https://ichef.bbci.co.uk/news/600/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 600w, https://ichef.bbci.co.uk/news/1024/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 1024w"
type="image/webp"
/>
<source
srcset="https://ichef.bbci.co.uk/news/300/cpsprodpb/11897/production/_106613817_999_al_.jpg 300w, https://ichef.bbci.co.uk/news/450/cpsprodpb/11897/production/_106613817_999_al_.jpg 450w, https://ichef.bbci.co.uk/news/600/cpsprodpb/11897/production/_106613817_999_al_.jpg 600w, https://ichef.bbci.co.uk/news/1024/cpsprodpb/11897/production/_106613817_999_al_.jpg 1024w"
type="image/jpeg"
/>
<img
alt="Iron man"
Expand Down Expand Up @@ -1709,9 +1717,11 @@ exports[`Bulletin should render radio bulletin without ariaId 1`] = `
>
<source
srcset="https://ichef.bbci.co.uk/news/300/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 300w, https://ichef.bbci.co.uk/news/450/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 450w, https://ichef.bbci.co.uk/news/600/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 600w, https://ichef.bbci.co.uk/news/1024/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 1024w"
type="image/webp"
/>
<source
srcset="https://ichef.bbci.co.uk/news/300/cpsprodpb/11897/production/_106613817_999_al_.jpg 300w, https://ichef.bbci.co.uk/news/450/cpsprodpb/11897/production/_106613817_999_al_.jpg 450w, https://ichef.bbci.co.uk/news/600/cpsprodpb/11897/production/_106613817_999_al_.jpg 600w, https://ichef.bbci.co.uk/news/1024/cpsprodpb/11897/production/_106613817_999_al_.jpg 1024w"
type="image/jpeg"
/>
<img
alt="Iron man"
Expand Down Expand Up @@ -2029,9 +2039,11 @@ exports[`Bulletin should render radio bulletin without summary correctly 1`] = `
>
<source
srcset="https://ichef.bbci.co.uk/news/300/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 300w, https://ichef.bbci.co.uk/news/450/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 450w, https://ichef.bbci.co.uk/news/600/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 600w, https://ichef.bbci.co.uk/news/1024/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 1024w"
type="image/webp"
/>
<source
srcset="https://ichef.bbci.co.uk/news/300/cpsprodpb/11897/production/_106613817_999_al_.jpg 300w, https://ichef.bbci.co.uk/news/450/cpsprodpb/11897/production/_106613817_999_al_.jpg 450w, https://ichef.bbci.co.uk/news/600/cpsprodpb/11897/production/_106613817_999_al_.jpg 600w, https://ichef.bbci.co.uk/news/1024/cpsprodpb/11897/production/_106613817_999_al_.jpg 1024w"
type="image/jpeg"
/>
<img
alt="Iron man"
Expand Down Expand Up @@ -2377,9 +2389,11 @@ exports[`Bulletin should render video correctly 1`] = `
>
<source
srcset="https://ichef.bbci.co.uk/news/300/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 300w, https://ichef.bbci.co.uk/news/450/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 450w, https://ichef.bbci.co.uk/news/600/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 600w, https://ichef.bbci.co.uk/news/1024/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 1024w"
type="image/webp"
/>
<source
srcset="https://ichef.bbci.co.uk/news/300/cpsprodpb/11897/production/_106613817_999_al_.jpg 300w, https://ichef.bbci.co.uk/news/450/cpsprodpb/11897/production/_106613817_999_al_.jpg 450w, https://ichef.bbci.co.uk/news/600/cpsprodpb/11897/production/_106613817_999_al_.jpg 600w, https://ichef.bbci.co.uk/news/1024/cpsprodpb/11897/production/_106613817_999_al_.jpg 1024w"
type="image/jpeg"
/>
<img
alt="Iron man"
Expand Down
2 changes: 2 additions & 0 deletions packages/components/psammead-bulletin/src/index.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const BulletinComponent = ({
fallbackSrcset={imageSizes
.map(size => `${imageSrc.replace('[WIDTH]', size)} ${size}w`)
.join(', ')}
primaryMimeType="image/webp"
fallbackMimeType="image/jpeg"
/>
);

Expand Down
2 changes: 2 additions & 0 deletions packages/components/psammead-bulletin/src/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const BulletinComponent = ({
fallbackSrcset={imageSizes
.map(size => `${imageSrc.replace('[WIDTH]', size)} ${size}w`)
.join(', ')}
primaryMimeType="image/webp"
fallbackMimeType="image/jpeg"
/>
);
return (
Expand Down
1 change: 1 addition & 0 deletions packages/components/psammead-grid/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- prettier-ignore -->
| Version | Description |
|---------|-------------|
| 3.1.13 | [PR#4608](https://github.com/bbc/psammead/pull/4608) Bump dependencies |
| 3.1.12 | [PR#4606](https://github.com/bbc/psammead/pull/4606) Bump dependencies |
| 3.1.11 | [PR#4574](https://github.com/bbc/psammead/pull/4574) Bumps psammead-styles |
| 3.1.10 | [PR#4568](https://github.com/bbc/psammead/pull/4568) Bump dependencies |
Expand Down
2 changes: 1 addition & 1 deletion packages/components/psammead-grid/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bbc/psammead-grid",
"version": "3.1.12",
"version": "3.1.13",
"description": "Grid component",
"main": "dist/index.js",
"module": "esm/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1858,9 +1858,11 @@ exports[`Grid component should render Grid with enableGelGutters & margins on on
>
<source
srcset="https://ichef.bbci.co.uk/news/300/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 300w, https://ichef.bbci.co.uk/news/450/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 450w, https://ichef.bbci.co.uk/news/600/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 600w, https://ichef.bbci.co.uk/news/1024/cpsprodpb/11897/production/_106613817_999_al_.jpg.webp 1024w"
type="image/webp"
/>
<source
srcset="https://ichef.bbci.co.uk/news/300/cpsprodpb/11897/production/_106613817_999_al_.jpg 300w, https://ichef.bbci.co.uk/news/450/cpsprodpb/11897/production/_106613817_999_al_.jpg 450w, https://ichef.bbci.co.uk/news/600/cpsprodpb/11897/production/_106613817_999_al_.jpg 600w, https://ichef.bbci.co.uk/news/1024/cpsprodpb/11897/production/_106613817_999_al_.jpg 1024w"
type="image/jpeg"
/>
<img
alt="Robert Downey Junior in Iron Man"
Expand Down
2 changes: 2 additions & 0 deletions packages/components/psammead-grid/src/testHelpers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export const ExampleImage = () => {
fallbackSrcset={imageSizes
.map(size => `${imageSrc.replace('[WIDTH]', size)} ${size}w`)
.join(', ')}
primaryMimeType="image/webp"
fallbackMimeType="image/jpeg"
/>
</ImageSpacing>
);
Expand Down
1 change: 1 addition & 0 deletions packages/components/psammead-image/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- prettier-ignore -->
| Version | Description |
|---------|-------------|
| 3.1.0 | [PR#4608](https://github.com/bbc/psammead/pull/4608) Derive mime type from srcset |
| 3.0.1 | [PR#4607](https://github.com/bbc/psammead/pull/4607) Fix amp-img fallback value |
| 3.0.0 | [PR#4606](https://github.com/bbc/psammead/pull/4606) Add support for WebP |
| 2.0.8 | [PR#4486](https://github.com/bbc/psammead/pull/4486) upgrade minor/patch dependencies |
Expand Down
2 changes: 2 additions & 0 deletions packages/components/psammead-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ const WrappingContainer = ({ alt, src, height, width, sizes }) => (
| `src` | string | Yes | - | "https://bbc.com/300/cat.jpg" |
| `srcset` | string | No | null | "https://bbc.com/300/cat.jpg.webp 300w, https://bbc.com/450/cat.jpg.webp 450w, https://bbc.com/600/cat.jpg.webp 600w" |
| `fallbackSrcset` | string | No | null | "https://bbc.com/300/cat.jpg 300w, https://bbc.com/450/cat.jpg 450w, https://bbc.com/600/cat.jpg 600w" |
| `primaryMimeType` | string | No | null | "image/webp" |
| `fallbackMimeType` | string | No | null | "image/jpeg" |
| `width` | number/string | No | null | 600 |
| `fade` | boolean | No | false | true |

Expand Down
2 changes: 1 addition & 1 deletion packages/components/psammead-image/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bbc/psammead-image",
"version": "3.0.1",
"version": "3.1.0",
"main": "dist/index.js",
"module": "esm/index.js",
"sideEffects": false,
Expand Down
Loading

0 comments on commit 041479e

Please sign in to comment.