Skip to content

Commit

Permalink
First version working
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Cuevas committed Mar 25, 2016
0 parents commit c76ec9f
Show file tree
Hide file tree
Showing 13 changed files with 498 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = true
indent_style = tab

[*.json]
indent_style = space
indent_size = 2
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.publish/*
dist/*
example/dist/*
lib/*
node_modules/*
32 changes: 32 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true
},
"plugins": [
"react"
],
"rules": {
"curly": [2, "multi-line"],
"quotes": [2, "single", "avoid-escape"],
"react/display-name": 0,
"react/jsx-boolean-value": 1,
"react/jsx-quotes": 1,
"react/jsx-no-undef": 1,
"react/jsx-sort-props": 0,
"react/jsx-sort-prop-types": 1,
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1,
"react/no-did-mount-set-state": 1,
"react/no-did-update-set-state": 1,
"react/no-multi-comp": 1,
"react/no-unknown-property": 1,
"react/prop-types": 1,
"react/react-in-jsx-scope": 1,
"react/self-closing-comp": 1,
"react/wrap-multilines": 1,
"semi": 2,
"strict": 0
}
}
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Coverage tools
lib-cov
coverage
coverage.html
.cover*

# Dependency directory
node_modules

# Example build directory
example/dist
.publish

# Editor and other tmp files
*.swp
*.un~
*.iml
*.ipr
*.iws
*.sublime-*
.idea/
*.DS_Store
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# React Select Google Places

__COMPONENT DESCRIPTION GOES HERE__


## Demo & Examples

Live demo: [javiercr.github.io/react-select-google-places](http://javiercr.github.io/react-select-google-places/)

To build the examples locally, run:

```
npm install
npm start
```

Then open [`localhost:8000`](http://localhost:8000) in a browser.


## Installation

The easiest way to use react-select-google-places is to install it from NPM and include it in your own React build process (using [Browserify](http://browserify.org), [Webpack](http://webpack.github.io/), etc).

You can also use the standalone build by including `dist/react-select-google-places.js` in your page. If you use this, make sure you have already included React, and it is available as a global variable.

```
npm install react-select-google-places --save
```


## Usage

__EXPLAIN USAGE HERE__

```
var ReactSelectGooglePlaces = require('react-select-google-places');
<ReactSelectGooglePlaces>Example</ReactSelectGooglePlaces>
```

### Properties

* __DOCUMENT PROPERTIES HERE__

### Notes

__ADDITIONAL USAGE NOTES__


## Development (`src`, `lib` and the build process)

**NOTE:** The source code for the component is in `src`. A transpiled CommonJS version (generated with Babel) is available in `lib` for use with node.js, browserify and webpack. A UMD bundle is also built to `dist`, which can be included without the need for any build system.

To build, watch and serve the examples (which will also watch the component source), run `npm start`. If you just want to watch changes to `src` and rebuild `lib`, run `npm run watch` (this is useful if you are working with `npm link`).

## License

__PUT LICENSE HERE__

Copyright (c) 2016 Javier Cuevas.

29 changes: 29 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "react-select-google-places",
"version": "0.0.0",
"description": "React Select Google Places",
"main": "dist/react-select-google-places.min.js",
"homepage": "https://github.com/javiercr/react-select-google-places",
"authors": [
"Javier Cuevas"
],
"moduleType": [
"amd",
"globals",
"node"
],
"keywords": [
"react",
"react-component"
],
"license": "MIT",
"ignore": [
".editorconfig",
".gitignore",
"package.json",
"src",
"node_modules",
"example",
"test"
]
}
5 changes: 5 additions & 0 deletions example/src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## This file is here to ensure it is included in the gh-pages branch,
## when `gulp deploy` is used to push updates to the demo site.

# Dependency directory
node_modules
18 changes: 18 additions & 0 deletions example/src/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var React = require('react');
var ReactDOM = require('react-dom');
var SelectGooglePlaces = require('react-select-google-places');

var App = React.createClass({
render () {
return (
<div>
<h2>Demo Single selection</h2>
<SelectGooglePlaces optionsForSelect={{multi: false}} />
<h2>Demo Multiple selection</h2>
<SelectGooglePlaces optionsForSelect={{multi: true}} />
</div>
);
}
});

ReactDOM.render(<App />, document.getElementById('app'));
63 changes: 63 additions & 0 deletions example/src/example.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
@import "../../node_modules/react-select/less/select.less";

/*
// Examples Stylesheet
// -------------------
*/

