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 #241 from bbc/update-image-ampimg
Browse files Browse the repository at this point in the history
Update Image to include AmpImg & add srcset prop
  • Loading branch information
Drew McMillan authored Jan 10, 2019
2 parents 0df49aa + 15f0392 commit 12c132e
Show file tree
Hide file tree
Showing 19 changed files with 645 additions and 626 deletions.
3 changes: 1 addition & 2 deletions .storybook/addons.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'storybook-readme/register';
import '@storybook/addon-options/register';
import '@storybook/addon-knobs/register'
import '@storybook/addon-viewport/register'
import '@storybook/addon-knobs/register';
31 changes: 25 additions & 6 deletions .storybook/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ import { configure, addDecorator } from '@storybook/react';
import { setOptions } from '@storybook/addon-options';
import styledNormalize from 'styled-normalize';
import { createGlobalStyle } from 'styled-components';
import {
AMP_SCRIPT,
AMP_NO_SCRIPT,
} from '@bbc/psammead-assets/amp-boilerplate';
import Helmet from 'react-helmet';

// Option defaults:
setOptions({
name: 'BBC Psammead',
url: 'https:github.com/BBC-News/psammead',
addonPanelInRight: true,
sidebarAnimations: true,
sortStoriesByKind: true,
});

function loadStories() {
require('glob-loader!./stories.pattern');
}

const GlobalStyle = createGlobalStyle`
${styledNormalize}
Expand Down Expand Up @@ -51,4 +52,22 @@ addDecorator(story => (
</Fragment>
));

configure(loadStories, module);
export const ampDecorator = story => (
<Fragment>
<Helmet htmlAttributes={{ amp: '' }}>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,minimum-scale=1" />
<link rel="canonical" href="https://bbc.com" />
<style amp-boilerplate="">{AMP_SCRIPT}</style>
<noscript>{`<style amp-boilerplate="">${AMP_NO_SCRIPT}</style>`}</noscript>
<script async src="https://cdn.ampproject.org/v0.js" />
</Helmet>
{story()}
</Fragment>
);

function loadAllStories() {
require('glob-loader!./stories.pattern');
}

configure(loadAllStories, module);
Loading

0 comments on commit 12c132e

Please sign in to comment.