PLT-6520 Add RhsDropdownButton component to avoid React-Bootstrap warning (#6405)

Этот коммит содержится в:
Harrison Healey
2017-05-17 11:26:22 -04:00
коммит произвёл Corey Hulen
родитель f13b2ffbe1
Коммит a84a300947
2 изменённых файлов: 32 добавлений и 13 удалений

Просмотреть файл

@@ -1,24 +1,28 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import * as Agent from 'utils/user_agent.jsx';
import React, {Component, PropTypes} from 'react';
import {Dropdown} from 'react-bootstrap';
import RhsDropdownButton from 'components/rhs_dropdown_button.jsx';
import RhsDropdownMenu from 'components/rhs_dropdown_menu.jsx';
import {Dropdown} from 'react-bootstrap';
import React from 'react';
import * as Agent from 'utils/user_agent.jsx';
export default class RhsDropdown extends Component {
static propTypes = {
dropdownContents: PropTypes.array.isRequired
}
export default class RhsDropdown extends React.Component {
constructor(props) {
super(props);
this.toggleDropdown = this.toggleDropdown.bind(this);
this.state = {
showDropdown: false
};
}
toggleDropdown() {
toggleDropdown = () => {
const showDropdown = !this.state.showDropdown;
if (Agent.isMobile() || Agent.isMobileApp()) {
const scroll = document.querySelector('.scrollbar--view');
@@ -39,9 +43,7 @@ export default class RhsDropdown extends React.Component {
open={this.state.showDropdown}
onToggle={this.toggleDropdown}
>
<a
href='#'
className='post__dropdown dropdown-toggle'
<RhsDropdownButton
bsRole='toggle'
onClick={this.toggleDropdown}
/>
@@ -53,6 +55,3 @@ export default class RhsDropdown extends React.Component {
}
}
RhsDropdown.propTypes = {
dropdownContents: React.PropTypes.array.isRequired
};

20
webapp/components/rhs_dropdown_button.jsx Обычный файл
Просмотреть файл

@@ -0,0 +1,20 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
export default class RhsDropdownButton extends PureComponent {
static propTypes = {
onClick: PropTypes.func.isRequired
}
render() {
return (
<a
href='#'
className='post__dropdown dropdown-toggle'
onClick={this.props.onClick}
/>
);
}
}