-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix useInstillForm field's description tooltip break words issue (…
…#937) Because - The fields of useInstillForm are using the same tooltip to show complicated description, there break-words rule is not correct - close https://github.com/instill-ai/community/issues/533 This commit - fix useInstillForm field's description tooltip break words issue
- Loading branch information
Showing
11 changed files
with
67 additions
and
290 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
packages/toolkit/src/lib/use-instill-form/components/common/FieldDescriptionTooltip.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Icons, ParagraphWithHTML, Tooltip } from "@instill-ai/design-system"; | ||
import { Nullable } from "../../../type"; | ||
|
||
export const FieldDescriptionTooltip = ({ | ||
description, | ||
}: { | ||
description: Nullable<string>; | ||
}) => { | ||
return description ? ( | ||
<Tooltip.Provider> | ||
<Tooltip.Root> | ||
<Tooltip.Trigger asChild> | ||
<Icons.HelpCircle className="my-auto h-[14px] w-[14px] cursor-pointer stroke-semantic-fg-secondary" /> | ||
</Tooltip.Trigger> | ||
<Tooltip.Portal> | ||
<Tooltip.Content className="w-[360px]" sideOffset={5} side="top"> | ||
<div className="!rounded-sm !bg-semantic-bg-primary !px-3 !py-2"> | ||
<ParagraphWithHTML | ||
text={description} | ||
className="break-words text-semantic-fg-primary product-body-text-4-semibold" | ||
/> | ||
</div> | ||
<Tooltip.Arrow | ||
className="fill-white" | ||
offset={5} | ||
width={9} | ||
height={6} | ||
/> | ||
</Tooltip.Content> | ||
</Tooltip.Portal> | ||
</Tooltip.Root> | ||
</Tooltip.Provider> | ||
) : null; | ||
}; |
1 change: 1 addition & 0 deletions
1
packages/toolkit/src/lib/use-instill-form/components/common/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./FieldDescriptionTooltip"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.