Skip to content

Commit

Permalink
Merge pull request #14 from storybooks/5-gatsby-static-site
Browse files Browse the repository at this point in the history
New, static site starting from Gatsby starter kit
  • Loading branch information
shilman authored May 3, 2017
2 parents 7cd1f3d + a76119b commit 007f548
Show file tree
Hide file tree
Showing 168 changed files with 1,992 additions and 2,878 deletions.
15 changes: 15 additions & 0 deletions .gatsby-context.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';

/* weak */
// This file is auto-written and used by Gatsby to require
// files from your pages directory.
module.exports = function (callback) {
var context = require.context('./pages', true, /(coffee|cjsx|ts|tsx|jsx|js|md|rmd|mkdn?|mdwn|mdown|markdown|litcoffee|ipynb|html|json|yaml|toml)$/); // eslint-disable-line
if (module.hot) {
module.hot.accept(context.id, function () {
context = require.context('./pages', true, /(coffee|cjsx|ts|tsx|jsx|js|md|rmd|mkdn?|mdwn|mdown|markdown|litcoffee|ipynb|html|json|yaml|toml)$/); // eslint-disable-line
return callback(context);
});
}
return callback(context);
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ dist
build
packages/examples/automated-*
yarn.lock
public
2 changes: 0 additions & 2 deletions .storybook/addons.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import { register } from './notes_addon';
register();
require('@kadira/storybook/addons');
5 changes: 3 additions & 2 deletions .storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { configure } from '@kadira/storybook';

import 'bootstrap/dist/css/bootstrap.css';
import '../src/index.css';
import '../css/main.css';

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

configure(loadStories, module);
78 changes: 0 additions & 78 deletions .storybook/notes_addon.js

This file was deleted.

5 changes: 0 additions & 5 deletions 404.html

This file was deleted.

21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

20 changes: 0 additions & 20 deletions app.json

This file was deleted.

30 changes: 30 additions & 0 deletions components/Breakpoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import './breakpoints.css'

class Breakpoint extends Component {
render () {
const { mobile, children } = this.props

if (mobile) {
return (
<div className="breakpoint-min-width-700">
{children}
</div>
)
}

return (
<div className="breakpoint-max-width-700">
{children}
</div>
)
}
}

Breakpoint.propTypes = {
children: PropTypes.array,
mobile: PropTypes.bool,
}

export default Breakpoint
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,6 @@ import Content from '../Content';
import './style.css';

class Container extends React.Component {
renderTopNav(cat) {
const { selectedCatId } = this.props;
const path = `/docs/${cat.id}`;

if (selectedCatId === cat.id) {
return <li className="selected" key={cat.id}>{cat.title}</li>;
}

return <a key={cat.id} href={path}><li>{cat.title}</li></a>;
}

render() {
const {
categories,
Expand All @@ -29,18 +18,10 @@ class Container extends React.Component {

const gitHubRepoUrl = 'https://github.com/storybooks/storybooks.github.io';
const docPath = `${selectedCatId}/${selectedSectionId}/${selectedItemId}`;
const gitHubRepoDocUrl = `${gitHubRepoUrl}/tree/source/src/docs/${docPath}.js`;
const gitHubRepoDocUrl = `${gitHubRepoUrl}/tree/source/pages/docs/${docPath}/index.md`;

return (
<div id="docs-container" className="row">
<div className="row">
<div className="col-xs-12">
<ul className="top-nav">
{categories.map(this.renderTopNav.bind(this))}
</ul>
</div>
</div>

<div className="nav col-sm-3 col-md-3 hidden-xs">
<Nav
selectedCatId={selectedCatId}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
import PropTypes from 'prop-types';
import React from 'react';
import Highlight from '../../../lib/highlight.js';
import marked from 'marked';
import Highlight from '../../Highlight';
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, editUrl }) => (
<div id="docs-content">
<div className="content">
Expand All @@ -24,7 +12,7 @@ const DocsContent = ({ title, content, editUrl }) => (

<div className="markdown">
<Highlight>
{marked(content)}
{content}
</Highlight>
</div>
</div>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ class Nav extends React.Component {
}

changeRoute(selectedCatId, selectedSectionId, selectedItemId) {
const url = `/docs/${selectedCatId}/${selectedSectionId}/${selectedItemId}`;
const url = `/docs/${selectedCatId}/${selectedSectionId}/${selectedItemId}/`;
browserHistory.push(url);
}

handleHeadingChange(evt) {
const { selectedCatId } = this.props;
this.changeRoute(selectedCatId, evt.target.value, '');
const { selectedCatId, sections } = this.props;
const selectedSectionId = evt.target.value
const section = sections.find(section => section.id === selectedSectionId)
const itemId = section.items[0].id
this.changeRoute(selectedCatId, selectedSectionId, itemId);
}

handleNavChange(evt) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Nav extends React.Component {
? 'selected'
: '';

const url = `/docs/${selectedCatId}/${section.id}/${item.id}`;
const url = `/docs/${selectedCatId}/${section.id}/${item.id}/`;

return (
<li key={item.id}>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/components/Docs/index.js → components/Docs/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import PropTypes from 'prop-types';
import React from 'react';
import Helmet from 'react-helmet';
import Header from '../Homepage/Header';
import Header from '../Header';
import Container from './Container';
import Footer from '../Homepage/Footer';
import Footer from '../Footer';
import './style.css';

class Docs extends React.Component {
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ const Footer = () => (
</center>
</div>
</div>

<div id="copyright" className="row">
<p>Built by Kadira</p>
</div>
</div>
</div>
);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import PropTypes from 'prop-types';
import React from 'react';
import './style.css';

import storybookLogo from '../../../design/homepage/storybook-logo.png';
import storybookLogo from '../../design/homepage/storybook-logo.png';

const sections = [
{ id: 'home', caption: 'Home', href: '/' },
{ id: 'docs', caption: 'Docs', href: '/docs' },
{ id: 'docs', caption: 'Docs', href: '/docs/react-storybook/basics/introduction/' },
];

class Header extends React.Component {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import PropTypes from 'prop-types';
import React from 'react';
import Helmet from 'react-helmet';
import './style.css';
import Header from './Header';
import Header from '../Header';
import Heading from './Heading';
import Demo from './Demo';
import Platforms from './Platforms';
import MainLinks from './MainLinks';
import Featured from './Featured';
import Footer from './Footer';
import Footer from '../Footer';

const featuredStorybooks = [
{
Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions components/breakpoints.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@media only screen and (min-width: 700px) {
.breakpoint-min-width-700 {
display: block;
}
.breakpoint-max-width-700 {
display: none;
}
}
@media only screen and (max-width: 700px) {
.breakpoint-min-width-700 {
display: none;
}
.breakpoint-max-width-700 {
display: block;
}
}
Loading

0 comments on commit 007f548

Please sign in to comment.