mirror of
https://github.com/strapi/strapi.git
synced 2025-11-15 17:49:57 +00:00
Signed-off-by: agigleux <alexandre.gigleux@sonarsource.com> Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com>
This commit is contained in:
parent
f073aebe53
commit
e3d6ce132e
@ -46,7 +46,7 @@ function Inputs({
|
|||||||
) : (
|
) : (
|
||||||
<Error inputError={inputError} name={name} type="text" validations={validations}>
|
<Error inputError={inputError} name={name} type="text" validations={validations}>
|
||||||
{({ canCheck, error, dispatch }) => {
|
{({ canCheck, error, dispatch }) => {
|
||||||
const hasError = error && error !== null;
|
const hasError = Boolean(error);
|
||||||
|
|
||||||
const handleChange = e => {
|
const handleChange = e => {
|
||||||
if (!canCheck) {
|
if (!canCheck) {
|
||||||
|
|||||||
@ -44,20 +44,13 @@ class InputJSONWithErrors extends React.Component {
|
|||||||
const handleBlur = isFunction(onBlur) ? onBlur : this.handleBlur;
|
const handleBlur = isFunction(onBlur) ? onBlur : this.handleBlur;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Error
|
<Error inputError={inputError} name={name} type="text" validations={validations}>
|
||||||
inputError={inputError}
|
|
||||||
name={name}
|
|
||||||
type="text"
|
|
||||||
validations={validations}
|
|
||||||
>
|
|
||||||
{({ canCheck, onBlur, error, dispatch }) => {
|
{({ canCheck, onBlur, error, dispatch }) => {
|
||||||
const hasError = error && error !== null;
|
const hasError = Boolean(error);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper
|
<Wrapper
|
||||||
className={`${cn(!isEmpty(className) && className)} ${
|
className={`${cn(!isEmpty(className) && className)} ${hasError ? 'bordered' : ''}`}
|
||||||
hasError ? 'bordered' : ''
|
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
<Label htmlFor={name}>{label}</Label>
|
<Label htmlFor={name}>{label}</Label>
|
||||||
<InputJSON
|
<InputJSON
|
||||||
@ -87,9 +80,7 @@ class InputJSONWithErrors extends React.Component {
|
|||||||
tabIndex={tabIndex}
|
tabIndex={tabIndex}
|
||||||
value={value}
|
value={value}
|
||||||
/>
|
/>
|
||||||
{!hasError && inputDescription && (
|
{!hasError && inputDescription && <Description>{inputDescription}</Description>}
|
||||||
<Description>{inputDescription}</Description>
|
|
||||||
)}
|
|
||||||
{hasError && <ErrorMessage>{error}</ErrorMessage>}
|
{hasError && <ErrorMessage>{error}</ErrorMessage>}
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -203,7 +203,7 @@ const InputUID = ({
|
|||||||
validations={{ ...validations, regex: UID_REGEX }}
|
validations={{ ...validations, regex: UID_REGEX }}
|
||||||
>
|
>
|
||||||
{({ canCheck, onBlur, error, dispatch }) => {
|
{({ canCheck, onBlur, error, dispatch }) => {
|
||||||
const hasError = error && error !== null;
|
const hasError = Boolean(error);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper ref={wrapperRef}>
|
<Wrapper ref={wrapperRef}>
|
||||||
|
|||||||
@ -41,20 +41,13 @@ class WysiwygWithErrors extends React.Component {
|
|||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Error
|
<Error inputError={inputError} name={name} type="text" validations={validations}>
|
||||||
inputError={inputError}
|
|
||||||
name={name}
|
|
||||||
type="text"
|
|
||||||
validations={validations}
|
|
||||||
>
|
|
||||||
{({ canCheck, onBlur, error, dispatch }) => {
|
{({ canCheck, onBlur, error, dispatch }) => {
|
||||||
const hasError = error && error !== null;
|
const hasError = Boolean(error);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper
|
<Wrapper
|
||||||
className={`${cn(!isEmpty(className) && className)} ${
|
className={`${cn(!isEmpty(className) && className)} ${hasError ? 'bordered' : ''}`}
|
||||||
hasError ? 'bordered' : ''
|
|
||||||
}`}
|
|
||||||
style={style}
|
style={style}
|
||||||
>
|
>
|
||||||
<Label htmlFor={name}>{label}</Label>
|
<Label htmlFor={name}>{label}</Label>
|
||||||
@ -86,9 +79,7 @@ class WysiwygWithErrors extends React.Component {
|
|||||||
tabIndex={tabIndex}
|
tabIndex={tabIndex}
|
||||||
value={value}
|
value={value}
|
||||||
/>
|
/>
|
||||||
{!hasError && inputDescription && (
|
{!hasError && inputDescription && <Description>{inputDescription}</Description>}
|
||||||
<Description>{inputDescription}</Description>
|
|
||||||
)}
|
|
||||||
{hasError && <ErrorMessage>{error}</ErrorMessage>}
|
{hasError && <ErrorMessage>{error}</ErrorMessage>}
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user