From c902f7db1f670f8c82f56134e8b39d2a22e92279 Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Wed, 13 Dec 2017 18:11:17 +0100 Subject: [PATCH] Added user avatar, name, email and action logout. Modified Header, HeaderStyles, Menu, SubPanel and Content components (styles and logics), removed unused messages. Work in Progress --- src/components/Img/index.js | 10 --- src/containers/Preferences/Content.js | 6 +- src/containers/Preferences/Header.js | 56 +++++++++++++--- src/containers/Preferences/HeaderStyles.js | 77 ++++++++++++++++++++-- src/containers/Preferences/Menu.js | 11 ++-- src/containers/Preferences/Settings.js | 39 +++++++++-- src/containers/Preferences/SubPanel.js | 71 ++++++++++++-------- src/containers/Preferences/messages.js | 46 +------------ src/index.js | 2 +- src/reducers/auth.js | 11 +--- webpack.common.js | 4 -- 11 files changed, 205 insertions(+), 128 deletions(-) diff --git a/src/components/Img/index.js b/src/components/Img/index.js index 6e76d72..fb6d645 100644 --- a/src/components/Img/index.js +++ b/src/components/Img/index.js @@ -1,14 +1,4 @@ -import React from 'react' import glamorous from 'glamorous' -import RaisedButton from 'material-ui/RaisedButton' - -const radiusMap = { - topLeft: 'borderTopLeftRadius', - topRight: 'borderTopRightRadius', - bottomRight: 'borderBottomRightRadius', - bottomLeft: 'borderBottomLeftRadius', - all: 'borderRadius' -} const Img = glamorous.div({ backgroundRepeat: 'no-repeat', diff --git a/src/containers/Preferences/Content.js b/src/containers/Preferences/Content.js index ed71775..e233220 100644 --- a/src/containers/Preferences/Content.js +++ b/src/containers/Preferences/Content.js @@ -31,8 +31,8 @@ const rightIconMenu = func => ( ) -const Content = ({ showQuotes, quotes, backgrounds, onDelete }) => ( - showQuotes ? ( +const Content = ({ show, quotes, backgrounds, onDelete }) => ( + show === 'quotes' ? ( @@ -80,7 +80,7 @@ const Content = ({ showQuotes, quotes, backgrounds, onDelete }) => ( ) Content.propTypes = { - showQuotes: PropTypes.bool.isRequired, + show: PropTypes.string.isRequired, backgrounds: PropTypes.array.isRequired, onDelete: PropTypes.func.isRequired, quotes: PropTypes.array.isRequired diff --git a/src/containers/Preferences/Header.js b/src/containers/Preferences/Header.js index 574fb8f..6d64d59 100644 --- a/src/containers/Preferences/Header.js +++ b/src/containers/Preferences/Header.js @@ -3,32 +3,68 @@ import { FormattedMessage } from 'react-intl' import PropTypes from 'prop-types' import { GridList } from 'material-ui/GridList' import ContentAdd from 'material-ui/svg-icons/content/add' +import Avatar from 'material-ui/Avatar' import Button from 'components/Button' -import { GridItem, Title } from './HeaderStyles' +import { Add as AddQuote } from 'containers/Quote/Add' +import { Add as AddBackground } from 'containers/Background/Add' +import { Account, GridItem, Title, User, Info, Action } from './HeaderStyles' import messages from './messages' -const Header = ({ showQuotes }) => { - const currentlyShowing = - - return ( +const Header = ({ show, user, onLogout, onOpenDialog, openDialog, onAdd }) => ( + show === 'general' ? ( + + + + + +

{user.displayName}

+

{user.email}

+
+
+
+ + + + + +
+ ) : ( - {currentlyShowing} + <FormattedMessage{...messages[`randomQuotes.containers.preferences.${show}`]} />