├── .gitignore
├── .jshintrc
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── app
├── actions
│ ├── api.js
│ ├── routing.js
│ └── search.js
├── api
│ ├── components-api.js
│ ├── github-api.js
│ └── npm-api.js
├── components
│ ├── component-item.jsx
│ ├── component-link.jsx
│ ├── component-list.jsx
│ ├── container.jsx
│ ├── footer.jsx
│ ├── home-link.jsx
│ ├── layout.jsx
│ ├── loader.jsx
│ ├── markdown-readme.jsx
│ ├── no-result.jsx
│ ├── react-logo.jsx
│ ├── results-item.jsx
│ ├── results-table.jsx
│ └── search-input.jsx
├── config.js
├── controllers
│ └── components.js
├── database
│ └── index.js
├── pages
│ ├── component-info.jsx
│ ├── front.jsx
│ └── search.jsx
├── react
│ └── renderer.js
├── root.js
├── router.js
├── routes.js
├── search
│ └── filter.js
├── server
│ └── routes.js
├── stores
│ ├── component-store.shared.js
│ ├── components-store.browser.js
│ └── components-store.js
└── util
│ ├── deep.js
│ ├── escape-regex.js
│ ├── github-account.js
│ └── number-formatter.js
├── cron
├── fetch-components.js
└── fetch-stars.js
├── data
└── purpose.md
├── gulpfile.js
├── index.js
├── node_modules
└── app
├── package.json
├── public
├── css
│ ├── codemirror.css
│ ├── components.css
│ └── pure-min.css
├── dist
│ └── empty.txt
├── favicon.ico
├── favicon.svg
├── img
│ └── react.svg
├── js
│ ├── analytics.js
│ ├── codemirror-compressed.js
│ └── lodash.min.js
└── less
│ ├── _base.less
│ ├── _codemirror.less
│ ├── _component-info.less
│ ├── _content.less
│ ├── _footer.less
│ ├── _front.less
│ ├── _header.less
│ ├── _loader.less
│ ├── _mini-list.less
│ ├── _readme.less
│ ├── _search-input.less
│ ├── _search.less
│ ├── _variables.less
│ └── components.less
├── templates
└── default.html
└── webpack.config.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 |
5 | # Runtime data
6 | pids
7 | *.pid
8 | *.seed
9 |
10 | # Directory for instrumented libs generated by jscoverage/JSCover
11 | lib-cov
12 |
13 | # Coverage directory used by tools like istanbul
14 | coverage
15 |
16 | # Compiled binary addons (http://nodejs.org/api/addons.html)
17 | build/Release
18 |
19 | # Dependency directory
20 | # Deployed apps should consider commenting this line out:
21 | # see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
22 | node_modules
23 |
24 | # Data/cache dir
25 | data
26 |
27 | # Dist build
28 | public/dist
29 |
30 | # Ignore gz-files
31 | public/css/*.gz
32 | public/js/*.gz
33 |
34 |
--------------------------------------------------------------------------------
/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "node": true,
3 | "browser": true,
4 | "esnext": true,
5 | "bitwise": false,
6 | "curly": true,
7 | "eqeqeq": true,
8 | "immed": true,
9 | "indent": 4,
10 | "latedef": "func",
11 | "newcap": true,
12 | "noarg": true,
13 | "quotmark": "single",
14 | "regexp": true,
15 | "undef": true,
16 | "unused": true,
17 | "strict": true,
18 | "trailing": true,
19 | "smarttabs": true
20 | }
21 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to react-components.com
2 |
3 | ## Pull Requests
4 |
5 | Pull requests should be a branch from `master`.
6 |
7 | ## Style Guide
8 |
9 | ### Code
10 |
11 | * Use semicolons;
12 | * Commas last,
13 | * 4 spaces for indentation (no tabs)
14 | * Prefer `'` over `"`
15 | * `'use strict';`
16 | * "Attractive"
17 |
18 | ## License
19 |
20 | By contributing to react-components.com, you agree that your contributions will be licensed under the [MIT license](LICENSE).
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 VaffelNinja
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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | react-components
2 | ================
3 |
4 | Searchable repository of React-components
5 |
6 |
7 | ## Installation
8 |
9 | In order to build this project you need to have [node](https://nodejs.org/) and [redis](http://redis.io/) installed in your machine. Once you do, clone the repository and install it, using the following commands:
10 |
11 | ```
12 | git clone git@github.com:vaffel/react-components.git
13 | cd react-components
14 | npm install
15 | npm run fetch:database
16 | ```
17 |
18 | To run the project in development mode, use:
19 |
20 | ```
21 | gulp watch
22 | ```
23 |
24 | ### Importing modules
25 |
26 | This project relies on a database of npm components. Before being able to run the project for the first time, you need to fetch the components. The command to do so can also be used any time you wish to update your database.
27 |
28 | ```
29 | npm run fetch:database
30 | ```
31 |
32 | ### Possible sources of Installation problems For mac
33 |
34 | #### Problems during npm install
35 |
36 | The current version of the project is not yet fully compatible with node v4.0.0. One possible work around is to use Node Version Manager ([NVM](https://github.com/creationix/nvm)), and install node v0.12.7. This can be accomplished as follows:
37 |
38 | ```
39 | curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.28.0/install.sh | bash
40 | nvm install v0
41 | nvm use v0
42 | ```
43 |
44 | #### [Problems during hiredis Installation](https://github.com/redis/hiredis-node/issues/102)
45 |
46 | If while doing the npm install
you run into the following error:
47 | ```
48 | ld: library not found for -lgcc_s.10.5
49 | make: *** [Release/hiredis.node] Error 1
50 | ```
51 | You probably have a problem with your version of Xcode. The easiest way to solve it, is to update your Xcode and open it.
52 |
53 | #### Using Macports
54 |
55 | If you use macports to install your dependencies, then the issue might be that you are not using the [default gcc compiler](http://apple.stackexchange.com/questions/129608/switch-back-to-clang-after-installing-gcc-through-macports-on-mavericks). To verify that, do:
56 | ```
57 | gcc --version
58 | ```
59 | If what you get is not the default clang compiler from Xcode, edit your ~/.bash_profile as follows:
60 | ```
61 | vim ~/.bash_profile
62 | ```
63 | And comment out the line:
64 | ```
65 | export PATH=/opt/local/bin:/opt/local/sbin:$PATH
66 | ```
67 |
--------------------------------------------------------------------------------
/app/actions/api.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var Reflux = require('reflux');
4 |
5 | module.exports = Reflux.createActions([
6 | 'fetchComponents',
7 | 'fetchFailed',
8 | 'componentsFetched',
9 |
10 | 'fetchComponentInfo',
11 | 'fetchComponentFailed',
12 | 'componentFetched'
13 | ]);
--------------------------------------------------------------------------------
/app/actions/routing.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var Reflux = require('reflux');
4 |
5 | module.exports = Reflux.createActions([
6 | 'locationChange'
7 | ]);
--------------------------------------------------------------------------------
/app/actions/search.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var Reflux = require('reflux');
4 |
5 | module.exports = Reflux.createActions([
6 | 'search'
7 | ]);
--------------------------------------------------------------------------------
/app/api/components-api.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var _ = require('lodash');
4 | var ApiActions = require('app/actions/api');
5 | var request = require('xhr');
6 | var isFetchingList = false;
7 |
8 | var ComponentsApi = {
9 | fetchComponents: function() {
10 | isFetchingList = true;
11 |
12 | request({ url: '/api/components', json: true }, function(err, xhr, body) {
13 | if (err) {
14 | return ApiActions.fetchFailed(err);
15 | }
16 |
17 | var assignKey = _.partial(_.zipObject, body.keys),
18 | components = _.map(body.items, assignKey);
19 |
20 | isFetchingList = false;
21 | ApiActions.componentsFetched(components);
22 | });
23 | },
24 |
25 | fetchComponentInfo: function(name) {
26 | request({ url: '/api/components/' + encodeURIComponent(name), json: true }, function(err, xhr, body) {
27 | if (err) {
28 | return ApiActions.fetchComponentFailed(err);
29 | }
30 |
31 | ApiActions.componentFetched(body);
32 | });
33 | },
34 |
35 | listen: function() {
36 | ApiActions.fetchComponents.shouldEmit = function() {
37 | return !isFetchingList;
38 | };
39 |
40 | ApiActions.fetchComponents.listen(ComponentsApi.fetchComponents);
41 | ApiActions.fetchComponentInfo.listen(ComponentsApi.fetchComponentInfo);
42 | }
43 | };
44 |
45 | module.exports = ComponentsApi;
--------------------------------------------------------------------------------
/app/api/github-api.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var config = require('app/config');
4 | var Github = require('github');
5 | var client = new Github({
6 | version: '3.0.0',
7 | protocol: 'https'
8 | });
9 |
10 | var getGithubAccount = require('app/util/github-account');
11 |
12 | client.authenticate(config.github);
13 |
14 | var GithubApi = {
15 |
16 | getStarCountForModule: function(module, callback) {
17 | var repo = getGithubAccount(module);
18 |
19 | if (!repo) {
20 | return callback('Repo not resolvable for module ' + module.name);
21 | }
22 |
23 | client.repos.get({
24 | user: repo.split('/', 1).join(''),
25 | repo: repo.replace(/.*?\//, '')
26 | }, function(err, data) {
27 | if (err) {
28 | return callback(err);
29 | }
30 |
31 | callback(err, (data || {}).stargazers_count || 0);
32 | });
33 | }
34 |
35 | };
36 |
37 | module.exports = GithubApi;
38 |
--------------------------------------------------------------------------------
/app/api/npm-api.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var config = require('app/config'),
4 | request = require('request'),
5 | JSONStream = require('JSONStream'),
6 | eventStream = require('event-stream'),
7 | qs = require('querystring');
8 |
9 | function getError(err, res) {
10 | return err || (res.statusCode !== 200 ? 'HTTP ' + res.statusCode : null);
11 | }
12 |
13 | var registryUrl = 'https://registry.npmjs.org',
14 | viewsPath = '-/_view',
15 | keywordView = 'byKeyword',
16 | keyword = config['npm-keyword'],
17 | dlCountUrl = 'https://api.npmjs.org/downloads/point/last-week',
18 | isFetching = false;
19 |
20 | function parseModule(mod) {
21 | return {
22 | name: mod[1],
23 | description: mod[2]
24 | };
25 | }
26 |
27 | var NpmApi = {
28 |
29 | getModules: function(callback) {
30 | var url = [registryUrl, viewsPath, keywordView].join('/') + '?' + qs.stringify({
31 | startkey: '["' + keyword + '"]',
32 | endkey: '["' + keyword + '",{}]',
33 | group_level: 3
34 | });
35 |
36 | var onComplete = function(err, modules) {
37 | isFetching = false;
38 | callback(err, modules);
39 | };
40 |
41 | isFetching = true;
42 | request({ url: url })
43 | .on('error', function(err) { console.error('Error fetching modules: ', err); })
44 | .pipe(JSONStream.parse('rows.*.key'))
45 | .pipe(eventStream.mapSync(parseModule))
46 | .pipe(eventStream.map(NpmApi.getModuleInfo))
47 | .on('error', function(err) { console.error('Error fetching module info: ', err); })
48 | .pipe(eventStream.map(NpmApi.getModuleDownloadCount))
49 | .on('error', function(err) { console.error('Error fetching module download count: ', err); })
50 | .pipe(eventStream.writeArray(onComplete));
51 | },
52 |
53 | getModuleDownloadCount: function(module, callback) {
54 | var moduleName = module.name ? module.name : module,
55 | url = [dlCountUrl, encodeURIComponent(moduleName)].join('/');
56 |
57 | request({ url: url, json: true }, function(err, res, response) {
58 | module.downloads = (response || {}).downloads;
59 | callback(getError(err, res), module);
60 | });
61 | },
62 |
63 | getModuleInfo: function(module, callback) {
64 | var moduleName = module.name ? module.name : module,
65 | url = [registryUrl, moduleName].join('/');
66 |
67 | request({ url: url, json: true }, function(err, res, body) {
68 | err = getError(err, res);
69 | if (typeof body !== 'object') {
70 | err = 'Body was not an object';
71 | }
72 |
73 | callback(err, body);
74 | });
75 | }
76 | };
77 |
78 | module.exports = NpmApi;
79 |
--------------------------------------------------------------------------------
/app/components/component-item.jsx:
--------------------------------------------------------------------------------
1 | /** @jsx React.DOM */
2 | 'use strict';
3 |
4 | var React = require('react');
5 | var ComponentLink = require('app/components/component-link.jsx');
6 |
7 | module.exports = React.createClass({
8 | displayName: 'ComponentItem',
9 |
10 | propTypes: {
11 | component: React.PropTypes.object.isRequired
12 | },
13 |
14 | /* jshint quotmark:false, newcap:false */
15 | render: function() {
16 | return (
17 |
{this.props.component.description}
17 | 18 |Name | 50 |Author | 51 |Stars | 52 |Updated | 53 |
---|
65 | Every module registered on NPM using the keyword react-component will show up in the list. 66 | It really is that simple. 67 |
68 | 69 |Let us know! We're always looking for ways to improve.
78 | 79 |81 | Developed and currently hosted by VaffelNinja, but it's an open-source, MIT-licensed solution. 82 |
83 |84 | Contributions are very welcome! 85 | Please make sure you read the contribution guidelines. 86 |
87 |f(h,y))&&((u||v)&&h.push(y),s.push(g))}return v?(l(h.k),c(h)):u&&l(h),s}function lt(n){return function(t,e,r){var u={};e=J.createCallback(e,r,3),r=-1;var o=t?t.length:0;if(typeof o=="number")for(;++r