Skip to content
Browse files

Sidebar almost working

  • Loading branch information...
1 parent 3874920 commit 73935ba921a1e1f4fa715f2694d485f36734704d @hallaathrad hallaathrad committed
Showing with 119 additions and 108 deletions.
  1. +8 −9 app.js
  2. +1 −1 create_structure.js
  3. +13 −0 css/gatsby.css
  4. +11 −8 html.jsx → html.js
  5. +6 −6 package.json
  6. +1 −6 templates/_template.jsx
  7. +77 −76 templates/lang/_template.jsx
  8. +1 −1 wiki-gh-pages
  9. +1 −1 wiki-master
View
17 app.js
@@ -1,11 +1,10 @@
-exports.loadContext = function(callback) {
- var context;
- context = require.context('./pages', true);
+exports.loadContext = function (callback) {
+ let context = require.context('./pages', true)
if (module.hot) {
- module.hot.accept(context.id, function() {
- context = require.context('./pages', true);
- return callback(context);
- });
+ module.hot.accept(context.id, () => {
+ context = require.context('./pages', true)
+ return callback(context)
+ })
}
- return callback(context);
-};
+ return callback(context)
+}
View
2 create_structure.js
@@ -21,7 +21,7 @@ var languageFolders = [
}
];
-// List of supported lanugages
+// List of supported languages
var langList = [ 'en/' ];
// Get File list
View
13 css/gatsby.css
@@ -1,11 +1,24 @@
body,html {
overflow:hidden;
}
+#react-mount {
+ position: absolute;
+ display: block;
+ height: 100%;
+ width: 100%;
+}
.wiki-container {
max-width:960px;
padding:80px 30px 0;
+ box-sizing: border-box;
+ display: inline-block;
+ width: 100%;
+ height: 100%;
margin:0 auto;
position:relative;
+ overflow-x: hidden;
+ overflow-y: auto;
+ -webkit-overflow-scrolling: touch;
}
a{
text-decoration: none;
View
19 html.jsx → html.js
@@ -6,17 +6,20 @@ import typography from './utils/typography';
const { TypographyStyle } = typography;
module.exports = React.createClass({
- DefaultProps: function() {
+ propTypes () {
return {
- body: ""
- };
+ title: React.PropTypes.string,
+ }
},
-
- render: function() {
- var title
- title = DocumentTitle.rewind();
+ render () {
+ let title = DocumentTitle.rewind()
if (this.props.title) {
- title = this.props.title;
+ title = this.props.title
+ }
+
+ let cssLink
+ if (process.env.NODE_ENV === 'production') {
+ cssLink = <link rel="stylesheet" href={link('/styles.css')} />
}
return (
View
12 package.json
@@ -21,15 +21,15 @@
"color-pairs-picker": "^1.3.5",
"fs-extra": "^0.26.5",
"lodash": "^4.5.1",
- "mkdirp": "^0.5.1",
- "promise": "^7.0.4",
- "react": "^0.14.3",
+ "mkdirp": "^0.5.1",
+ "promise": "^7.0.4",
+ "react": "^0.14.7",
"react-document-title": "^2.0.1",
- "react-dom": "^0.14.3",
+ "react-dom": "^0.14.7",
"react-motion": "^0.1.0",
- "react-responsive-grid": "^0.2.1",
+ "react-responsive-grid": "^0.3.1",
"react-router": "^2.0.0",
- "typography": "^0.6.2",
+ "typography": "^0.7.0",
"underscore.string": "^3.2.2"
},
"devDependencies": {
View
7 templates/_template.jsx 100755 → 100644
@@ -1,21 +1,16 @@
import React from 'react';
import { Link, State, Navigation } from 'react-router';
import { Container, Grid, Breakpoint, Span } from 'react-responsive-grid';
-import Typography from 'typography';
import colorPairsPicker from 'color-pairs-picker';
import chroma from 'chroma-js';
import includes from 'underscore.string/include';
-
-import typography from 'utils/typography';
+import { link, templateChildrenPages } from 'gatsby-helpers';
// Style code
import 'css/github.css';
import 'css/gatsby.css';
-const { rhythm, fontSizeToPx } = typography;
-
module.exports = React.createClass({
- mixins: [State, Navigation],
render: function() {
return (
<div className='wiki-container'>
View
153 templates/lang/_template.jsx
@@ -1,92 +1,86 @@
import React from 'react';
import { Link, State, Navigation } from 'react-router';
import { Container, Grid, Breakpoint, Span } from 'react-responsive-grid';
-import Typography from 'typography';
-import sortBy from 'lodash/sortBy';
import find from 'lodash/find';
-import colorPairsPicker from 'color-pairs-picker';
-import chroma from 'chroma-js';
-import includes from 'underscore.string/include';
import { link } from 'gatsby-helpers';
-import typography from 'utils/typography';
import pageList from './_pages.yaml';
+import typography from 'utils/typography';
+
// Style code
import 'css/github.css';
import 'css/gatsby.css';
-const { rhythm, fontSizeToPx } = typography;
-
module.exports = React.createClass({
- mixins: [State, Navigation],
-
- getInitialState: function() {
- return {
- filterText: ''
- };
+ propTypes () {
+ return {
+ route: React.PropTypes.object,
+ }
},
-
- handleTopicChange: function(e) {
- return this.transitionTo(e.target.value);
+ contextTypes: {
+ router: React.PropTypes.object.isRequired,
},
-
- handleSearchChange: function(e) {
- this.setState({
- filterText: this.refs.filterTextInput.value
- });
+ handleTopicChange (e) {
+ return this.context.router.push(e.target.value)
},
-
- render: function() {
- var childPages, docOptions, docPages;
- var langRegex = new RegExp( '^/' + __filename.slice(0,2))
- childPages = pageList.map((p) => {
- const page = find(this.props.route.pages, (_p) => _p.path === p);
+ getInitialState () {
+ return {
+ filterText: ''
+ };
+ },
+ handleSearchChange (e) {
+ this.setState({
+ filterText: this.refs.filterTextInput.value
+ });
+ },
+ render () {
+ var langRegex = new RegExp( '^/' + __filename.slice(0,2));
+ const childPages = pageList.map((p) => {
+ const page = find(this.props.route.pages, (_p) => _p.path === p)
return {
title: page.data.title,
order: page.data.order,
- path: page.path
- };
+ path: page.path,
+ }
}).sort((a,b) => { return a.order - b.order });
-
- docOptions = childPages.map(function(child) {
- return React.createElement("option", {
- "key": child.path,
- "value": child.path
- }, child.title);
- });
-
- docPages = childPages
- .filter(function(child) {
- if(this.state.filterText.length > 0) {
- let regex = new RegExp(this.state.filterText,'i');
- return regex.test(child.title);
- } else {
- return true;
- }
- },this)
- .map(function(child) {
- return function(child) {
- var isActive;
- isActive = link(child.path) === this.props.location.pathname;
- return (
- <li
- key={child.path}
- style={{
+ const docOptions = childPages.map((child) =>
+ <option
+ key={link(child.path)}
+ value={link(child.path)}
+ >
+ {child.title}
+ </option>
+
+ )
+ const docPages = childPages
+ .filter(function(child) {
+ if(this.state.filterText.length > 0) {
+ let regex = new RegExp(this.state.filterText,'i');
+ return regex.test(child.title);
+ } else {
+ return true;
+ }
+ },this)
+ .map((child) => {
+ const isActive = link(child.path) === this.props.location.pathname
+ return (
+ <li
+ key={child.path}
+ style={{
marginBottom: rhythm(1/2),
}}
- >
- <Link
- to={link(child.path)}
- style={{
+ >
+ <Link
+ to={link(child.path)}
+ style={{
textDecoration: 'none',
}}
- >
- {isActive ? <strong>{child.title}</strong> : child.title }
- </Link>
- </li>
- )
- };
- });
+ >
+ {isActive ? <strong>{child.title}</strong> : child.title }
+ </Link>
+ </li>
+ )
+ })
return (
<div>
@@ -99,23 +93,24 @@ module.exports = React.createClass({
ref="filterTextInput"
onChange={this.handleSearchChange}
placeholder='Article search'
- /></div>
+ />
+ </div>
<div className='articlesList'>
<ul>
- {docPages}
+ {docPages}
</ul>
- </div>
+ </div>
</div>
<div className='articleContent'>
{this.props.children}
</div>
</Breakpoint>
- <Breakpoint maxWidth={700}>
+ <Breakpoint maxWidth={700}>
<div className='wikiSelector'>
<select
- defaultValue={this.props.route.path}
- onChange={this.handleTopicChange}
- >
+ defaultValue={this.props.location.pathname}
+ onChange={this.handleTopicChange}
+ >
{docOptions}
</select>
</div>
@@ -124,6 +119,12 @@ module.exports = React.createClass({
</div>
</Breakpoint>
</div>
- );
- }
-});
+ )
+ },
+})
+
+
+/*
+
+
+*/
2 wiki-gh-pages
@@ -1 +1 @@
-Subproject commit 643a5290285115f57c660e4c9bd9b179f8aa8708
+Subproject commit 59ffce39c4afef64e5fb1807e0e6d496c5811811
2 wiki-master
@@ -1 +1 @@
-Subproject commit b756eb51fd4e120ba0ed66a5503d373d37bad262
+Subproject commit d59e6241711dffa93f88bc28b2ee5a1aa3309ab0

0 comments on commit 73935ba

Please sign in to comment.
Something went wrong with that request. Please try again.