import React, { memo } from 'react';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
import { get } from 'lodash';
import { InputsIndex as Inputs } from 'strapi-helper-plugin';
import CustomLabel from './CustomLabel';
const Input = ({
autoFocus,
customBootstrapClass,
didCheckErrors,
errors,
label,
name,
noErrorsDescription,
onChange,
placeholder,
type,
value,
}) => {
let inputLabel = label;
if (name === 'news') {
const handleClick = (e, to) => {
e.preventDefault();
e.stopPropagation();
const win = window.open(`https://strapi.io/${to}`, '_blank');
win.focus();
};
const terms = (
{content => (
handleClick(e, 'terms')}
>
{content}
)}
);
const policy = (
{content => (
handleClick(e, 'policy')}
>
{content}
)}
);
inputLabel = ;
}
return (
);
};
Input.propTypes = {
autoFocus: PropTypes.bool,
customBootstrapClass: PropTypes.string,
didCheckErrors: PropTypes.bool.isRequired,
errors: PropTypes.object.isRequired,
label: PropTypes.object,
name: PropTypes.string.isRequired,
noErrorsDescription: PropTypes.bool.isRequired,
onChange: PropTypes.func.isRequired,
placeholder: PropTypes.string,
type: PropTypes.string.isRequired,
value: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
};
export default memo(Input);