ESLint rules
This commit is contained in:
@@ -1,14 +1,8 @@
|
|||||||
define([
|
import React from 'react';
|
||||||
'react',
|
import jQuery from 'jquery';
|
||||||
'jquery',
|
import MailPoet from 'mailpoet';
|
||||||
'mailpoet',
|
|
||||||
],
|
const ListingFilters = React.createClass({
|
||||||
(
|
|
||||||
React,
|
|
||||||
jQuery,
|
|
||||||
MailPoet
|
|
||||||
) => {
|
|
||||||
const ListingFilters = React.createClass({
|
|
||||||
handleFilterAction: function handleFilterAction() {
|
handleFilterAction: function handleFilterAction() {
|
||||||
const filters = {};
|
const filters = {};
|
||||||
this.getAvailableFilters().forEach((filter, i) => {
|
this.getAvailableFilters().forEach((filter, i) => {
|
||||||
@@ -50,13 +44,13 @@ define([
|
|||||||
.map((filter, i) => (
|
.map((filter, i) => (
|
||||||
<select
|
<select
|
||||||
ref={(c) => { this[`filter-${i}`] = c; }}
|
ref={(c) => { this[`filter-${i}`] = c; }}
|
||||||
key={`filter-${i}`}
|
key={`filter-${filter}`}
|
||||||
name={filter}
|
name={filter}
|
||||||
>
|
>
|
||||||
{ filters[filter].map((option, j) => (
|
{ filters[filter].map(option => (
|
||||||
<option
|
<option
|
||||||
value={option.value}
|
value={option.value}
|
||||||
key={`filter-option-${j}`}
|
key={`filter-option-${option.value}`}
|
||||||
>{ option.label }</option>
|
>{ option.label }</option>
|
||||||
)) }
|
)) }
|
||||||
</select>
|
</select>
|
||||||
@@ -96,7 +90,6 @@ define([
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
});
|
|
||||||
|
|
||||||
return ListingFilters;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export default ListingFilters;
|
||||||
|
@@ -1,9 +1,18 @@
|
|||||||
define(['react', 'classnames'], (React, classNames) => {
|
import React from 'react';
|
||||||
const ListingGroups = React.createClass({
|
import classNames from 'classnames';
|
||||||
handleSelect: function handleSelect(group) {
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
class ListingGroups extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.handleSelect = this.handleSelect.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSelect(group) {
|
||||||
return this.props.onSelectGroup(group);
|
return this.props.onSelectGroup(group);
|
||||||
},
|
}
|
||||||
render: function render() {
|
|
||||||
|
render() {
|
||||||
const groups = this.props.groups.map((group, index) => {
|
const groups = this.props.groups.map((group, index) => {
|
||||||
if (group.name === 'trash' && group.count === 0) {
|
if (group.name === 'trash' && group.count === 0) {
|
||||||
return false;
|
return false;
|
||||||
@@ -14,12 +23,12 @@ define(['react', 'classnames'], (React, classNames) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li key={index}>
|
<li key={group.name}>
|
||||||
{(index > 0) ? ' |' : ''}
|
{(index > 0) ? ' |' : ''}
|
||||||
<a
|
<a
|
||||||
href="javascript:;"
|
href="javascript:;"
|
||||||
className={classes}
|
className={classes}
|
||||||
onClick={this.handleSelect.bind(this, group.name)}
|
onClick={() => this.handleSelect(group.name)}
|
||||||
>
|
>
|
||||||
{group.label}
|
{group.label}
|
||||||
<span className="count">({ parseInt(group.count, 10).toLocaleString() })</span>
|
<span className="count">({ parseInt(group.count, 10).toLocaleString() })</span>
|
||||||
@@ -33,9 +42,19 @@ define(['react', 'classnames'], (React, classNames) => {
|
|||||||
{ groups }
|
{ groups }
|
||||||
</ul>
|
</ul>
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
});
|
|
||||||
|
|
||||||
return ListingGroups;
|
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
ListingGroups.propTypes = {
|
||||||
|
onSelectGroup: PropTypes.func.isRequired,
|
||||||
|
groups: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
name: PropTypes.string,
|
||||||
|
count: PropTypes.number,
|
||||||
|
})).isRequired,
|
||||||
|
group: PropTypes.shape({
|
||||||
|
name: PropTypes.string,
|
||||||
|
count: PropTypes.number,
|
||||||
|
}).isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ListingGroups;
|
||||||
|
@@ -19,7 +19,7 @@ const ListingHeader = React.createClass({
|
|||||||
<ListingColumn
|
<ListingColumn
|
||||||
onSort={this.props.onSort}
|
onSort={this.props.onSort}
|
||||||
sort_by={this.props.sort_by}
|
sort_by={this.props.sort_by}
|
||||||
key={`column-${index}`}
|
key={`column-${column.name}`}
|
||||||
column={renderColumn}
|
column={renderColumn}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user