mirror of
https://github.com/wassname/talk.git
synced 2026-07-06 01:25:34 +08:00
position the reporting popup in a more reliable way
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -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 <div className={`${name}-container`}>
|
||||
<button onClick={!this.props.banned ? this.onReportClick : null} className={`${name}-button`}>
|
||||
<button
|
||||
ref={ref => this.flagButton = ref}
|
||||
onClick={!this.props.banned ? this.onReportClick : null}
|
||||
className={`${name}-button`}>
|
||||
{
|
||||
flagged
|
||||
? <span className={`${name}-button-text`}>{lang.t('reported')}</span>
|
||||
@@ -147,7 +156,7 @@ class FlagButton extends Component {
|
||||
</button>
|
||||
{
|
||||
this.state.showMenu &&
|
||||
<div className={`${name}-popup`}>
|
||||
<div className={`${name}-popup`} ref={ref => this.popup = ref}>
|
||||
<PopupMenu>
|
||||
<div className={`${name}-popup-header`}>{popupMenu.header}</div>
|
||||
{
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -2,5 +2,5 @@ import React from 'react';
|
||||
import styles from './PopupMenu.css';
|
||||
|
||||
export default ({children}) => (
|
||||
<span className={styles.popupMenu}>{children}</span>
|
||||
<div className={styles.popupMenu}>{children}</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user