Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
prototypearea committed Aug 19, 2019
0 parents commit 70d784a
Show file tree
Hide file tree
Showing 17 changed files with 4,362 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"plugins": [
"@babel/plugin-proposal-class-properties"
],
"presets": [
"@babel/preset-env",
"@babel/preset-react"
]
}
64 changes: 64 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Compiled directory
dist/

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Storybook AMP

Storybook AMP allows you to display [AMP HTML](https://amp.dev/) components generated with react for your stories in [Storybook](https://storybook.js.org).

## Installation

```sh
npm install -D storybook-amp
```

## Configuration

Then create a file called `addons.js` in your storybook config.

Add following content to it:

```js
import 'storybook-amp/register';
```

## Usage

To SSR the code at runtime time use the `withAmpReactSsrDecorator` decorator inside `config.js` or specific story. To set custom settings, use the `amp` parameter.

```js
// config.js
import { configure, addDecorator, addParameters, storiesOf } from '@storybook/react';
import { withAmpReactSsrDecorator } from 'storybook-amp';

const customStyles = ''; // some styles

// global
addDecorator(withAmpReactSsrDecorator)
addParameters({
amp: {
isEnabled: true,
styles: customStyles, // Custom styles from some string
},
});
```

You can use the `amp` parameter to override settings on each story individually:

```js
// per story
storiesOf('AMP', module)
.add('Default', () => <Button>Send</Button>, {
amp: {
isEnabled: false,
}
});
```
Loading

0 comments on commit 70d784a

Please sign in to comment.