diff --git a/apps/designer/app/designer/features/sidebar-left/panels/pages/settings.tsx b/apps/designer/app/designer/features/sidebar-left/panels/pages/settings.tsx index 08ac6ba4d9..fa855bb586 100644 --- a/apps/designer/app/designer/features/sidebar-left/panels/pages/settings.tsx +++ b/apps/designer/app/designer/features/sidebar-left/panels/pages/settings.tsx @@ -8,13 +8,13 @@ import { styled, Flex, toast, - Tooltip, + InputErrorsTooltip, } from "@webstudio-is/design-system"; import { useFetcher, type FetcherWithComponents } from "@remix-run/react"; import { ChevronDoubleLeftIcon } from "@webstudio-is/icons"; import type { ZodError } from "zod"; import { BaseHeader } from "../../lib/header"; -import React, { useEffect, useRef, useState } from "react"; +import { useEffect, useRef, useState } from "react"; import { type Page } from "@webstudio-is/project"; const Group = styled(Flex, { @@ -27,30 +27,6 @@ export type CreatePageData = | { ok: true; page: Page } | { errors: string | ZodError["formErrors"] }; -const ErrorsTooltip = ({ - errors, - children, -}: { - errors: string[] | undefined; - children: React.ComponentProps["children"]; -}) => { - const content = errors?.map((error, i) => ( - - {i > 0 &&
} - {error} -
- )); - return ( - // We intentionally always pass non empty content to avoid optimization inside Tooltip - // where it renders {children} directly if content is empty. - // If this optimization accur, the will remount which will cause focus loss - // and current value loss. - - {children} - - ); -}; - export const NewPageSettings = ({ onClose, onSuccess, @@ -120,7 +96,7 @@ export const NewPageSettings = ({ - + rest); }} /> - + - + rest); }} /> - +