diff options
Diffstat (limited to 'webapp/components/suggestion/suggestion.jsx')
-rw-r--r-- | webapp/components/suggestion/suggestion.jsx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/webapp/components/suggestion/suggestion.jsx b/webapp/components/suggestion/suggestion.jsx new file mode 100644 index 000000000..8547d50d0 --- /dev/null +++ b/webapp/components/suggestion/suggestion.jsx @@ -0,0 +1,28 @@ +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import React from 'react'; + +export default class Suggestion extends React.Component { + static get propTypes() { + return { + item: React.PropTypes.object.isRequired, + term: React.PropTypes.string.isRequired, + matchedPretext: React.PropTypes.string.isRequired, + isSelection: React.PropTypes.bool, + onClick: React.PropTypes.func + }; + } + + constructor(props) { + super(props); + + this.handleClick = this.handleClick.bind(this); + } + + handleClick(e) { + e.preventDefault(); + + this.props.onClick(this.props.term, this.props.matchedPretext); + } +}
\ No newline at end of file |