Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

New, static site starting from Gatsby starter kit #14

Merged
merged 15 commits into from
May 3, 2017
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
};
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import Highlight from '../../../lib/highlight.js';
// import Highlight from '../../../lib/highlight.js';
import marked from 'marked';
import 'highlight.js/styles/github-gist.css';
import './style.css';
Expand All @@ -22,11 +22,7 @@ const DocsContent = ({ title, content, editUrl }) => (
<h2 className="title">{title}</h2>
<p><a className="edit-link" href={editUrl} target="_blank">Edit this page</a></p>

<div className="markdown">
<Highlight>
{marked(content)}
</Highlight>
</div>
<div className="markdown" dangerouslySetInnerHTML={{ __html: content }} />
</div>
</div>
);
Expand Down
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
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.
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
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
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
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;
}
}
36 changes: 36 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
siteTitle = "Storybook"
baseColor = "#e64074"
linkPrefix = "/"

[docSections]
basics = [
"/docs/react-storybook/basics/introduction/",
"/docs/react-storybook/basics/quick-start-guide/",
"/docs/react-storybook/basics/slow-start-guide/",
"/docs/react-storybook/basics/writing-stories/",
"/docs/react-storybook/basics/exporting-storybook/",
"/docs/react-storybook/basics/faq/",
]
configurations = [
"/docs/react-storybook/configurations/default-config/",
"/docs/react-storybook/configurations/custom-webpack-config/",
"/docs/react-storybook/configurations/custom-babel-config/",
"/docs/react-storybook/configurations/add-custom-head-tags/",
"/docs/react-storybook/configurations/serving-static-files/",
"/docs/react-storybook/configurations/env-vars/",
"/docs/react-storybook/configurations/cli-options/",
]
testing = [
"/docs/react-storybook/testing/react-ui-testing/",
"/docs/react-storybook/testing/structural-testing/",
"/docs/react-storybook/testing/interaction-testing/",
"/docs/react-storybook/testing/css-style-testing/",
"/docs/react-storybook/testing/manual-testing/",
]
addons = [
"/docs/react-storybook/addons/introduction/",
"/docs/react-storybook/addons/using-addons/",
"/docs/react-storybook/addons/addon-gallery/",
"/docs/react-storybook/addons/writing-addons/",
"/docs/react-storybook/addons/api/",
]
Loading