body {
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #333;
margin: 0;
padding: 0;
}

a {
color: #08c;
text-decoration: none;
}

a:hover {
text-decoration: underline;
}

.container {
margin-left: auto;
margin-right: auto;
max-width: 720px;
padding: 1em;
}

.footer {
margin-top: 50px;
border-top: 1px solid #eee;
padding: 20px 0;
font-size: 12px;
color: #999;
}

h1, h2, h3, h4, h5, h6 {
color: #222;
font-weight: 100;
margin: 0.5em 0;
}

label {
color: #999;
display: inline-block;
font-size: 0.85em;
font-weight: bold;
margin: 1em 0;
text-transform: uppercase;
}

.hint {
margin: 15px 0;
font-style: italic;
color: #999;
}

.Select, ul {
margin-bottom: 2em;
}
32 changes: 32 additions & 0 deletions example/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!doctype html>
<head>
<title>React Select Google Places</title>
<link rel="stylesheet" href="example.css">
</head>
<body>
<div class="container">
<h1>React Select Google Places</h1>
<h3><a href="https://github.com/javiercr/react-select-google-places">View project on GitHub</a></h3>
<p>
This is a Google Places Autocomplete select component based on <a href="https://jedwatson.github.io/react-select/">React Select</a>.
</p>
<h2>Features</h2>
<ul>
<li>Single or multiple selection.</li>
<li>Automatically fetches additional data for each selected place (latitude, longitude, etc).</li>
<li>Allows to change the language for results and to limit the country (defaults are 'en' and 'USA').</li>
</ul>

<!-- the example app is rendered into this div -->
<div id="app"></div>
<div class="hint">
<!-- put any hints about your component example here -->
</div>
<div class="footer">
Copyright &copy; 2016 Javier Cuevas.
</div>
</div>
<script src="common.js"></script>
<script src="bundle.js"></script>
<script src="example.js"></script>
</body>
42 changes: 42 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
var gulp = require('gulp');
var initGulpTasks = require('react-component-gulp-tasks');

/**
* Tasks are added by the react-component-gulp-tasks package
*
* See https://github.com/JedWatson/react-component-gulp-tasks
* for documentation.
*
* You can also add your own additional gulp tasks if you like.
*/

var taskConfig = {

component: {
name: 'SelectGooglePlaces',
dependencies: [
'classnames',
'react',
'react-dom'
],
lib: 'lib'
},

example: {
src: 'example/src',
dist: 'example/dist',
files: [
'index.html',
'.gitignore'
],
scripts: [
'example.js'
],
less: [
'example.less'
]
}

};

initGulpTasks(gulp, taskConfig);
49 changes: 49 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "react-select-google-places",
"version": "1.0.0",
"description": "React Select Google Places",
"main": "lib/ReactSelectGooglePlaces.js",
"author": "Javier Cuevas",
"homepage": "https://github.com/javiercr/react-select-google-places",
"repository": {
"type": "git",
"url": "https://github.com/javiercr/react-select-google-places.git"
},
"bugs": {
"url": "https://github.com/javiercr/react-select-google-places/issues"
},
"dependencies": {
"classnames": "^2.1.2",
"react-select": "^1.0.0-beta11",
"scriptjs": "^2.5.8"
},
"devDependencies": {
"babel-eslint": "^4.1.3",
"eslint": "^1.6.0",
"eslint-plugin-react": "^3.5.1",
"gulp": "^3.9.0",
"react": "^0.14.0",
"react-component-gulp-tasks": "^0.7.6",
"react-dom": "^0.14.0"
},
"peerDependencies": {
"react": "^0.14.0"
},
"browserify-shim": {
"react": "global:React"
},
"scripts": {
"build": "gulp clean && NODE_ENV=production gulp build",
"examples": "gulp dev:server",
"lint": "eslint ./; true",
"publish:site": "NODE_ENV=production gulp publish:examples",
"release": "NODE_ENV=production gulp release",
"start": "gulp dev",
"test": "echo \"no tests yet\" && exit 0",
"watch": "gulp watch:lib"
},
"keywords": [
"react",
"react-component"
]
}
Loading

0 comments on commit c76ec9f

Please sign in to comment.