Home / Function/ NewNotePage() — ui Function Reference

NewNotePage() — ui Function Reference

Architecture documentation for the NewNotePage() function in notes.new.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  66ba5644_150d_e77e_9844_6c492984f652["NewNotePage()"]
  2f3ed508_f176_75d1_4058_09e604e2f1cb["notes.new.tsx"]
  66ba5644_150d_e77e_9844_6c492984f652 -->|defined in| 2f3ed508_f176_75d1_4058_09e604e2f1cb
  style 66ba5644_150d_e77e_9844_6c492984f652 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/routes/notes.new.tsx lines 35–109

export default function NewNotePage() {
  const actionData = useActionData<typeof action>();
  const titleRef = useRef<HTMLInputElement>(null);
  const bodyRef = useRef<HTMLTextAreaElement>(null);

  useEffect(() => {
    if (actionData?.errors?.title) {
      titleRef.current?.focus();
    } else if (actionData?.errors?.body) {
      bodyRef.current?.focus();
    }
  }, [actionData]);

  return (
    <Form
      method="post"
      style={{
        display: "flex",
        flexDirection: "column",
        gap: 8,
        width: "100%",
      }}
    >
      <div>
        <label className="flex w-full flex-col gap-1">
          <span>Title: </span>
          <input
            ref={titleRef}
            name="title"
            className="flex-1 rounded-md border-2 border-blue-500 px-3 text-lg leading-loose"
            aria-invalid={actionData?.errors?.title ? true : undefined}
            aria-errormessage={
              actionData?.errors?.title ? "title-error" : undefined
            }
          />
        </label>
        {actionData?.errors?.title ? (
          <div className="pt-1 text-red-700" id="title-error">
            {actionData.errors.title}
          </div>
        ) : null}
      </div>

      <div>
        <label className="flex w-full flex-col gap-1">
          <span>Body: </span>
          <textarea
            ref={bodyRef}
            name="body"
            rows={8}
            className="w-full flex-1 rounded-md border-2 border-blue-500 px-3 py-2 text-lg leading-6"
            aria-invalid={actionData?.errors?.body ? true : undefined}
            aria-errormessage={
              actionData?.errors?.body ? "body-error" : undefined
            }
          />
        </label>
        {actionData?.errors?.body ? (
          <div className="pt-1 text-red-700" id="body-error">
            {actionData.errors.body}
          </div>
        ) : null}
      </div>

      <div className="text-right">
        <button
          type="submit"
          className="rounded bg-blue-500 px-4 py-2 text-white hover:bg-blue-600 focus:bg-blue-400"
        >
          Save
        </button>
      </div>
    </Form>
  );
}

Subdomains

Frequently Asked Questions

What does NewNotePage() do?
NewNotePage() is a function in the ui codebase, defined in packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/routes/notes.new.tsx.
Where is NewNotePage() defined?
NewNotePage() is defined in packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/routes/notes.new.tsx at line 35.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free