diff options
| author | Andrej Mihajlov <and@codeispoetry.ru> | 2017-03-10 19:25:19 +0000 |
|---|---|---|
| committer | Andrej Mihajlov <and@codeispoetry.ru> | 2017-03-10 19:25:19 +0000 |
| commit | d8ea9e952083e6d4d905a13729a9f8525abeb286 (patch) | |
| tree | d26a4c1a0df1b6529ed27dfbbd40c9751bbbc74d /app/components | |
| parent | ab936cc298a81dbf0ef13e53bd03cff7f2324d13 (diff) | |
| download | mullvadvpn-d8ea9e952083e6d4d905a13729a9f8525abeb286.tar.xz mullvadvpn-d8ea9e952083e6d4d905a13729a9f8525abeb286.zip | |
Improve docs coverage. Add external docs for React.Component and Redux.Store
Diffstat (limited to 'app/components')
| -rw-r--r-- | app/components/AccountInput.js | 15 | ||||
| -rw-r--r-- | app/components/CustomScrollbars.js | 15 | ||||
| -rw-r--r-- | app/components/HeaderBar.js | 28 | ||||
| -rw-r--r-- | app/components/Layout.js | 28 |
4 files changed, 84 insertions, 2 deletions
diff --git a/app/components/AccountInput.js b/app/components/AccountInput.js index 5869ae986c..eba498fb95 100644 --- a/app/components/AccountInput.js +++ b/app/components/AccountInput.js @@ -3,12 +3,24 @@ import { formatAccount } from '../lib/formatters'; export default class AccountInput extends Component { + /** + * Prop types + * @static + * + * @memberOf AccountInput + */ static propTypes = { value: PropTypes.string, onEnter: PropTypes.func, onChange: PropTypes.func } + /** + * Creates an instance of AccountInput. + * @param {object} props + * + * @memberOf AccountInput + */ constructor(props) { super(props); @@ -21,6 +33,9 @@ export default class AccountInput extends Component { }; } + /** + * @override + */ componentWillReceiveProps(nextProps) { const nextVal = this.sanitize(nextProps.value); if(nextVal !== this.state.value) { diff --git a/app/components/CustomScrollbars.js b/app/components/CustomScrollbars.js index 2828f14f39..20217923a7 100644 --- a/app/components/CustomScrollbars.js +++ b/app/components/CustomScrollbars.js @@ -1,11 +1,26 @@ import React, { Component, PropTypes } from 'react'; import { Scrollbars } from 'react-custom-scrollbars'; +/** + * Custom scrollbars component + * + * @export + * @class CustomScrollbars + * @extends {Component} + */ export default class CustomScrollbars extends Component { + /** + * PropTypes + * @static + * @memberOf CustomScrollbars + */ static propTypes = { children: PropTypes.element } + /** + * @override + */ render() { return ( <Scrollbars diff --git a/app/components/HeaderBar.js b/app/components/HeaderBar.js index f3dfa88e53..c7ac30d01f 100644 --- a/app/components/HeaderBar.js +++ b/app/components/HeaderBar.js @@ -2,11 +2,34 @@ import React, { Component, PropTypes } from 'react'; import { If, Then } from 'react-if'; import Enum from '../lib/enum'; +/** + * Header bar component + * + * @export + * @class HeaderBar + * @extends {Component} + */ export default class HeaderBar extends Component { - /** Bar style */ + /** + * Bar style + * @type {Style} + * @property {string} default - default + * @property {string} defaultDark - default dark blue + * @property {string} error - red + * @property {string} success - green + * @static + * + * @memberOf HeaderBar + */ static Style = new Enum('default', 'defaultDark', 'error', 'success'); + /** + * Prop types + * @static + * + * @memberOf HeaderBar + */ static propTypes = { style: PropTypes.string, hidden: PropTypes.bool, @@ -14,6 +37,9 @@ export default class HeaderBar extends Component { onSettings: PropTypes.func }; + /** + * @override + */ render() { const style = this.props.style; let containerClass = ['headerbar']; diff --git a/app/components/Layout.js b/app/components/Layout.js index 51215fe489..d996f87580 100644 --- a/app/components/Layout.js +++ b/app/components/Layout.js @@ -10,8 +10,16 @@ import HeaderBar from './HeaderBar'; */ export class Header extends Component { - static Style = HeaderBar.Style + /** + * @type {HeaderBar.Style} + * @static + * @memberOf Header + */ + static Style = HeaderBar.Style; + /** + * @override + */ render() { return ( <div className="layout__header"> @@ -29,10 +37,19 @@ export class Header extends Component { * @extends {Component} */ export class Container extends Component { + + /** + * PropTypes + * @static + * @memberOf Container + */ static propTypes = { children: PropTypes.element.isRequired }; + /** + * @override + */ render() { return ( <div className="layout__container"> @@ -50,6 +67,12 @@ export class Container extends Component { * @extends {Component} */ export class Layout extends Component { + + /** + * PropTypes + * @static + * @memberOf Container + */ static propTypes = { children: PropTypes.oneOfType([ PropTypes.arrayOf(PropTypes.element), @@ -57,6 +80,9 @@ export class Layout extends Component { ]) }; + /** + * @override + */ render() { return ( <div className="layout"> |
