├── .gitignore ├── .npmignore ├── LICENSE ├── demo ├── Client.js ├── Routes.js ├── Server.js ├── less │ └── styles.less └── pages │ ├── BasePage.txt │ ├── ClientLoader.js │ ├── Demo.js │ └── Root.js ├── karma.conf.js ├── package.json ├── readme.md ├── src ├── components │ ├── Icon.js │ ├── VNav.js │ └── VNavItem.js ├── index.js ├── less │ └── vnav.less └── lib │ └── menuHelper.js ├── test ├── index.js └── menuHelperSpec.js ├── tools ├── build-demo.js ├── build-dist.js └── build-lib.js ├── webpack.config.demo.dev.js ├── webpack.config.demo.prod.js ├── webpack.config.dist.js └── webpack ├── webpack.config.demo.dev.js ├── webpack.config.demo.prod.js ├── webpack.config.dist.js └── webpack.config.test.js /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | 3 | # Logs 4 | logs 5 | *.log 6 | 7 | # Runtime data 8 | pids 9 | *.pid 10 | *.seed 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 19 | .grunt 20 | 21 | # node-waf configuration 22 | .lock-wscript 23 | 24 | # Compiled binary addons (http://nodejs.org/api/addons.html) 25 | build/Release 26 | 27 | # Dependency directory 28 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 29 | node_modules 30 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | docs 3 | docs-md 4 | test 5 | tools 6 | webpack 7 | karma.conf.js 8 | webpack.*.js 9 | register-babel.js 10 | .npmignore 11 | .idea 12 | demo 13 | .travis.yml -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Gearz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /demo/Client.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDom from 'react-dom'; 3 | import { Router } from 'react-router' 4 | import routes from './Routes'; 5 | 6 | import Styles from './less/styles.less'; 7 | 8 | const createBrowserHistory = require('history/lib/createBrowserHistory'); 9 | ReactDom.render (( 10 | 11 | {routes} 12 | 13 | ), document.getElementById('#app_container')); 14 | -------------------------------------------------------------------------------- /demo/Routes.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import Root from './pages/Root'; 4 | import Demo from './pages/Demo.js'; 5 | 6 | import {Route} from 'react-router'; 7 | 8 | export default ( 9 | 10 | 11 | 12 | ) 13 | -------------------------------------------------------------------------------- /demo/Server.js: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import React from 'react'; 3 | import ReactDom from 'react-dom'; 4 | import express from 'express'; 5 | import path from 'path'; 6 | import webpack from 'webpack'; 7 | import webpackConfig from '../webpack/webpack.config.demo.prod.js'; 8 | import { renderToString } from 'react-dom/server' 9 | import { match, RoutingContext } from 'react-router' 10 | import routes from './Routes' 11 | 12 | require.extensions['.txt'] = function (module, filename) { 13 | module.exports = fs.readFileSync(filename, 'utf8'); 14 | }; 15 | 16 | const development = process.env.NODE_ENV !== 'production'; 17 | let app = express(); 18 | 19 | if (development) { 20 | 21 | webpackConfig.output.path = '/'; 22 | webpackConfig.output.publicPath = undefined; 23 | 24 | app = app 25 | .use(function renderApp(req, res) { 26 | 27 | match({ routes, location: req.url }, (error, redirectLocation, renderProps) => { 28 | if (error) { 29 | res.status(500).send(error.message) 30 | } else if (redirectLocation) { 31 | res.redirect(302, redirectLocation.pathname + redirectLocation.search) 32 | } else if (renderProps) { 33 | 34 | let wrap = require('../demo/pages/BasePage.txt') 35 | .replace(/\$\{cssBundlePath\}/g, '') 36 | .replace(/\$\{jsBundlePath\}/g, 'http://localhost:8082/assets/bundle.js'); 37 | res.status(200).send(wrap); 38 | 39 | } else { 40 | res.status(404).send('Not found') 41 | } 42 | }); 43 | 44 | }); 45 | } else { 46 | app = app 47 | .use('/react-vnav', express.static(path.join(__dirname, '../demo-built'))); 48 | } 49 | 50 | app 51 | .listen(4000, function () { 52 | console.log('Server started at http://localhost:4000/react-vnav/demo.html'); 53 | }); 54 | -------------------------------------------------------------------------------- /demo/less/styles.less: -------------------------------------------------------------------------------- 1 | @import '../../node_modules/bootstrap/less/bootstrap'; 2 | @import '../../node_modules/font-awesome/less/font-awesome'; 3 | 4 | @import '../../src/less/vnav.less'; -------------------------------------------------------------------------------- /demo/pages/BasePage.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | React-vnav - A library for creating vertical main menus 4 | 5 | 6 | 7 | 8 | 9 |
10 |
11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /demo/pages/ClientLoader.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Router from 'react-router'; 3 | import Routes from '../Routes.js'; 4 | 5 | const ClientLoader = React.createClass({ 6 | 7 | render: function () { 8 | 9 | let browserInitScriptObj = { 10 | __html:`console.log('fuuuu');` 11 | }; 12 | 13 | return ( 14 |
15 |
16 |
17 |