diff --git a/core/src/date-input/date-input.tsx b/core/src/date-input/date-input.tsx
index 18fe7c79..b2033911 100644
--- a/core/src/date-input/date-input.tsx
+++ b/core/src/date-input/date-input.tsx
@@ -2,7 +2,7 @@ import { ReactElement } from "react";
// TODO: Rewrite date input using the new DayPicker component from react-day-picker
export const DateInput = (): ReactElement => {
- return
+ return ;
};
// import { ReactNode, useState } from "react";
diff --git a/new-docs/pages/patterns/color/sample/sample.tsx b/new-docs/pages/patterns/color/sample/sample.tsx
index 35aa67e0..1d322aaa 100644
--- a/new-docs/pages/patterns/color/sample/sample.tsx
+++ b/new-docs/pages/patterns/color/sample/sample.tsx
@@ -1,7 +1,12 @@
import Color from "color";
import { useEffect, useRef, useState } from "react";
import { HiCheckCircle } from "react-icons/hi";
-import { CategoryColor, categoryColors, Icon, Tag } from "../../../../../core/src";
+import {
+ CategoryColor,
+ categoryColors,
+ Icon,
+ Tag,
+} from "../../../../../core/src";
import s from "./sample.module.css";
export type ColorSampleUsage = "text" | "icon" | "both";
diff --git a/new-docs/pages/patterns/form/form.module.css b/new-docs/pages/patterns/form/form.module.css
index c3beab8b..ac96462b 100644
--- a/new-docs/pages/patterns/form/form.module.css
+++ b/new-docs/pages/patterns/form/form.module.css
@@ -1,5 +1,5 @@
.form {
display: "flex";
flex-direction: "column";
- gap: 16,
+ gap: 16;
}
diff --git a/new-docs/pages/patterns/form/formik.stories.mdx b/new-docs/pages/patterns/form/formik.stories.mdx
index 6eac3ebf..11a41ddc 100644
--- a/new-docs/pages/patterns/form/formik.stories.mdx
+++ b/new-docs/pages/patterns/form/formik.stories.mdx
@@ -1,4 +1,4 @@
-import { FormikExample } from './formik'
+import { FormikExample } from "./formik";
# Formik
@@ -7,23 +7,23 @@ Formik's [Field][1] component:
[1]: https://formik.org/docs/api/field
-~~~tsx
+```tsx
import { Field } from "formik";
import { Input } from "../../../core/src";
Email
-~~~
+```
To show errors, pass FormError to the "component" prop of Formik's
[ErrorMessage][2] component:
-~~~tsx
+```tsx
import { ErrorMessage } from "formik";
import { FormError } from "../../../core/src";
-
-~~~
+ ;
+```
[2]: https://formik.org/docs/api/errormessage
@@ -31,51 +31,51 @@ Full example:
-~~~tsx
+```tsx
(): JSX.Element => {
- /* import { Input, Button, FormError } from "../../../core/src" */
-
- const title = (
-
- Title
-
-
-
- );
-
- const message = (
-
- Message
-
-
-
- );
-
- const validate = (values: FormValues): FormikErrors => {
- const errors: FormikErrors = {};
- if (!values.title) errors.title = ERRORS.titleRequired;
- if (!values.message) errors.message = ERRORS.messageRequired;
- if (values.message.length < 5) errors.message = ERRORS.messageLength;
- return errors;
- };
-
- return (
-
- initialValues={{ title: "", message: "" }}
- validate={validate}
- onSubmit={async (values, { setSubmitting }) => {
- await postToServer(values);
- setSubmitting(false);
- }}
- >
- {({ isSubmitting: busy }) => (
-
- )}
-
- );
+ /* import { Input, Button, FormError } from "../../../core/src" */
+
+ const title = (
+
+ Title
+
+
+
+ );
+
+ const message = (
+
+ Message
+
+
+
+ );
+
+ const validate = (values: FormValues): FormikErrors => {
+ const errors: FormikErrors = {};
+ if (!values.title) errors.title = ERRORS.titleRequired;
+ if (!values.message) errors.message = ERRORS.messageRequired;
+ if (values.message.length < 5) errors.message = ERRORS.messageLength;
+ return errors;
+ };
+
+ return (
+
+ initialValues={{ title: "", message: "" }}
+ validate={validate}
+ onSubmit={async (values, { setSubmitting }) => {
+ await postToServer(values);
+ setSubmitting(false);
+ }}
+ >
+ {({ isSubmitting: busy }) => (
+
+ )}
+
+ );
};
-~~~
+```
diff --git a/new-docs/pages/patterns/form/formik.tsx b/new-docs/pages/patterns/form/formik.tsx
index 62518389..fd3d244d 100644
--- a/new-docs/pages/patterns/form/formik.tsx
+++ b/new-docs/pages/patterns/form/formik.tsx
@@ -1,51 +1,51 @@
import { ErrorMessage, Field, Form, Formik, FormikErrors } from "formik";
import { FormError, Input, TextArea } from "../../../../core/src";
import { ERRORS, FormValues, SubmitButton, postToServer } from "./utils";
-import s from './form.module.css';
+import s from "./form.module.css";
export const FormikExample = (): JSX.Element => {
- /* import { Input, Button, FormError } from "../../../core/src" */
+ /* import { Input, Button, FormError } from "../../../core/src" */
- const title = (
-
- Title
-
-
-
- );
+ const title = (
+
+ Title
+
+
+
+ );
- const message = (
-
- Message
-
-
-
- );
+ const message = (
+
+ Message
+
+
+
+ );
- const validate = (values: FormValues): FormikErrors => {
- const errors: FormikErrors = {};
- if (!values.title) errors.title = ERRORS.titleRequired;
- if (!values.message) errors.message = ERRORS.messageRequired;
- if (values.message.length < 5) errors.message = ERRORS.messageLength;
- return errors;
- };
+ const validate = (values: FormValues): FormikErrors => {
+ const errors: FormikErrors = {};
+ if (!values.title) errors.title = ERRORS.titleRequired;
+ if (!values.message) errors.message = ERRORS.messageRequired;
+ if (values.message.length < 5) errors.message = ERRORS.messageLength;
+ return errors;
+ };
- return (
-
- initialValues={{ title: "", message: "" }}
- validate={validate}
- onSubmit={async (values, { setSubmitting }) => {
- await postToServer(values);
- setSubmitting(false);
- }}
- >
- {({ isSubmitting: busy }) => (
-
- )}
-
- );
+ return (
+
+ initialValues={{ title: "", message: "" }}
+ validate={validate}
+ onSubmit={async (values, { setSubmitting }) => {
+ await postToServer(values);
+ setSubmitting(false);
+ }}
+ >
+ {({ isSubmitting: busy }) => (
+
+ )}
+
+ );
};
diff --git a/new-docs/pages/patterns/form/react-hook-form.stories.mdx b/new-docs/pages/patterns/form/react-hook-form.stories.mdx
index 45931b53..21d297a1 100644
--- a/new-docs/pages/patterns/form/react-hook-form.stories.mdx
+++ b/new-docs/pages/patterns/form/react-hook-form.stories.mdx
@@ -1,11 +1,11 @@
-import { ReactHookFormExample } from './react-hook-form'
+import { ReactHookFormExample } from "./react-hook-form";
# React Hook Form
To use Moai's input components with React Hook Form, [render][2] them in the
"render" prop of RHF's [Controller][1] component:
-~~~tsx
+```tsx
import { Controller } from "react-hook-form";
import { Input } from "../../../core/src";
@@ -18,7 +18,7 @@ import { Input } from "../../../core/src";
)}
rules={{ required: "Email is required" }}
/>
-~~~
+```
[1]: https://react-hook-form.com/api#Controller
[2]: https://react-hook-form.com/get-started#IntegratingwithUIlibraries
@@ -26,11 +26,11 @@ import { Input } from "../../../core/src";
To show errors, pass RHF's [error messages][3] as children of Moai's FormError
component:
-~~~tsx
+```tsx
import { FormError } from "../../../core/src";
-
-~~~
+ ;
+```
[3]: https://react-hook-form.com/advanced-usage#ErrorMessages
@@ -38,60 +38,60 @@ Full example:
-~~~tsx
+```tsx
(): JSX.Element => {
- /* import { Input, Button, FormError } from "../../../core/src" */
-
- const { control, formState, handleSubmit } = useForm();
- const { errors } = formState;
- const [busy, setBusy] = useState(false);
-
- const title = (
-
- Title
- (
-
- )}
- rules={{ required: ERRORS.titleRequired }}
- defaultValue=""
- />
-
-
- );
-
- const message = (
-
- Message
- }
- rules={{
- required: { value: true, message: ERRORS.messageRequired },
- minLength: { value: 5, message: ERRORS.messageLength },
- }}
- defaultValue=""
- />
-
-
- );
-
- return (
-
- );
+ /* import { Input, Button, FormError } from "../../../core/src" */
+
+ const { control, formState, handleSubmit } = useForm();
+ const { errors } = formState;
+ const [busy, setBusy] = useState(false);
+
+ const title = (
+
+ Title
+ (
+
+ )}
+ rules={{ required: ERRORS.titleRequired }}
+ defaultValue=""
+ />
+
+
+ );
+
+ const message = (
+
+ Message
+ }
+ rules={{
+ required: { value: true, message: ERRORS.messageRequired },
+ minLength: { value: 5, message: ERRORS.messageLength },
+ }}
+ defaultValue=""
+ />
+
+
+ );
+
+ return (
+
+ );
};
-~~~
+```
diff --git a/new-docs/pages/patterns/form/react-hook-form.tsx b/new-docs/pages/patterns/form/react-hook-form.tsx
index 16af4c34..ba2e690d 100644
--- a/new-docs/pages/patterns/form/react-hook-form.tsx
+++ b/new-docs/pages/patterns/form/react-hook-form.tsx
@@ -2,60 +2,60 @@ import { useState } from "react";
import { ERRORS, FormValues, SubmitButton, postToServer } from "./utils";
import { Controller, useForm } from "react-hook-form";
import { FormError, Input, TextArea } from "../../../../core/src";
-import s from './form.module.css';
+import s from "./form.module.css";
export const ReactHookFormExample = (): JSX.Element => {
- /* import { Input, Button, FormError } from "../../../core/src" */
+ /* import { Input, Button, FormError } from "../../../core/src" */
- const { control, formState, handleSubmit } = useForm();
- const { errors } = formState;
- const [busy, setBusy] = useState(false);
+ const { control, formState, handleSubmit } = useForm();
+ const { errors } = formState;
+ const [busy, setBusy] = useState(false);
- const title = (
-
- Title
- (
-
- )}
- rules={{ required: ERRORS.titleRequired }}
- defaultValue=""
- />
-
-
- );
+ const title = (
+
+ Title
+ (
+
+ )}
+ rules={{ required: ERRORS.titleRequired }}
+ defaultValue=""
+ />
+
+
+ );
- const message = (
-
- Message
- }
- rules={{
- required: { value: true, message: ERRORS.messageRequired },
- minLength: { value: 5, message: ERRORS.messageLength },
- }}
- defaultValue=""
- />
-
-
- );
+ const message = (
+
+ Message
+ }
+ rules={{
+ required: { value: true, message: ERRORS.messageRequired },
+ minLength: { value: 5, message: ERRORS.messageLength },
+ }}
+ defaultValue=""
+ />
+
+
+ );
- return (
-
- );
+ return (
+
+ );
};
diff --git a/new-docs/pages/patterns/icon.stories.mdx b/new-docs/pages/patterns/icon.stories.mdx
index 69420972..7152f505 100644
--- a/new-docs/pages/patterns/icon.stories.mdx
+++ b/new-docs/pages/patterns/icon.stories.mdx
@@ -1,4 +1,4 @@
-import { Button } from '../../../core/src';
+import { Button } from "../../../core/src";
import { RiSearchLine } from "react-icons/ri";
# Icon
@@ -23,19 +23,17 @@ recommended way to set this prop is using an icon from the [react-icons][1]
package. It provides icons from many popular sets that can be used directly in
Moai:
-~~~ts
+```ts
import { RiSearchLine } from "react-icons/ri";
-~~~
+```
[1]: https://react-icons.github.io/react-icons/
-~~~tsx
-(): JSX.Element => (
-
-)
-~~~
+```tsx
+(): JSX.Element => ;
+```
## Icon Label
@@ -49,11 +47,9 @@ asked to provide an explicit icon label:
-~~~tsx
-(): JSX.Element => (
-
-)
-~~~
+```tsx
+(): JSX.Element => ;
+```
## Color & Size
@@ -62,13 +58,13 @@ controlled by the component itself. For example, in a large, highlight button,
the icon is white and enlarged:
-~~~tsx
+```tsx
(): JSX.Element => (
-)
-~~~
+);
+```
## Advanced
Technically, these \`icon\` props simply expect a [function component][1] that
-returns an SVG element. The type definition looks like this:
+returns an SVG element. The type definition looks like this:
-~~~ts
+```ts
interface Props {
- style?: CSSProperties;
- className?: string;
+ style?: CSSProperties;
+ className?: string;
}
-
+
type Icon = (props: Props) => JSX.Element;
-~~~
+```
This means you can use Moai with your own custom icons (e.g. logos, product
icons), by creating components that return them as SVG elements. For a full
@@ -101,18 +97,18 @@ these components from SVG files.
[1]: https://reactjs.org/docs/components-and-props.html#function-and-class-components
[2]: https://react-svgr.com
- {
return (
- )
- }}
+ );
+ }}
children="Search"
/>
-~~~tsx
+```tsx
(): JSX.Element => {
// In practice, this should be defined outside of your component, or even
// better, automatically generated by a tool like react-svgr.
@@ -124,4 +120,4 @@ these components from SVG files.
);
return ;
};
-~~~
+```
diff --git a/new-docs/sidebar.ts b/new-docs/sidebar.ts
index e11f5b48..b6df5f08 100644
--- a/new-docs/sidebar.ts
+++ b/new-docs/sidebar.ts
@@ -17,7 +17,7 @@ function generateSidebar(dirPath: string, parentDir: string): SidebarItem[] {
const fileName = entry.name.replace(".stories.mdx", "");
if (fileName === "index") {
items.unshift({
- text: 'Primary',
+ text: "Primary",
link: parentDir,
});
} else {