2016-12-04 01:35:28 +00:00
|
|
|
# MyEtherWallet
|
|
|
|
MyEtherWallet (v4+)
|
2017-04-12 05:06:09 +00:00
|
|
|
|
|
|
|
#### Run:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npm run dev # run app in dev mode
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Build:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npm run build # build app
|
|
|
|
```
|
|
|
|
|
|
|
|
It generates app in `dist` folder.
|
|
|
|
|
|
|
|
#### Test:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npm run test # run tests with Jest
|
|
|
|
```
|
|
|
|
|
|
|
|
## Folder structure:
|
|
|
|
|
|
|
|
```
|
2017-04-12 05:09:28 +00:00
|
|
|
│
|
2017-04-12 05:06:09 +00:00
|
|
|
├── common - Your App
|
2017-04-27 03:59:16 +00:00
|
|
|
│ ├── actions - application actions
|
2017-04-12 05:06:09 +00:00
|
|
|
│ ├── api - Services and XHR utils(also custom form validation, see InputComponent from components/common)
|
|
|
|
│ ├── components - components according to "Redux philosophy"
|
|
|
|
│ ├── config - frontend config depending on REACT_WEBPACK_ENV
|
|
|
|
│ ├── containers - containers according to "Redux philosophy"
|
|
|
|
│ ├── reducers - application reducers
|
|
|
|
│ ├── routing - application routing
|
|
|
|
│ ├── index.jsx - entry
|
|
|
|
│ ├── index.html
|
2017-04-12 22:38:25 +00:00
|
|
|
├── static
|
2017-04-12 05:06:09 +00:00
|
|
|
├── webpack_config - Webpack configuration
|
|
|
|
├── jest_config - Jest configuration
|
2017-04-27 03:59:16 +00:00
|
|
|
```
|
2017-07-11 03:03:08 +00:00
|
|
|
|
|
|
|
## Docker setup
|
|
|
|
You should already have docker and docker-compose setup for your platform as a pre-req.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
docker-compose up
|
|
|
|
```
|
2017-07-15 04:16:36 +00:00
|
|
|
|
|
|
|
## Style Guides and Philosophies
|
|
|
|
|
|
|
|
The following are guides for developers to follow for writing compliant code.
|
|
|
|
|
|
|
|
### Styling
|
|
|
|
|
|
|
|
Legacy styles are housed under `common/assets/styles` and written with LESS.
|
|
|
|
However, going forward, each styled component should create a a `.scss` file of
|
|
|
|
the same name in the same folder, and import it like so:
|
|
|
|
|
|
|
|
```js
|
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
import "./MyComponent.scss";
|
|
|
|
|
|
|
|
export default class MyComponent extends React.component {
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div className="MyComponent">
|
|
|
|
<div className="MyComponent-child">Hello!</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
These style modules adhere to [SuitCSS naming convention](https://github.com/suitcss/suit/blob/master/doc/naming-conventions.md):
|
|
|
|
|
|
|
|
```scss
|
|
|
|
.MyComponent {
|
|
|
|
/* Styles */
|
|
|
|
|
|
|
|
&-child {
|
|
|
|
/* Styles */
|
|
|
|
|
|
|
|
&.is-hidden {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
All elements inside of a component should extend its parent class namespace, or
|
|
|
|
create a new namespace (Potentially breaking that out into its own component.)
|
|
|
|
|
|
|
|
Variables and mixins can be imported from the files in `common/styles`:
|
|
|
|
|
|
|
|
```scss
|
|
|
|
@import "sass/colors";
|
|
|
|
|
|
|
|
code {
|
|
|
|
color: $code-color;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Converting Styles
|
|
|
|
|
|
|
|
When working on a module that has styling in Less, try to do the following:
|
|
|
|
|
|
|
|
* Screenshot the component in question
|
|
|
|
* Create a new SCSS file in the same directory
|
|
|
|
* Remove styling from LESS file, convert it to the SCSS file (Mostly s/@/$)
|
|
|
|
* Convert class names to SuitCSS naming convention
|
|
|
|
* Convert any utility classes from `etherewallet-utilities.less` into mixins
|
|
|
|
* Convert as many element selectors to class name selectors as possible
|
|
|
|
* Convert as many `<br/>` tags or ` `s to margins
|
|
|
|
* Ensure that there has been little to no deviation from screenshot
|