mirror of
https://github.com/wassname/talk.git
synced 2026-07-02 04:09:03 +08:00
Adding missing proptypes and ellipsis
This commit is contained in:
@@ -5,6 +5,7 @@ import Table from '../containers/Table';
|
||||
import {Pager, Icon} from 'coral-ui';
|
||||
import EmptyCard from '../../../components/EmptyCard';
|
||||
import t from 'coral-framework/services/i18n';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const tableHeaders = [
|
||||
{
|
||||
@@ -62,4 +63,12 @@ const People = ({commenters, searchValue, onSearchChange, ...props}) => {
|
||||
);
|
||||
};
|
||||
|
||||
People.propTypes = {
|
||||
commenters: PropTypes.array,
|
||||
searchValue: PropTypes.string,
|
||||
onSearchChange: PropTypes.func,
|
||||
totalPages: PropTypes.number,
|
||||
onNewPageHandler: PropTypes.func,
|
||||
};
|
||||
|
||||
export default People;
|
||||
|
||||
@@ -19,6 +19,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
.username, .email {
|
||||
max-width: 215px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.email {
|
||||
display: block;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ import React from 'react';
|
||||
import {SelectField, Option} from 'react-mdl-selectfield';
|
||||
import styles from '../components/Table.css';
|
||||
import t from 'coral-framework/services/i18n';
|
||||
import PropTypes from 'prop-types';
|
||||
import cn from 'classnames';
|
||||
|
||||
export default ({headers, commenters, onHeaderClickHandler, onRoleChange, onCommenterStatusChange, viewUserDetail}) => (
|
||||
const Table = ({headers, commenters, onHeaderClickHandler, onRoleChange, onCommenterStatusChange, viewUserDetail}) => (
|
||||
<table className={`mdl-data-table ${styles.dataTable}`}>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -21,7 +23,7 @@ export default ({headers, commenters, onHeaderClickHandler, onRoleChange, onComm
|
||||
{commenters.map((row, i)=> (
|
||||
<tr key={i}>
|
||||
<td className="mdl-data-table__cell--non-numeric">
|
||||
<button onClick={() => {viewUserDetail(row.id);}} className={styles.button}>{row.username}</button>
|
||||
<button onClick={() => {viewUserDetail(row.id);}} className={cn(styles.username, styles.button)}>{row.username}</button>
|
||||
<span className={styles.email}>{row.profiles.map(({id}) => id)}</span>
|
||||
</td>
|
||||
<td className="mdl-data-table__cell--non-numeric">
|
||||
@@ -54,3 +56,14 @@ export default ({headers, commenters, onHeaderClickHandler, onRoleChange, onComm
|
||||
</tbody>
|
||||
</table>
|
||||
);
|
||||
|
||||
Table.propTypes = {
|
||||
headers: PropTypes.array,
|
||||
commenters: PropTypes.array,
|
||||
onHeaderClickHandler: PropTypes.func,
|
||||
onRoleChange: PropTypes.func,
|
||||
onCommenterStatusChange: PropTypes.func,
|
||||
viewUserDetail: PropTypes.func,
|
||||
};
|
||||
|
||||
export default Table;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import React, {Component} from 'react';
|
||||
import {connect} from 'react-redux';
|
||||
import {bindActionCreators} from 'redux';
|
||||
import {compose} from 'react-apollo';
|
||||
import {setRole, setCommenterStatus} from '../../../actions/community';
|
||||
import Table from '../components/Table';
|
||||
import {viewUserDetail} from '../../../actions/userDetail';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
class TableContainer extends Component {
|
||||
|
||||
@@ -22,6 +22,12 @@ class TableContainer extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
TableContainer.propTypes = {
|
||||
setRole: PropTypes.func,
|
||||
setCommenterStatus: PropTypes.func,
|
||||
commenters: PropTypes.array,
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => ({
|
||||
commenters: state.community.accounts,
|
||||
});
|
||||
@@ -33,7 +39,5 @@ const mapDispatchToProps = (dispatch) =>
|
||||
viewUserDetail,
|
||||
}, dispatch);
|
||||
|
||||
export default compose(
|
||||
connect(mapStateToProps, mapDispatchToProps),
|
||||
)(TableContainer);
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(TableContainer);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user