From 3f19ccf1b1a6efdcc990cf8a0270ec4ffc0c6e22 Mon Sep 17 00:00:00 2001
From: enahum <nahumhbl@gmail.com>
Date: Mon, 14 Nov 2016 21:35:34 -0300
Subject: PLT-4754 Fix RHS options menu (#4552)

---
 webapp/components/rhs_dropdown.jsx | 61 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 webapp/components/rhs_dropdown.jsx

(limited to 'webapp/components/rhs_dropdown.jsx')

diff --git a/webapp/components/rhs_dropdown.jsx b/webapp/components/rhs_dropdown.jsx
new file mode 100644
index 000000000..c42e8c8e5
--- /dev/null
+++ b/webapp/components/rhs_dropdown.jsx
@@ -0,0 +1,61 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import * as Agent from 'utils/user_agent.jsx';
+import RhsDropdownMenu from 'components/rhs_dropdown_menu.jsx';
+
+import {Dropdown} from 'react-bootstrap';
+import React from 'react';
+
+export default class RhsDropdown extends React.Component {
+    constructor(props) {
+        super(props);
+
+        this.toggleDropdown = this.toggleDropdown.bind(this);
+
+        this.state = {
+            showDropdown: false
+        };
+    }
+
+    toggleDropdown(e) {
+        if (e) {
+            e.preventDefault();
+        }
+
+        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
+                open={this.state.showDropdown}
+                onClose={this.toggleDropdown}
+            >
+                <a
+                    href='#'
+                    className='post__dropdown dropdown-toggle'
+                    bsRole='toggle'
+                    onClick={this.toggleDropdown}
+                />
+                <RhsDropdownMenu>
+                    {this.props.dropdownContents}
+                </RhsDropdownMenu>
+            </Dropdown>
+        );
+    }
+}
+
+RhsDropdown.propTypes = {
+    dropdownContents: React.PropTypes.array.isRequired
+};
-- 
cgit v1.2.3-1-g7c22

