PLT-6520 Add RhsDropdownButton component to avoid React-Bootstrap warning (#6405)
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
f13b2ffbe1
Коммит
a84a300947
@@ -1,24 +1,28 @@
|
|||||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See License.txt for license information.
|
// 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 RhsDropdownMenu from 'components/rhs_dropdown_menu.jsx';
|
||||||
|
|
||||||
import {Dropdown} from 'react-bootstrap';
|
import * as Agent from 'utils/user_agent.jsx';
|
||||||
import React from 'react';
|
|
||||||
|
export default class RhsDropdown extends Component {
|
||||||
|
static propTypes = {
|
||||||
|
dropdownContents: PropTypes.array.isRequired
|
||||||
|
}
|
||||||
|
|
||||||
export default class RhsDropdown extends React.Component {
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.toggleDropdown = this.toggleDropdown.bind(this);
|
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
showDropdown: false
|
showDropdown: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleDropdown() {
|
toggleDropdown = () => {
|
||||||
const showDropdown = !this.state.showDropdown;
|
const showDropdown = !this.state.showDropdown;
|
||||||
if (Agent.isMobile() || Agent.isMobileApp()) {
|
if (Agent.isMobile() || Agent.isMobileApp()) {
|
||||||
const scroll = document.querySelector('.scrollbar--view');
|
const scroll = document.querySelector('.scrollbar--view');
|
||||||
@@ -39,9 +43,7 @@ export default class RhsDropdown extends React.Component {
|
|||||||
open={this.state.showDropdown}
|
open={this.state.showDropdown}
|
||||||
onToggle={this.toggleDropdown}
|
onToggle={this.toggleDropdown}
|
||||||
>
|
>
|
||||||
<a
|
<RhsDropdownButton
|
||||||
href='#'
|
|
||||||
className='post__dropdown dropdown-toggle'
|
|
||||||
bsRole='toggle'
|
bsRole='toggle'
|
||||||
onClick={this.toggleDropdown}
|
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
Обычный файл
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}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Ссылка в новой задаче
Block a user