Skip to content

Commit

Permalink
docs: add PicoFieldErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
MiroslavPetrik committed Jan 5, 2024
1 parent 35f7dc1 commit 8046ed1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/components/list/ListField.mock.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ReactNode } from "react";

import { FieldErrors, FieldLabel } from "..";
import { FieldLabel } from "..";
import { ListAtomItems, ListAtomValue } from "../../atoms/list-atom";
import { PicoFieldErrors } from "../../scenarios/PicoFieldErrors";

import { List, ListProps } from ".";

Expand All @@ -16,9 +17,7 @@ export const ListField = <Fields extends ListAtomItems>({
<>
<FieldLabel field={field} label={label} />
<List field={field} {...listProps} />
<div style={{ marginBottom: 16, color: "var(--del-color)" }}>
<FieldErrors field={field} />
</div>
<PicoFieldErrors field={field} />
</>
);
};
17 changes: 17 additions & 0 deletions src/scenarios/PicoFieldErrors.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { FieldErrors, FieldErrorsProps } from "../components";

Check failure on line 1 in src/scenarios/PicoFieldErrors.tsx

View workflow job for this annotation

GitHub Actions / 🎨 Storybook Build & Deploy to GH Pages

'"../components"' has no exported member named 'FieldErrorsProps'. Did you mean 'FieldErrors'?

const style = { color: "var(--del-color)" };

export const PicoFieldErrors = (props: Omit<FieldErrorsProps, "children">) => (
<FieldErrors {...props}>

Check failure on line 6 in src/scenarios/PicoFieldErrors.tsx

View workflow job for this annotation

GitHub Actions / 🎨 Storybook Build & Deploy to GH Pages

Property 'field' is missing in type '{ children: ({ errors }: { errors: string[]; }) => Element; }' but required in type '{ field: FieldAtom<any>; }'.
{({ errors }) => (
<>
{errors.map((error, index) => (
<p key={index} style={style}>
{error}
</p>
))}
</>
)}
</FieldErrors>
);

0 comments on commit 8046ed1

Please sign in to comment.