Skip to content

Commit

Permalink
feat: change error type to ReactNode (#825)
Browse files Browse the repository at this point in the history
  • Loading branch information
reme3d2y committed Sep 10, 2021
1 parent 1b2d94a commit c6d95c1
Show file tree
Hide file tree
Showing 25 changed files with 12 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ Object {
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -95,7 +94,6 @@ Object {
</div>
</div>
</div>
</div>
</div>
</div>,
Expand Down Expand Up @@ -200,7 +198,6 @@ Object {
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -250,7 +247,6 @@ Object {
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -301,7 +297,6 @@ Object {
</div>
</div>
</div>
</div>
</div>
</div>,
Expand Down
4 changes: 0 additions & 4 deletions packages/bank-card/src/__snapshots__/Component.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ exports[`BankCard Snapshots tests should match snapshots 1`] = `
</button>
</div>
</div>
</div>
<div
class="brandLogo"
Expand Down Expand Up @@ -210,7 +209,6 @@ exports[`BankCard Snapshots tests should match snapshots 2`] = `
</button>
</div>
</div>
</div>
<div
class="brandLogo"
Expand Down Expand Up @@ -326,7 +324,6 @@ exports[`BankCard Snapshots tests should match snapshots 3`] = `
</button>
</div>
</div>
</div>
<div
class="brandLogo"
Expand Down Expand Up @@ -442,7 +439,6 @@ exports[`BankCard Snapshots tests should match snapshots 4`] = `
</button>
</div>
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ exports[`CalendarInput Display tests should match snapshot 1`] = `
/>
</div>
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ exports[`CalendarRange Display tests should match snapshot 1`] = `
/>
</div>
</div>
</div>
<div>
<div
Expand Down Expand Up @@ -597,7 +596,6 @@ exports[`CalendarRange Display tests should match snapshot 1`] = `
/>
</div>
</div>
</div>
<div>
<div
Expand Down
4 changes: 2 additions & 2 deletions packages/checkbox-group/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type CheckboxGroupProps = {
/**
* Отображение ошибки
*/
error?: string | boolean;
error?: ReactNode | boolean;

/**
* Текст подсказки снизу
Expand Down Expand Up @@ -129,7 +129,7 @@ export const CheckboxGroup: FC<CheckboxGroupProps> = ({
);
};

const errorMessage = typeof error === 'string' ? error : '';
const errorMessage = typeof error === 'boolean' ? '' : error;

return (
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ Object {
</span>
</label>
</div>
</div>
</div>
</body>,
Expand Down Expand Up @@ -148,7 +147,6 @@ Object {
</span>
</label>
</div>
</div>
</div>,
"debug": [Function],
Expand Down Expand Up @@ -454,7 +452,6 @@ Object {
</span>
</label>
</div>
</div>
</div>
</body>,
Expand Down Expand Up @@ -490,7 +487,6 @@ Object {
</span>
</label>
</div>
</div>
</div>,
"debug": [Function],
Expand Down Expand Up @@ -615,7 +611,6 @@ Object {
/>
</label>
</div>
</div>
</div>
</body>,
Expand Down Expand Up @@ -683,7 +678,6 @@ Object {
/>
</label>
</div>
</div>
</div>,
"debug": [Function],
Expand Down Expand Up @@ -756,7 +750,6 @@ Object {
<div
class="checkboxList"
/>
</div>
</div>
</body>,
Expand All @@ -772,7 +765,6 @@ Object {
<div
class="checkboxList"
/>
</div>
</div>,
"debug": [Function],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ exports[`DateInput Display tests should match snapshot 1`] = `
class="addons rightAddons"
/>
</div>
</div>
</div>
`;
4 changes: 2 additions & 2 deletions packages/file-upload-item/src/Component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { MouseEvent, useCallback } from 'react';
import React, { MouseEvent, ReactNode, useCallback } from 'react';
import cn from 'classnames';

import { IconButton } from '@alfalab/core-components-icon-button';
Expand Down Expand Up @@ -68,7 +68,7 @@ export type FileUploadItemProps = {
/**
* Сообщение об ошибке
*/
error?: string;
error?: ReactNode;

/**
* Дочерние элементы
Expand Down
4 changes: 2 additions & 2 deletions packages/form-control/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export type FormControlProps = HTMLAttributes<HTMLDivElement> & {
/**
* Отображение ошибки
*/
error?: string | boolean;
error?: ReactNode | boolean;

/**
* Текст подсказки
Expand Down Expand Up @@ -127,7 +127,7 @@ export const FormControl = React.forwardRef<HTMLDivElement, FormControlProps>(
},
ref,
) => {
const errorMessage = typeof error === 'string' ? error : '';
const errorMessage = typeof error === 'boolean' ? '' : error;

return (
<div
Expand Down
12 changes: 0 additions & 12 deletions packages/form-control/src/__snapshots__/Component.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Object {
/>
</div>
</div>
</div>
</div>
</body>,
Expand All @@ -38,7 +37,6 @@ Object {
/>
</div>
</div>
</div>
</div>,
"debug": [Function],
Expand Down Expand Up @@ -220,7 +218,6 @@ Object {
<div>
Bottom addons
</div>
</div>
</div>
</body>,
Expand All @@ -242,7 +239,6 @@ Object {
<div>
Bottom addons
</div>
</div>
</div>,
"debug": [Function],
Expand Down Expand Up @@ -421,7 +417,6 @@ Object {
/>
</div>
</div>
<span
class="sub hint"
>
Expand All @@ -445,7 +440,6 @@ Object {
/>
</div>
</div>
<span
class="sub hint"
>
Expand Down Expand Up @@ -545,7 +539,6 @@ Object {
/>
</div>
</div>
</div>
</div>
</body>,
Expand Down Expand Up @@ -583,7 +576,6 @@ Object {
/>
</div>
</div>
</div>
</div>,
"debug": [Function],
Expand Down Expand Up @@ -666,7 +658,6 @@ Object {
/>
</div>
</div>
</div>
</div>
</body>,
Expand All @@ -692,7 +683,6 @@ Object {
/>
</div>
</div>
</div>
</div>,
"debug": [Function],
Expand Down Expand Up @@ -775,7 +765,6 @@ Object {
</div>
</div>
</div>
</div>
</div>
</body>,
Expand All @@ -801,7 +790,6 @@ Object {
</div>
</div>
</div>
</div>
</div>,
"debug": [Function],
Expand Down
2 changes: 1 addition & 1 deletion packages/input/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export type InputProps = Omit<
/**
* Отображение ошибки
*/
error?: string | boolean;
error?: ReactNode | boolean;

/**
* Отображение иконки успеха
Expand Down
2 changes: 0 additions & 2 deletions packages/input/src/__snapshots__/Component.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Object {
</div>
</div>
</div>
</div>
</div>
</body>,
Expand All @@ -50,7 +49,6 @@ Object {
</div>
</div>
</div>
</div>
</div>,
"debug": [Function],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ exports[`IntlPhoneInput should match snapshot 1`] = `
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Object {
</div>
</div>
</div>
</div>
</div>
</body>,
Expand All @@ -50,7 +49,6 @@ Object {
</div>
</div>
</div>
</div>
</div>,
"debug": [Function],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ exports[`PasswordInput snapshots tests should match snapshot 1`] = `
</button>
</div>
</div>
</div>
</div>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Object {
</div>
</div>
</div>
</div>
</div>
</body>,
Expand All @@ -50,7 +49,6 @@ Object {
</div>
</div>
</div>
</div>
</div>,
"debug": [Function],
Expand Down

0 comments on commit c6d95c1

Please sign in to comment.