* Add widgets and interactive dialogs * Update snapshots * Updates per feedback and fix slash command * Fix style * Update styling * Updates per feedback * Updates per feedback * More styling changes * Remove extra space above message menu
57 lines
No EOL
1.5 KiB
JavaScript
57 lines
No EOL
1.5 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import React, {PureComponent} from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import AutocompleteSelector from 'app/components/autocomplete_selector';
|
|
|
|
export default class ActionMenu extends PureComponent {
|
|
static propTypes = {
|
|
actions: PropTypes.shape({
|
|
selectAttachmentMenuAction: PropTypes.func.isRequired,
|
|
}).isRequired,
|
|
id: PropTypes.string.isRequired,
|
|
name: PropTypes.string.isRequired,
|
|
dataSource: PropTypes.string,
|
|
options: PropTypes.arrayOf(PropTypes.object),
|
|
postId: PropTypes.string.isRequired,
|
|
selected: PropTypes.object,
|
|
navigator: PropTypes.object,
|
|
};
|
|
|
|
handleSelect = (selected) => {
|
|
if (!selected) {
|
|
return;
|
|
}
|
|
|
|
const {
|
|
actions,
|
|
id,
|
|
postId,
|
|
} = this.props;
|
|
|
|
actions.selectAttachmentMenuAction(postId, id, selected.text, selected.value);
|
|
};
|
|
|
|
render() {
|
|
const {
|
|
name,
|
|
dataSource,
|
|
selected,
|
|
options,
|
|
navigator,
|
|
} = this.props;
|
|
|
|
return (
|
|
<AutocompleteSelector
|
|
placeholder={name}
|
|
dataSource={dataSource}
|
|
options={options}
|
|
selected={selected}
|
|
navigator={navigator}
|
|
onSelected={this.handleSelect}
|
|
/>
|
|
);
|
|
}
|
|
} |