Fix eslint6 react/prefer-stateless-function
[MAILPOET-1140]
This commit is contained in:
@@ -5,97 +5,91 @@ define([
|
||||
React,
|
||||
Moment
|
||||
) => {
|
||||
class FormFieldDateYear extends React.Component {
|
||||
render() {
|
||||
const yearsRange = 100;
|
||||
const years = [];
|
||||
function FormFieldDateYear(props) {
|
||||
const yearsRange = 100;
|
||||
const years = [];
|
||||
|
||||
if (this.props.placeholder !== undefined) {
|
||||
years.push((
|
||||
<option value="" key={0}>{ this.props.placeholder }</option>
|
||||
));
|
||||
}
|
||||
|
||||
const currentYear = Moment().year();
|
||||
for (let i = currentYear; i >= currentYear - yearsRange; i -= 1) {
|
||||
years.push((
|
||||
<option
|
||||
key={i}
|
||||
value={i}
|
||||
>{ i }</option>
|
||||
));
|
||||
}
|
||||
return (
|
||||
<select
|
||||
name={`${this.props.name}[year]`}
|
||||
value={this.props.year}
|
||||
onChange={this.props.onValueChange}
|
||||
>
|
||||
{ years }
|
||||
</select>
|
||||
);
|
||||
if (props.placeholder !== undefined) {
|
||||
years.push((
|
||||
<option value="" key={0}>{ props.placeholder }</option>
|
||||
));
|
||||
}
|
||||
|
||||
const currentYear = Moment().year();
|
||||
for (let i = currentYear; i >= currentYear - yearsRange; i -= 1) {
|
||||
years.push((
|
||||
<option
|
||||
key={i}
|
||||
value={i}
|
||||
>{ i }</option>
|
||||
));
|
||||
}
|
||||
return (
|
||||
<select
|
||||
name={`${props.name}[year]`}
|
||||
value={props.year}
|
||||
onChange={props.onValueChange}
|
||||
>
|
||||
{ years }
|
||||
</select>
|
||||
);
|
||||
}
|
||||
|
||||
class FormFieldDateMonth extends React.Component {
|
||||
render() {
|
||||
const months = [];
|
||||
function FormFieldDateMonth(props) {
|
||||
const months = [];
|
||||
|
||||
if (this.props.placeholder !== undefined) {
|
||||
months.push((
|
||||
<option value="" key={0}>{ this.props.placeholder }</option>
|
||||
));
|
||||
}
|
||||
|
||||
for (let i = 1; i <= 12; i += 1) {
|
||||
months.push((
|
||||
<option
|
||||
key={i}
|
||||
value={i}
|
||||
>{ this.props.monthNames[i - 1] }</option>
|
||||
));
|
||||
}
|
||||
return (
|
||||
<select
|
||||
name={`${this.props.name}[month]`}
|
||||
value={this.props.month}
|
||||
onChange={this.props.onValueChange}
|
||||
>
|
||||
{ months }
|
||||
</select>
|
||||
);
|
||||
if (props.placeholder !== undefined) {
|
||||
months.push((
|
||||
<option value="" key={0}>{ props.placeholder }</option>
|
||||
));
|
||||
}
|
||||
|
||||
for (let i = 1; i <= 12; i += 1) {
|
||||
months.push((
|
||||
<option
|
||||
key={i}
|
||||
value={i}
|
||||
>{ props.monthNames[i - 1] }</option>
|
||||
));
|
||||
}
|
||||
return (
|
||||
<select
|
||||
name={`${props.name}[month]`}
|
||||
value={props.month}
|
||||
onChange={props.onValueChange}
|
||||
>
|
||||
{ months }
|
||||
</select>
|
||||
);
|
||||
}
|
||||
|
||||
class FormFieldDateDay extends React.Component {
|
||||
render() {
|
||||
const days = [];
|
||||
function FormFieldDateDay(props) {
|
||||
const days = [];
|
||||
|
||||
if (this.props.placeholder !== undefined) {
|
||||
days.push((
|
||||
<option value="" key={0}>{ this.props.placeholder }</option>
|
||||
));
|
||||
}
|
||||
|
||||
for (let i = 1; i <= 31; i += 1) {
|
||||
days.push((
|
||||
<option
|
||||
key={i}
|
||||
value={i}
|
||||
>{ i }</option>
|
||||
));
|
||||
}
|
||||
|
||||
return (
|
||||
<select
|
||||
name={`${this.props.name}[day]`}
|
||||
value={this.props.day}
|
||||
onChange={this.props.onValueChange}
|
||||
>
|
||||
{ days }
|
||||
</select>
|
||||
);
|
||||
if (props.placeholder !== undefined) {
|
||||
days.push((
|
||||
<option value="" key={0}>{ props.placeholder }</option>
|
||||
));
|
||||
}
|
||||
|
||||
for (let i = 1; i <= 31; i += 1) {
|
||||
days.push((
|
||||
<option
|
||||
key={i}
|
||||
value={i}
|
||||
>{ i }</option>
|
||||
));
|
||||
}
|
||||
|
||||
return (
|
||||
<select
|
||||
name={`${props.name}[day]`}
|
||||
value={props.day}
|
||||
onChange={props.onValueChange}
|
||||
>
|
||||
{ days }
|
||||
</select>
|
||||
);
|
||||
}
|
||||
|
||||
class FormFieldDate extends React.Component {
|
||||
|
@@ -2,36 +2,34 @@ import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import ReactTooltip from 'react-tooltip';
|
||||
|
||||
class Badge extends React.Component {
|
||||
render() {
|
||||
const badgeClasses = classNames(
|
||||
'mailpoet_badge',
|
||||
this.props.type ? `mailpoet_badge_${this.props.type}` : ''
|
||||
);
|
||||
function Badge(props) {
|
||||
const badgeClasses = classNames(
|
||||
'mailpoet_badge',
|
||||
props.type ? `mailpoet_badge_${props.type}` : ''
|
||||
);
|
||||
|
||||
const tooltip = this.props.tooltip ? this.props.tooltip.replace(/\n/g, '<br />') : false;
|
||||
// tooltip ID must be unique, defaults to tooltip text
|
||||
const tooltipId = this.props.tooltipId || tooltip;
|
||||
const tooltip = props.tooltip ? props.tooltip.replace(/\n/g, '<br />') : false;
|
||||
// tooltip ID must be unique, defaults to tooltip text
|
||||
const tooltipId = props.tooltipId || tooltip;
|
||||
|
||||
return (
|
||||
<span>
|
||||
<span
|
||||
className={badgeClasses}
|
||||
data-tip={tooltip}
|
||||
data-for={tooltipId}
|
||||
>
|
||||
{this.props.name}
|
||||
</span>
|
||||
{ tooltip && (
|
||||
<ReactTooltip
|
||||
place="right"
|
||||
multiline={true}
|
||||
id={tooltipId}
|
||||
/>
|
||||
) }
|
||||
return (
|
||||
<span>
|
||||
<span
|
||||
className={badgeClasses}
|
||||
data-tip={tooltip}
|
||||
data-for={tooltipId}
|
||||
>
|
||||
{props.name}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
{ tooltip && (
|
||||
<ReactTooltip
|
||||
place="right"
|
||||
multiline={true}
|
||||
id={tooltipId}
|
||||
/>
|
||||
) }
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export default Badge;
|
||||
|
@@ -278,7 +278,7 @@ define(
|
||||
},
|
||||
handleCheckboxChange: function (event) {
|
||||
const changeEvent = event;
|
||||
changeEvent.target.value = this.refs.isScheduledInput.checked ? '1' : '0';
|
||||
changeEvent.target.value = this.isScheduledInput.checked ? '1' : '0';
|
||||
return this.handleValueChange(changeEvent);
|
||||
},
|
||||
isScheduled: function () {
|
||||
|
@@ -2,40 +2,38 @@ import Breadcrumb from 'newsletters/breadcrumb.jsx';
|
||||
import React from 'react';
|
||||
import MailPoet from 'mailpoet';
|
||||
|
||||
class AutomaticEmailsBreadcrumb extends React.Component {
|
||||
render() {
|
||||
const steps = [
|
||||
{
|
||||
name: 'type',
|
||||
label: MailPoet.I18n.t('selectType'),
|
||||
link: '/new',
|
||||
},
|
||||
{
|
||||
name: 'events',
|
||||
label: MailPoet.I18n.t('events'),
|
||||
},
|
||||
{
|
||||
name: 'conditions',
|
||||
label: MailPoet.I18n.t('conditions'),
|
||||
},
|
||||
{
|
||||
name: 'template',
|
||||
label: MailPoet.I18n.t('template'),
|
||||
},
|
||||
{
|
||||
name: 'editor',
|
||||
label: MailPoet.I18n.t('designer'),
|
||||
},
|
||||
{
|
||||
name: 'send',
|
||||
label: MailPoet.I18n.t('send'),
|
||||
},
|
||||
];
|
||||
function AutomaticEmailsBreadcrumb(props) {
|
||||
const steps = [
|
||||
{
|
||||
name: 'type',
|
||||
label: MailPoet.I18n.t('selectType'),
|
||||
link: '/new',
|
||||
},
|
||||
{
|
||||
name: 'events',
|
||||
label: MailPoet.I18n.t('events'),
|
||||
},
|
||||
{
|
||||
name: 'conditions',
|
||||
label: MailPoet.I18n.t('conditions'),
|
||||
},
|
||||
{
|
||||
name: 'template',
|
||||
label: MailPoet.I18n.t('template'),
|
||||
},
|
||||
{
|
||||
name: 'editor',
|
||||
label: MailPoet.I18n.t('designer'),
|
||||
},
|
||||
{
|
||||
name: 'send',
|
||||
label: MailPoet.I18n.t('send'),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<Breadcrumb step={this.props.step} steps={steps} />
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Breadcrumb step={props.step} steps={steps} />
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = AutomaticEmailsBreadcrumb;
|
||||
|
Reference in New Issue
Block a user