Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
arunoda committed Aug 31, 2016
0 parents commit 95a81d8
Show file tree
Hide file tree
Showing 94 changed files with 3,362 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
node_modules

# production
build

# misc
.DS_Store
npm-debug.log
storybook-static
3 changes: 3 additions & 0 deletions .storybook/addons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { register } from './notes_addon';
register();
require('@kadira/storybook/addons');
9 changes: 9 additions & 0 deletions .storybook/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { configure } from '@kadira/storybook';
import 'bootstrap/dist/css/bootstrap.css';
import '../src/index.css';

function loadStories() {
require('../src/stories');
}

configure(loadStories, module);
78 changes: 78 additions & 0 deletions .storybook/notes_addon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import React from 'react';
import addons from '@kadira/storybook-addons';

const styles = {
notesPanel: {
margin: 10,
fontFamily: '-apple-system, ".SFNSText-Regular", "San Francisco", Roboto, "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif',
fontSize: 14,
color: '#444',
width: '100%',
overflow: 'auto',
}
};

export class WithNote extends React.Component {
render() {
const { children, note } = this.props;
// This is to make sure, we'll always call this at the end of the eventloop.
// So we know that, panel will get cleared, before we render the note.
setTimeout(() => {
addons.getChannel().emit('kadira/notes/add_note', note);
}, 0);
return children;
}
}

class Notes extends React.Component {
constructor(...args) {
super(...args);
this.state = {text: ''};
this.onAddNote = this.onAddNote.bind(this);
}

onAddNote(text) {
this.setState({text});
}

componentDidMount() {
const { channel, api } = this.props;
channel.on('kadira/notes/add_note', this.onAddNote);

this.stopListeningOnStory = api.onStory(() => {
this.setState({text: ''});
});
}

componentWillUnmount() {
if(this.stopListeningOnStory) {
this.stopListeningOnStory();
}

this.unmounted = true;
const { channel, api } = this.props;
channel.removeListener('kadira/notes/add_note', this.onAddNote);
}

render() {
const { text } = this.state;
const textAfterFormatted = text? text.trim().replace(/\n/g, '<br />') : "";

return (
<div style={styles.notesPanel}>
<div dangerouslySetInnerHTML={{__html: textAfterFormatted}} />
</div>
);
}
}

export function register() {
addons.register('kadira/notes', (api) => {
addons.addPanel('kadira/notes/panel', {
title: 'Notes',
render: () => (
<Notes channel={addons.getChannel()} api={api}/>
),
})
})
}
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Website for [getstorybook.io](https://getstorybook.io)

This is the source for [getstorybook.io](https://getstorybook.io). This is [Create React App](https://github.com/facebookincubator/create-react-app) based site.

This site has also has the documentation for Storybook.

### Usage

```
npm i
npm start
```

### Edit Documentation

This website carries the documentation for Storybook.<br/>
Documentation is located at: [`src/docs`](/src/docs) directory.

It's written in Markdown and ES6. So, it supports goodies of both worlds.
20 changes: 20 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "getstorybook.io",
"scripts": {
},
"env": {
},
"formation": {
"web": {
"quantity": 1
}
},
"addons": [

],
"buildpacks": [
{
"url": "https://github.com/mars/create-react-app-buildpack.git"
}
]
}
Binary file added favicon.ico
Binary file not shown.
30 changes: 30 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-48364339-10', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<a href="https://github.com/kadirahq/react-storybook" class="github-corner" aria-label="View source on Github"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#E91E63; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` in this folder.
To create a production bundle, use `npm run build`.
-->
</body>
</html>
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "getstorybook.io",
"version": "0.0.1",
"private": true,
"devDependencies": {
"react-scripts": "0.2.1",
"@kadira/storybook": "^2.0.0"
},
"dependencies": {
"@kadira/storybook-addons": "^1.3.1",
"bootstrap": "^3.3.7",
"common-tags": "^1.3.1",
"highlight.js": "^9.6.0",
"marked": "^0.3.6",
"react": "^15.2.1",
"react-dom": "^15.2.1",
"react-helmet": "^3.1.0",
"react-highlight": "^0.8.0",
"react-router": "^2.6.1",
"react-router-scroll": "^0.3.2",
"reflexbox": "^2.1.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"eject": "react-scripts eject",
"storybook": "start-storybook -p 9009",
"build-storybook": "build-storybook"
},
"eslintConfig": {
"extends": "./node_modules/react-scripts/config/eslint.js"
}
}
56 changes: 56 additions & 0 deletions src/components/Docs/Container/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from 'react';
import Nav from '../Nav';
import NavDropdown from '../Nav/dropdown';
import Content from '../Content';
import './style.css';

class Container extends React.Component {
render() {
const { sections, selectedItem, selectedSectionId, selectedItemId } = this.props;

return (
<div id="docs-container" className="row">
<div className="nav col-sm-3 col-md-3 hidden-xs">
<Nav
sections={ sections }
selectedSection={ selectedItem.section }
selectedItem={ selectedItem.id }
selectedSectionId={ selectedSectionId }
selectedItemId={ selectedItemId }
/>
</div>
<div className="content col-xs-12 col-sm-9 col-md-9 col-lg-9">
<div className="nav-dropdown">
<NavDropdown
sections={ sections }
selectedSection={ selectedItem.section }
selectedItem={ selectedItem.id }
/>
</div>

<Content
title={selectedItem.title}
content={selectedItem.content}
/>

<div className="nav-dropdown">
<NavDropdown
sections={ sections }
selectedSection={ selectedItem.section }
selectedItem={ selectedItem.id }
/>
</div>
</div>
</div>
);
}
}

Container.propTypes = {
sections: React.PropTypes.array,
selectedItem: React.PropTypes.object,
selectedSectionId: React.PropTypes.string,
selectedItemId: React.PropTypes.string,
};

export default Container;
34 changes: 34 additions & 0 deletions src/components/Docs/Container/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#docs-container {
border-top: 1px solid #F4F4F4;
border-bottom: 1px solid #F4F4F4;
margin: 10px 0;
padding: 0;
}

#docs-container .nav-dropdown {
display: none;
}

#docs-container .nav-dropdown select {
width: 100%;
}

#docs-container .nav-dropdown div {
margin: 0 0 5px;
}

@media only screen and (max-width: 998px) {
#docs-container .nav {
display: none;
}

#docs-container .content {
border-left: none;
margin: 15px 0;
padding: 0;
}

#docs-container .nav-dropdown {
display: block;
}
}
36 changes: 36 additions & 0 deletions src/components/Docs/Content/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';
import Highlight from 'react-highlight';
import marked from 'marked';
import 'highlight.js/styles/github-gist.css';
import './style.css';

marked.setOptions({
renderer: new marked.Renderer(),
gfm: true,
tables: true,
breaks: true,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false
});

const DocsContent = ({ title, content }) => (
<div id="docs-content">
<div className="content">
<h2 className="title">{ title }</h2>
<div className="markdown">
<Highlight innerHTML={true}>
{ marked(content) }
</Highlight>
</div>
</div>
</div>
);

DocsContent.propTypes = {
title: React.PropTypes.string,
content: React.PropTypes.string.isRequired,
};

export default DocsContent;
Loading

0 comments on commit 95a81d8

Please sign in to comment.