diff --git a/src/components/accounts/AccountSwitcher.jsx b/src/components/accounts/AccountSwitcher.jsx
new file mode 100644
index 0000000..e6b3b98
--- /dev/null
+++ b/src/components/accounts/AccountSwitcher.jsx
@@ -0,0 +1,77 @@
+import React, { Component, PropTypes } from 'react';
+
+import styles from './accountSwitcher.scss';
+
+const accounts = {
+ active: {id: 7, username: 'SleepWalker', email: 'danilenkos@auroraglobal.com'},
+ available: [
+ {id: 7, username: 'SleepWalker', email: 'danilenkos@auroraglobal.com'},
+ {id: 8, username: 'ErickSkrauch', email: 'erick@foo.bar'},
+ {id: 9, username: 'Ely-en', email: 'ely@-enfoo.bar'},
+ {id: 10, username: 'Ely-by', email: 'ely-by@foo.bar'},
+ ]
+};
+
+export default class AccountSwitcher extends Component {
+ render() {
+ return (
+
+
+ {accounts.available.map((account) => (
+
+
+
+
+ {account.username}
+
+
+ {account.email}
+
+
+
+
+ ))}
+
+
+ +
+ Добавить аккаунт
+
+
+
+ );
+ }
+}
+
+/*
+import { intlShape } from 'react-intl';
+
+import messages from './LoggedInPanel.intl.json';
+
+
+ static contextTypes = {
+ intl: intlShape.isRequired
+ };
+
+ */
diff --git a/src/components/accounts/accountSwitcher.scss b/src/components/accounts/accountSwitcher.scss
new file mode 100644
index 0000000..b408d2d
--- /dev/null
+++ b/src/components/accounts/accountSwitcher.scss
@@ -0,0 +1,10 @@
+.accountSwitcher {
+ background: #fff;
+ color: #444;
+}
+
+.logoutIcon {
+ composes: exit from 'components/ui/icons.scss';
+
+ color: #cdcdcd;
+}
diff --git a/src/components/accounts/index.js b/src/components/accounts/index.js
new file mode 100644
index 0000000..d74b7fa
--- /dev/null
+++ b/src/components/accounts/index.js
@@ -0,0 +1 @@
+export AccountSwitcher from './AccountSwitcher';
diff --git a/src/components/ui/button-groups.scss b/src/components/ui/button-groups.scss
index 1e526c2..00f88cb 100644
--- a/src/components/ui/button-groups.scss
+++ b/src/components/ui/button-groups.scss
@@ -3,6 +3,9 @@
}
.item {
+ // TODO: in some cases we do not need overflow hidden
+ // probably, it is better to create a separate class for children, that will
+ // enable overflow hidden and ellipsis
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
diff --git a/src/components/userbar/LoggedInPanel.js b/src/components/userbar/LoggedInPanel.js
deleted file mode 100644
index 8d9802d..0000000
--- a/src/components/userbar/LoggedInPanel.js
+++ /dev/null
@@ -1,51 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-import classNames from 'classnames';
-import { Link } from 'react-router';
-import { intlShape } from 'react-intl';
-
-import buttons from 'components/ui/buttons.scss';
-import buttonGroups from 'components/ui/button-groups.scss';
-
-import messages from './LoggedInPanel.intl.json';
-import styles from './loggedInPanel.scss';
-
-import { userShape } from 'components/user/User';
-
-export default class LoggedInPanel extends Component {
- static displayName = 'LoggedInPanel';
- static propTypes = {
- user: userShape,
- onLogout: PropTypes.func.isRequired
- };
-
- static contextTypes = {
- intl: intlShape.isRequired
- };
-
- render() {
- const { user } = this.props;
-
- return (
-
-
-
- {user.username}
-
-
-
- );
- }
-
- onLogout = (event) => {
- event.preventDefault();
-
- this.props.onLogout();
- };
-}
diff --git a/src/components/userbar/LoggedInPanel.jsx b/src/components/userbar/LoggedInPanel.jsx
new file mode 100644
index 0000000..4f7fb39
--- /dev/null
+++ b/src/components/userbar/LoggedInPanel.jsx
@@ -0,0 +1,43 @@
+import React, { Component, PropTypes } from 'react';
+
+import classNames from 'classnames';
+
+import buttons from 'components/ui/buttons.scss';
+import { AccountSwitcher } from 'components/accounts';
+
+import styles from './loggedInPanel.scss';
+
+import { userShape } from 'components/user/User';
+
+export default class LoggedInPanel extends Component {
+ static displayName = 'LoggedInPanel';
+ static propTypes = {
+ user: userShape,
+ onLogout: PropTypes.func.isRequired
+ };
+
+ render() {
+ const { user } = this.props;
+
+ return (
+
+ {/* this button must be a div, because some browsers force overflow hidden on button elements */}
+
+
+
{user.username}
+
+
+
+
+
+ );
+ }
+
+ onLogout = (event) => {
+ event.preventDefault();
+
+ this.props.onLogout();
+ };
+}
diff --git a/src/components/userbar/loggedInPanel.scss b/src/components/userbar/loggedInPanel.scss
index 631a0ad..37f9d77 100644
--- a/src/components/userbar/loggedInPanel.scss
+++ b/src/components/userbar/loggedInPanel.scss
@@ -1,5 +1,14 @@
.loggedInPanel {
- justify-content: flex-end;
+}
+
+.activeAccount {
+ position: relative;
+
+ &:hover {
+ .accountSwitcherContainer {
+ display: block;
+ }
+ }
}
.userIcon {
@@ -11,12 +20,22 @@
padding-right: 5px;
}
+.expandIcon {
+ composes: arrow from 'components/ui/icons.scss';
+
+ margin-left: 5px;
+ font-size: 12px;
+}
+
.userName {
}
-.logoutIcon {
- composes: exit from 'components/ui/icons.scss';
+.accountSwitcherContainer {
+ position: absolute;
+ top: 100%;
+ right: 0;
+ cursor: auto;
- color: #cdcdcd;
+ display: none;
}