Skip to content

Commit 4dfb4fc

Browse files
vladKrkvladkrk
andauthored
fix(bundle): added preview in toolbar select (#615)
Co-authored-by: vladkrk <[email protected]>
1 parent f80fe92 commit 4dfb4fc

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

src/bundle/toolbar/ToolbarSelect.tsx

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99

1010
import {cn} from '../../classname';
1111
import {isFunction} from '../../lodash';
12+
import {PreviewTooltip} from '../../toolbar/PreviewTooltip';
1213

1314
import type {WToolbarBaseProps, WToolbarItemData} from './types';
1415

@@ -46,28 +47,30 @@ export const ToolbarSelect: React.FC<ToolbarSelectProps> = ({
4647
text: isFunction(item.title) ? item.title() : item.title,
4748
}))}
4849
renderOption={({text, data}) => {
49-
const {icon, hotkey, hint} = data as WToolbarItemData;
50+
const {icon, hotkey, hint, preview} = data as WToolbarItemData;
5051
const hintText = isFunction(hint) ? hint() : hint;
5152
return (
52-
<div aria-label={text} className={b('item')}>
53-
<div className={b('item-icon')}>
54-
<Icon data={icon.data} size={Number(icon.size ?? 16) + 2} />
55-
</div>
56-
<div className={b('item-content')}>
57-
{text}
58-
<div className={b('item-extra')}>
59-
{hotkey && <Hotkey value={hotkey} />}
60-
{hintText && (
61-
<HelpMark
62-
popoverProps={{modal: false}}
63-
className={b('item-hint')}
64-
>
65-
{hintText}
66-
</HelpMark>
67-
)}
53+
<PreviewTooltip preview={preview}>
54+
<div aria-label={text} className={b('item')}>
55+
<div className={b('item-icon')}>
56+
<Icon data={icon.data} size={Number(icon.size ?? 16) + 2} />
57+
</div>
58+
<div className={b('item-content')}>
59+
{text}
60+
<div className={b('item-extra')}>
61+
{hotkey && <Hotkey value={hotkey} />}
62+
{hintText && (
63+
<HelpMark
64+
popoverProps={{modal: false}}
65+
className={b('item-hint')}
66+
>
67+
{hintText}
68+
</HelpMark>
69+
)}
70+
</div>
6871
</div>
6972
</div>
70-
</div>
73+
</PreviewTooltip>
7174
);
7275
}}
7376
onUpdate={([id]) => {

0 commit comments

Comments
 (0)