Skip to content

Commit b0b7d6a

Browse files
committed
Add translate prop to Tooltip and adjust new tab tooltip position
- add new prop to tooltip: translate: {x? y?}. set for 'new tab': x 2px └── packages └── ui └── src └── components └── editor └── common ├── Tooltip │ ├── Tooltip.module.scss │ ├── Tooltip.tsx │ └── index.ts └── prompts └── PromptField ├── PromptField.tsx └── components └── Tabs └── Tabs.tsx
1 parent 3044028 commit b0b7d6a

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

  • packages/ui/src/components/editor/common

‎packages/ui/src/components/editor/common/Tooltip/Tooltip.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ type Props = {
99
is_warning?: boolean
1010
details?: React.ReactNode
1111
offset?: number
12+
translate?: { x?: number; y?: number }
1213
}
1314

1415
export const Tooltip: React.FC<Props> = (params) => {
1516
const style = {
1617
...(params.offset !== undefined
1718
? { '--tooltip-offset': `${params.offset}px` }
19+
: {}),
20+
...(params.translate?.x !== undefined || params.translate?.y !== undefined
21+
? {
22+
translate: `${params.translate?.x ?? 0}px ${params.translate?.y ?? 0}px`
23+
}
1824
: {})
1925
} as React.CSSProperties
2026

‎packages/ui/src/components/editor/common/prompts/PromptField/components/Tabs/Tabs.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ export const Tabs = forwardRef<TabsRef, Props>((props, ref) => {
9494
message={props.translations.new_tab}
9595
position="bottom"
9696
align="right"
97-
offset={1}
97+
offset={6}
98+
translate={{ x: 5 }}
9899
/>
99100
)}
100101
<div className={styles['tabs__tab__icon']} />

0 commit comments

Comments
 (0)