diff options
author | Amine Mouafik <amine@mouafik.fr> | 2019-11-29 19:38:23 +0700 |
---|---|---|
committer | Amine Mouafik <amine@mouafik.fr> | 2019-11-29 19:38:23 +0700 |
commit | 90736a11ffa547ba252acccae3fc9f28c5f471fd (patch) | |
tree | d3ebc3987982977fa4c369860b4340b2bb4166b2 /src/components/ui | |
parent | Review Dark Mode cop/case consistency (diff) | |
download | ferdium-app-90736a11ffa547ba252acccae3fc9f28c5f471fd.tar.gz ferdium-app-90736a11ffa547ba252acccae3fc9f28c5f471fd.tar.zst ferdium-app-90736a11ffa547ba252acccae3fc9f28c5f471fd.zip |
Disable/prevent access to some settings for non-logged users
Diffstat (limited to 'src/components/ui')
-rw-r--r-- | src/components/ui/Link.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/components/ui/Link.js b/src/components/ui/Link.js index 5f729844b..7930d98b4 100644 --- a/src/components/ui/Link.js +++ b/src/components/ui/Link.js | |||
@@ -11,7 +11,8 @@ import { matchRoute } from '../../helpers/routing-helpers'; | |||
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 | export default @inject('stores') @observer class Link extends Component { |
13 | onClick(e) { | 13 | onClick(e) { |
14 | if (this.props.target === '_blank') { | 14 | if (this.props.disabled) e.preventDefault(); |
15 | else if (this.props.target === '_blank') { | ||
15 | e.preventDefault(); | 16 | e.preventDefault(); |
16 | shell.openExternal(this.props.to); | 17 | shell.openExternal(this.props.to); |
17 | } | 18 | } |
@@ -39,6 +40,7 @@ export default @inject('stores') @observer class Link extends Component { | |||
39 | const linkClasses = classnames({ | 40 | const linkClasses = classnames({ |
40 | [`${className}`]: true, | 41 | [`${className}`]: true, |
41 | [`${activeClassName}`]: match, | 42 | [`${activeClassName}`]: match, |
43 | 'is-disabled': this.props.disabled, | ||
42 | }); | 44 | }); |
43 | 45 | ||
44 | return ( | 46 | return ( |
@@ -68,12 +70,14 @@ Link.wrappedComponent.propTypes = { | |||
68 | strictFilter: PropTypes.bool, | 70 | strictFilter: PropTypes.bool, |
69 | target: PropTypes.string, | 71 | target: PropTypes.string, |
70 | style: PropTypes.object, | 72 | style: PropTypes.object, |
73 | disabled: PropTypes.bool, | ||
71 | }; | 74 | }; |
72 | 75 | ||
73 | Link.wrappedComponent.defaultProps = { | 76 | Link.wrappedComponent.defaultProps = { |
74 | className: '', | 77 | className: '', |
75 | activeClassName: '', | 78 | activeClassName: '', |
76 | strictFilter: false, | 79 | strictFilter: false, |
80 | disabled: false, | ||
77 | target: '', | 81 | target: '', |
78 | style: {}, | 82 | style: {}, |
79 | }; | 83 | }; |