1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 16:10:26 +00:00
Files
seahub/frontend/src/components/toolbar/common-toolbar.js

48 lines
1.2 KiB
JavaScript
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
import { isPro, gettext, showLogoutIcon } from '../../utils/constants';
import Search from '../search/search';
import SearchByName from '../search/search-by-name';
import Notification from '../common/notification';
import Account from '../common/account';
import Logout from '../common/logout';
const propTypes = {
2018-12-07 10:36:59 +08:00
repoID: PropTypes.string,
repoName: PropTypes.string,
isLibView: PropTypes.bool,
onSearchedClick: PropTypes.func.isRequired,
searchPlaceholder: PropTypes.string
};
class CommonToolbar extends React.Component {
render() {
const { repoID, repoName } = this.props;
return (
<div className="common-toolbar">
2018-11-28 12:41:49 +08:00
{isPro && (
<Search
repoID={repoID}
placeholder={this.props.searchPlaceholder || gettext('Search files')}
onSearchedClick={this.props.onSearchedClick}
2018-11-28 12:41:49 +08:00
/>
)}
{this.props.isLibView && !isPro &&
<SearchByName
repoID={repoID}
repoName={repoName}
/>
}
<Notification />
<Account />
{showLogoutIcon && (<Logout />)}
</div>
);
}
}
CommonToolbar.propTypes = propTypes;
export default CommonToolbar;