diff options
Diffstat (limited to 'src/components/ui/Link.js')
-rw-r--r-- | src/components/ui/Link.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/components/ui/Link.js b/src/components/ui/Link.js index 003211e5c..94db3f842 100644 --- a/src/components/ui/Link.js +++ b/src/components/ui/Link.js | |||
@@ -9,7 +9,9 @@ import { matchRoute } from '../../helpers/routing-helpers'; | |||
9 | import { openExternalUrl } from '../../helpers/url-helpers'; | 9 | import { openExternalUrl } from '../../helpers/url-helpers'; |
10 | 10 | ||
11 | // TODO: create container component for this component | 11 | // TODO: create container component for this component |
12 | export default @inject('stores') @observer class Link extends Component { | 12 | @inject('stores') |
13 | @observer | ||
14 | class Link extends Component { | ||
13 | onClick(e) { | 15 | onClick(e) { |
14 | if (this.props.disabled) { | 16 | if (this.props.disabled) { |
15 | e.preventDefault(); | 17 | e.preventDefault(); |
@@ -50,7 +52,7 @@ export default @inject('stores') @observer class Link extends Component { | |||
50 | href={router.history.createHref(to)} | 52 | href={router.history.createHref(to)} |
51 | className={linkClasses} | 53 | className={linkClasses} |
52 | style={style} | 54 | style={style} |
53 | onClick={(e) => this.onClick(e)} | 55 | onClick={e => this.onClick(e)} |
54 | > | 56 | > |
55 | {children} | 57 | {children} |
56 | </a> | 58 | </a> |
@@ -62,10 +64,8 @@ Link.wrappedComponent.propTypes = { | |||
62 | stores: PropTypes.shape({ | 64 | stores: PropTypes.shape({ |
63 | router: PropTypes.instanceOf(RouterStore).isRequired, | 65 | router: PropTypes.instanceOf(RouterStore).isRequired, |
64 | }).isRequired, | 66 | }).isRequired, |
65 | children: PropTypes.oneOfType([ | 67 | children: PropTypes.oneOfType([oneOrManyChildElements, PropTypes.string]) |
66 | oneOrManyChildElements, | 68 | .isRequired, |
67 | PropTypes.string, | ||
68 | ]).isRequired, | ||
69 | to: PropTypes.string.isRequired, | 69 | to: PropTypes.string.isRequired, |
70 | className: PropTypes.string, | 70 | className: PropTypes.string, |
71 | activeClassName: PropTypes.string, | 71 | activeClassName: PropTypes.string, |
@@ -83,3 +83,5 @@ Link.wrappedComponent.defaultProps = { | |||
83 | target: '', | 83 | target: '', |
84 | style: {}, | 84 | style: {}, |
85 | }; | 85 | }; |
86 | |||
87 | export default Link; | ||