2018-09-19 21:19:11 -05:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2020-03-25 20:20:56 +08:00
|
|
|
import { isPro, gettext, showLogoutIcon } from '../../utils/constants';
|
2018-09-19 21:19:11 -05:00
|
|
|
import Search from '../search/search';
|
|
|
|
import Notification from '../common/notification';
|
|
|
|
import Account from '../common/account';
|
2020-03-25 18:03:04 +08:00
|
|
|
import Logout from '../common/logout';
|
2018-09-19 21:19:11 -05:00
|
|
|
|
|
|
|
const propTypes = {
|
2018-12-07 10:36:59 +08:00
|
|
|
repoID: PropTypes.string,
|
2018-09-25 09:13:06 +08:00
|
|
|
onSearchedClick: PropTypes.func.isRequired,
|
|
|
|
searchPlaceholder: PropTypes.string
|
2018-09-19 21:19:11 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
class CommonToolbar extends React.Component {
|
|
|
|
render() {
|
2018-12-21 16:16:45 +08:00
|
|
|
let searchPlaceholder = this.props.searchPlaceholder || gettext('Search Files');
|
2018-09-19 21:19:11 -05:00
|
|
|
return (
|
|
|
|
<div className="common-toolbar">
|
2018-11-28 12:41:49 +08:00
|
|
|
{isPro && (
|
|
|
|
<Search
|
|
|
|
repoID={this.props.repoID}
|
2018-12-21 16:16:45 +08:00
|
|
|
placeholder={searchPlaceholder}
|
2018-11-28 12:41:49 +08:00
|
|
|
onSearchedClick={this.props.onSearchedClick}
|
|
|
|
/>
|
|
|
|
)}
|
2019-12-31 16:58:45 +08:00
|
|
|
<Notification />
|
2018-09-19 21:19:11 -05:00
|
|
|
<Account />
|
2020-03-25 20:20:56 +08:00
|
|
|
{showLogoutIcon && (<Logout />)}
|
2018-09-19 21:19:11 -05:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CommonToolbar.propTypes = propTypes;
|
|
|
|
|
2019-12-31 16:58:45 +08:00
|
|
|
export default CommonToolbar;
|