diff --git a/client/coral-embed-stream/style/default.css b/client/coral-embed-stream/style/default.css index 087859e89..d1afed204 100644 --- a/client/coral-embed-stream/style/default.css +++ b/client/coral-embed-stream/style/default.css @@ -352,17 +352,6 @@ button.comment__action-button[disabled], /* Flag Styles */ -.coral-plugin-flags-container { - position: relative; -} - -.coral-plugin-flags-popup span { - min-width: 280px; - bottom: 36px; - position: absolute; - right: 10px; -} - .coral-plugin-flags-popup-form { margin-bottom: 10px; } @@ -399,6 +388,7 @@ button.comment__action-button[disabled], margin-top: 5px; width: 75%; font-size: 16px; + border: 1px solid #ccc; } /* Close comments */ diff --git a/client/coral-plugin-flags/FlagButton.js b/client/coral-plugin-flags/FlagButton.js index 16e616379..e5daf72c9 100644 --- a/client/coral-plugin-flags/FlagButton.js +++ b/client/coral-plugin-flags/FlagButton.js @@ -19,6 +19,12 @@ class FlagButton extends Component { localDelete: false } + componentDidUpdate () { + if (this.popup) { // this will be defined when the reporting popup is opened + this.popup.firstChild.style.top = `${this.flagButton.offsetTop - this.popup.firstChild.clientHeight - 15}px`; + } + } + // When the "report" button is clicked expand the menu onReportClick = () => { const {currentUser, deleteAction, flaggedByCurrentUser, flag} = this.props; @@ -135,7 +141,10 @@ class FlagButton extends Component { const popupMenu = getPopupMenu[this.state.step](this.state.itemType); return
- { this.state.showMenu && -
+
this.popup = ref}>
{popupMenu.header}
{ diff --git a/client/coral-ui/components/PopupMenu.css b/client/coral-ui/components/PopupMenu.css index fe57ba8b2..e7e6416e9 100644 --- a/client/coral-ui/components/PopupMenu.css +++ b/client/coral-ui/components/PopupMenu.css @@ -1,6 +1,7 @@ .popupMenu { - display: inline-block; - width: inherit; + display: block; + position: absolute; + width: 100%; border: solid 1px #999; box-shadow: 3px 3px 5px 0 rgba(0, 0, 0, 0.3); box-sizing: border-box; @@ -8,6 +9,7 @@ border-radius: 3px; padding: 20px 10px; z-index: 3; + left: 0; } .popupMenu:before{ diff --git a/client/coral-ui/components/PopupMenu.js b/client/coral-ui/components/PopupMenu.js index dfc81c3a1..6d4381ffe 100644 --- a/client/coral-ui/components/PopupMenu.js +++ b/client/coral-ui/components/PopupMenu.js @@ -2,5 +2,5 @@ import React from 'react'; import styles from './PopupMenu.css'; export default ({children}) => ( - {children} +
{children}
);