1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-24 04:48:03 +00:00

modify code structure

This commit is contained in:
shanshuirenjia
2018-12-11 08:42:30 +08:00
parent f74d9b983c
commit 197995e34a
7 changed files with 248 additions and 236 deletions

View File

@@ -0,0 +1,49 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import { gettext } from '../../utils/constants';
import WikiListItem from './wiki-list-item';
const contentpropTypes = {
data: PropTypes.object.isRequired,
renameWiki: PropTypes.func.isRequired,
deleteWiki: PropTypes.func.isRequired,
};
class WikiListView extends Component {
render() {
let {loading, errorMsg, wikis} = this.props.data;
if (loading) {
return <span className="loading-icon loading-tip"></span>;
} else if (errorMsg) {
return <p className="error text-center">{errorMsg}</p>;
} else {
return (
<table>
<thead>
<tr>
<th width="50%">{gettext('Name')}</th>
<th width="20%">{gettext('Owner')}</th>
<th width="20%">{gettext('Last Update')}</th>
<th width="10%">{/* operation */}</th>
</tr>
</thead>
<tbody>
{wikis.map((wiki, index) => {
return(
<WikiListItem key={index} wiki={wiki}
renameWiki={this.props.renameWiki}
deleteWiki={this.props.deleteWiki}
/>);
})}
</tbody>
</table>
);
}
}
}
WikiListView.propTypes = contentpropTypes;
export default WikiListView;