From ca6e839ca465bb90bdf51f8097eb5b76a4d54a46 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Sun, 3 Dec 2017 16:19:59 -0300 Subject: [PATCH] UserInfoTooltip, styling and func --- .../src/components/ActionsMenu.css | 3 +- .../coral-admin/src/components/UserDetail.css | 1 + .../coral-admin/src/components/UserDetail.js | 5 +- .../src/components/UserInfoTooltip.css | 65 ++++++++++++++ .../src/components/UserInfoTooltip.js | 88 +++++++++++++++++++ 5 files changed, 159 insertions(+), 3 deletions(-) create mode 100644 client/coral-admin/src/components/UserInfoTooltip.css create mode 100644 client/coral-admin/src/components/UserInfoTooltip.js diff --git a/client/coral-admin/src/components/ActionsMenu.css b/client/coral-admin/src/components/ActionsMenu.css index cd127790f..5d263ca21 100644 --- a/client/coral-admin/src/components/ActionsMenu.css +++ b/client/coral-admin/src/components/ActionsMenu.css @@ -6,7 +6,6 @@ .root { color: black; - vertical-align: super; > :global(.mdl-menu__container) { margin-left: 10px; } @@ -22,7 +21,7 @@ .arrowIcon { margin-left: 6px; margin-right: 0; - vertical-align: middle; + vertical-align: middle; margin-right: 0; font-size: 14px; } diff --git a/client/coral-admin/src/components/UserDetail.css b/client/coral-admin/src/components/UserDetail.css index 01252b60c..d7bf541da 100644 --- a/client/coral-admin/src/components/UserDetail.css +++ b/client/coral-admin/src/components/UserDetail.css @@ -167,6 +167,7 @@ .username { display: inline-block; + vertical-align: middle; } .actionsMenu { diff --git a/client/coral-admin/src/components/UserDetail.js b/client/coral-admin/src/components/UserDetail.js index 3344d6720..5bf47c760 100644 --- a/client/coral-admin/src/components/UserDetail.js +++ b/client/coral-admin/src/components/UserDetail.js @@ -15,7 +15,8 @@ import RejectButton from './RejectButton'; import {getErrorMessages} from 'coral-framework/utils'; import ActionsMenu from 'coral-admin/src/components/ActionsMenu'; import ActionsMenuItem from 'coral-admin/src/components/ActionsMenuItem'; - +import UserInfoTooltip from './UserInfoTooltip'; + class UserDetail extends React.Component { rejectThenReload = async (info) => { @@ -156,6 +157,8 @@ class UserDetail extends React.Component { } + {user.status !== 'ACTIVE' && } +
  • diff --git a/client/coral-admin/src/components/UserInfoTooltip.css b/client/coral-admin/src/components/UserInfoTooltip.css new file mode 100644 index 000000000..5814d2f82 --- /dev/null +++ b/client/coral-admin/src/components/UserInfoTooltip.css @@ -0,0 +1,65 @@ +.userInfo { + position: relative; + display: inline-block; +} + +.icon { + font-size: 16px; + color: #616161; + -ms-user-select:none; + -moz-user-select: none; + -webkit-user-select: none; + -webkit-touch-callout:none; + user-select: none; + -webkit-tap-highlight-color:rgba(0,0,0,0); +} + +.icon:hover { + cursor: pointer; +} + +.menu { + background-color: white; + border: solid 1px #999; + border-radius: 3px; + padding: 10px; + position: absolute; + -webkit-box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 1px 5px 0 rgba(0,0,0,0.12), 0 3px 1px -2px rgba(0,0,0,0.2); + box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 1px 5px 0 rgba(0,0,0,0.12), 0 3px 1px -2px rgba(0,0,0,0.2); + z-index: 10; + top: 32px; + right: 0px; + width: 140px; + text-align: left; + color: #616161; +} + +.menu::before{ + content: ''; + border: 10px solid transparent; + border-top-color: #999; + position: absolute; + right: 0px; + top: -20px; + transform: rotate(180deg); +} + +.menu::after{ + content: ''; + border: 10px solid transparent; + border-top-color: white; + position: absolute; + right: 0px; + top: -19px; + transform: rotate(180deg); +} + +.descriptionList { + padding: 0; + margin: 0; + list-style: none; +} + +.descriptionItem { + font-size: 0.9em; +} \ No newline at end of file diff --git a/client/coral-admin/src/components/UserInfoTooltip.js b/client/coral-admin/src/components/UserInfoTooltip.js new file mode 100644 index 000000000..a750f2c8e --- /dev/null +++ b/client/coral-admin/src/components/UserInfoTooltip.js @@ -0,0 +1,88 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import cn from 'classnames'; +import {Icon} from 'coral-ui'; +import styles from './UserInfoTooltip.css'; +import ClickOutside from 'coral-framework/components/ClickOutside'; + +const initialState = {menuVisible: false}; + +class UserInfoTooltip extends React.Component { + state = initialState; + + toogleMenu = () => { + this.setState({menuVisible: !this.state.menuVisible}); + } + + hideMenu = () => { + this.setState({menuVisible: false}); + } + + render() { + const {menuVisible} = this.state; + const {user} = this.props; + + return ( + +
    + + + + + {menuVisible && ( +
    + { + user.status === 'BANNED' && ( +
    +
      +
    • + Banned On + +
    • +
    • + By + +
    • +
    +
    + ) + } + + { + user.status === 'SUSPENDED' && ( +
    +
      +
    • + Suspension + +
    • +
    • + By + +
    • +
    • + Start + +
    • +
    • + End + +
    • +
    +
    + ) + } + +
    + )} +
    +
    + ); + } +} + +UserInfoTooltip.propTypes = { + user: PropTypes.object, +}; + +export default UserInfoTooltip; \ No newline at end of file