diff --git a/dev-kits/addon-preview-wrapper/README.md b/dev-kits/addon-preview-wrapper/README.md new file mode 100644 index 00000000000..212ad2a49ca --- /dev/null +++ b/dev-kits/addon-preview-wrapper/README.md @@ -0,0 +1,8 @@ +# example addon: preview wrapper + +This addon adds a wrapper around the preview iframe + +This can be useful to display some information around the story preview + +Uses include: +- showing a edit this page link to the story diff --git a/dev-kits/addon-preview-wrapper/package.json b/dev-kits/addon-preview-wrapper/package.json new file mode 100644 index 00000000000..9176713035e --- /dev/null +++ b/dev-kits/addon-preview-wrapper/package.json @@ -0,0 +1,33 @@ +{ + "name": "@storybook/addon-preview-wrapper", + "version": "5.3.0-alpha.41", + "description": "preview wrapper addon for storybook", + "keywords": [ + "addon", + "devkit", + "storybook", + "types" + ], + "homepage": "https://github.com/storybookjs/storybook#readme", + "bugs": { + "url": "https://github.com/storybookjs/storybook/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/storybookjs/storybook.git", + "directory": "dev-kit/addon-preview-wrappe" + }, + "license": "MIT", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "prepare": "node ../../scripts/prepare.js" + }, + "dependencies": { + "@storybook/addons": "5.3.0-alpha.41", + "react": "^16.8.3" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/dev-kits/addon-preview-wrapper/register.js b/dev-kits/addon-preview-wrapper/register.js new file mode 100644 index 00000000000..cc38cb06f1f --- /dev/null +++ b/dev-kits/addon-preview-wrapper/register.js @@ -0,0 +1 @@ +require('./dist/register'); diff --git a/dev-kits/addon-preview-wrapper/src/constants.ts b/dev-kits/addon-preview-wrapper/src/constants.ts new file mode 100755 index 00000000000..6120231ce3e --- /dev/null +++ b/dev-kits/addon-preview-wrapper/src/constants.ts @@ -0,0 +1 @@ +export const ADDON_ID = 'storybook/preview-wrapper'; diff --git a/dev-kits/addon-preview-wrapper/src/register.tsx b/dev-kits/addon-preview-wrapper/src/register.tsx new file mode 100644 index 00000000000..6fe81015ff1 --- /dev/null +++ b/dev-kits/addon-preview-wrapper/src/register.tsx @@ -0,0 +1,20 @@ +import React, { FunctionComponent } from 'react'; +import { addons, types } from '@storybook/addons'; +import { ADDON_ID } from './constants'; + +const PreviewWrapper: FunctionComponent<{}> = p => ( +