|
1 | | -# Appirio File Uploader |
| 1 | +# React Components |
2 | 2 |
|
3 | | -## Using the repo in your app |
| 3 | +This repository is used to distribute reusable React components. |
4 | 4 |
|
5 | | -## Install |
| 5 | +## Installation |
6 | 6 |
|
7 | | -```shell |
8 | | -npm install appirio-tech-react-components |
| 7 | +We use node 5.x and npm 3.x, so you may need to download a new version of node. The easiest way is to download [nvm](https://github.com/creationix/nvm). We have a `.nvmrc` file in the root of the project, so you can just run `nvm use` to switch to the correct version of node. |
| 8 | + |
| 9 | +Install dependencies by running the following in the root of the project: |
| 10 | + - `npm i` |
| 11 | + - **Note:** You must use npm 3. Type `npm -v` to ensure you have a 3.x version. |
| 12 | + |
| 13 | +## NPM Commands |
| 14 | +- To run locally, run `npm run dev` and head to `localhost:8080` |
| 15 | +- To create the build: `npm run build` |
| 16 | +- To run the test runner: `TODO: need to update` |
| 17 | +- To make sure your code passes linting: `npm run lint` |
| 18 | + |
| 19 | +## Recommended Developer Tools |
| 20 | + |
| 21 | +Syntax highlighting for ES6 and React JSX |
| 22 | +- Install [babel](https://packagecontrol.io/packages/Babel) via the package manager in Sublime Text |
| 23 | + - **Note:** Sublime Text 3 is required for this plugin |
| 24 | +- Set the plugin as the default syntax for a particular extension |
| 25 | + - Open a file with the `.js` extension |
| 26 | + - Select `View` from the menu |
| 27 | + - Then `Syntax -> Open all with current extension as...` |
| 28 | + - Then `Babel -> JavaScript (Babel)` |
| 29 | + - Repeat for any other extensions, e.g. `.jsx` |
| 30 | + |
| 31 | +Recommended Theme |
| 32 | +- Install [Oceanic Next Color Theme](https://github.com/voronianski/oceanic-next-color-scheme) via the Sublime Text package manager. |
| 33 | +- Add the following to `Sublime Text -> Preferences -> Settings-User` (`⌘ + ,` on Mac) |
| 34 | +``` |
| 35 | +{ |
| 36 | + "color_scheme": "Packages/Oceanic Next Color Scheme/Oceanic Next.tmTheme", |
| 37 | + "theme": "Oceanic Next.sublime-theme" |
| 38 | +} |
9 | 39 | ``` |
10 | 40 |
|
11 | | -## Developing |
| 41 | +Code expander |
| 42 | +- Examples: |
| 43 | + - `div.cool-class` becomes `<div className="cool-class"></div>` |
| 44 | + - `a` becomes `<a href=""></a>` |
| 45 | +- Install [Emmet](https://github.com/sergeche/emmet-sublime) via Sublime Text package manager |
| 46 | +- Configure Emmet to work with React, e.g. classes expand to `className` instead of `class` |
| 47 | +- Follow the instructions under [Get Emmet working](http://www.nitinh.com/2015/02/setting-sublime-text-react-jsx-development/) |
| 48 | + - **Note:** Add the last snippet of code to `reg_replace.sublime-settings` by navigating to `Sublime Text -> Preferences -> Package Settings -> Reg Replace -> Settings-User` |
| 49 | + |
| 50 | +JavaScript linting |
| 51 | +- `npm run lint` will lint your files for you. Please make sure all `.jsx` and `.js` code passes linting, otherwise the Travis build will fail. |
| 52 | + |
| 53 | +Automatic JavaScript linting in Sublime Text |
| 54 | +- Install [SublimeLinter](http://sublimelinter.readthedocs.org/en/latest/installation.html) following the instructions under "Installing via Package Control" |
| 55 | +- Install [SublimeLinter-eslint](https://github.com/roadhump/SublimeLinter-eslint) with the package manager. The package is called `SublimeLinter-contrib-eslint` |
| 56 | + |
| 57 | +## Contributing |
12 | 58 |
|
13 | | -```shell |
14 | | -nvm use |
15 | | -npm install |
16 | | -npm run example |
| 59 | +### Pull Requests |
| 60 | + |
| 61 | +To contribute to the repository, please create a feature branch off of the dev branch. Once you're finished working on the feature, make a pull request to merge it into dev. Please make sure that every pull request has passed the build checks, which appear just before the "Merge pull request" button in github. |
| 62 | + |
| 63 | +### Code Style |
| 64 | + |
| 65 | +JavaScript |
| 66 | + - Please use ES2015 syntax whenever possible |
| 67 | + - Specific rules are enforced via `.eslintrc.json` |
| 68 | + - Run `npm run lint` to check your code against the linter |
| 69 | + |
| 70 | +SCSS Files |
| 71 | + - This repository uses flexbox for arranging content |
| 72 | + - The use of any extra CSS libraries should be discussed with the team |
| 73 | + - Use SCSS syntax, but do not overly nest |
| 74 | + - Use variables, mixins, and classes as much as possible from our [style guide](https://github.com/appirio-tech/styles) |
| 75 | + - When adding media queries, nest them inside the element, rather than creating a new section |
| 76 | + ``` |
| 77 | + .box { |
| 78 | + height: 50px; |
| 79 | + width: 50px; |
| 80 | + @media screen and (min-width: 768px) { |
| 81 | + height: 100px; |
| 82 | + width: 100px; |
| 83 | + } |
| 84 | + |
| 85 | + .inside-box { |
| 86 | + font-size: 14px; |
| 87 | + @media screen and (min-width: 768px) { |
| 88 | + font-size: 18px; |
| 89 | + } |
| 90 | + } |
| 91 | + } |
| 92 | + ``` |
| 93 | + |
| 94 | +## Using the react-components repository in your app |
| 95 | + |
| 96 | +## Install |
| 97 | + |
| 98 | +``` |
| 99 | +npm install appirio-tech-react-components |
17 | 100 | ``` |
0 commit comments