mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* Updating client dependancies. Switching to using yarn. * Updating React * Moving pure components to using function syntax (performance gains with newer react version) * Updating client dependancies. * Ignore .yarninstall * Enabling pre-lockfile because it's the entire point of using yarn. * Removing old webpack config * Moving to new prop-types * Fixing ESLint Errors * Updating jest snapshots. * Cleaning up package.json
60 lines
1.6 KiB
JavaScript
60 lines
1.6 KiB
JavaScript
import PropTypes from 'prop-types';
|
|
|
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
import React, {Component} from 'react';
|
|
import {Dropdown} from 'react-bootstrap';
|
|
|
|
import RhsDropdownButton from 'components/rhs_dropdown_button.jsx';
|
|
import RhsDropdownMenu from 'components/rhs_dropdown_menu.jsx';
|
|
|
|
import * as Agent from 'utils/user_agent.jsx';
|
|
|
|
export default class RhsDropdown extends Component {
|
|
static propTypes = {
|
|
dropdownContents: PropTypes.array.isRequired
|
|
}
|
|
|
|
constructor(props) {
|
|
super(props);
|
|
|
|
this.state = {
|
|
showDropdown: false
|
|
};
|
|
}
|
|
|
|
toggleDropdown = () => {
|
|
const showDropdown = !this.state.showDropdown;
|
|
if (Agent.isMobile() || Agent.isMobileApp()) {
|
|
const scroll = document.querySelector('.scrollbar--view');
|
|
if (showDropdown) {
|
|
scroll.style.overflow = 'hidden';
|
|
} else {
|
|
scroll.style.overflow = 'scroll';
|
|
}
|
|
}
|
|
|
|
this.setState({showDropdown});
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<Dropdown
|
|
id='rhs_dropdown'
|
|
open={this.state.showDropdown}
|
|
onToggle={this.toggleDropdown}
|
|
>
|
|
<RhsDropdownButton
|
|
bsRole='toggle'
|
|
onClick={this.toggleDropdown}
|
|
/>
|
|
<RhsDropdownMenu>
|
|
{this.props.dropdownContents}
|
|
</RhsDropdownMenu>
|
|
</Dropdown>
|
|
);
|
|
}
|
|
}
|
|
|