flex-template-web/src/components/UserNav/UserNav.js
2017-10-11 14:18:30 +03:00

57 lines
1.5 KiB
JavaScript

import React, { PropTypes } from 'react';
import { FormattedMessage } from 'react-intl';
import classNames from 'classnames';
import { ACCOUNT_SETTINGS_PAGES } from '../../routeConfiguration';
import { TabNavHorizontal } from '../../components';
import css from './UserNav.css';
const UserNav = props => {
const { className, rootClassName, selectedPageName } = props;
const classes = classNames(rootClassName || css.root, className);
const tabs = [
{
text: <FormattedMessage id="ManageListingsPage.yourListings" />,
selected: selectedPageName === 'ManageListingsPage',
linkProps: {
name: 'ManageListingsPage',
},
},
{
text: <FormattedMessage id="ManageListingsPage.profileSettings" />,
selected: selectedPageName === 'ProfileSettingsPage',
disabled: false,
linkProps: {
name: 'ProfileSettingsPage',
},
},
{
text: <FormattedMessage id="ManageListingsPage.accountSettings" />,
selected: ACCOUNT_SETTINGS_PAGES.includes(selectedPageName),
disabled: false,
linkProps: {
name: 'ContactDetailsPage',
},
},
];
return (
<TabNavHorizontal className={classes} tabRootClassName={css.tab} tabs={tabs} skin="dark" />
);
};
UserNav.defaultProps = {
className: null,
rootClassName: null,
};
const { string } = PropTypes;
UserNav.propTypes = {
className: string,
rootClassName: string,
selectedPageName: string.isRequired,
};
export default UserNav;