33 $editableBlockChildOutline ,
44 $instances ,
55 $isContentMode ,
6+ $registeredComponentMetas ,
67 type EditableBlockChildOutline ,
78} from "~/shared/nano-states" ;
89import {
@@ -20,11 +21,13 @@ import {
2021 toast ,
2122 Kbd ,
2223 Text ,
24+ iconButtonSize ,
2325} from "@webstudio-is/design-system" ;
2426import { EditableBlockChildAddButtonOutline } from "./outline" ;
2527import { applyScale } from "./apply-scale" ;
2628import { $scale } from "~/builder/shared/nano-states" ;
27- import { BoxIcon , PlusIcon } from "@webstudio-is/icons" ;
29+ import { PlusIcon } from "@webstudio-is/icons" ;
30+ import { BoxIcon } from "@webstudio-is/icons/svg" ;
2831import { useRef , useState } from "react" ;
2932import { isFeatureEnabled } from "@webstudio-is/feature-flags" ;
3033import type { DroppableTarget , InstanceSelector } from "~/shared/tree-utils" ;
@@ -42,6 +45,7 @@ import {
4245 updateWebstudioData ,
4346} from "~/shared/instance-utils" ;
4447import { shallowEqual } from "shallow-equal" ;
48+ import { MetaIcon } from "~/builder/shared/meta-icon" ;
4549
4650export const findEditableBlockSelector = (
4751 anchor : InstanceSelector ,
@@ -182,6 +186,7 @@ const TemplatesMenu = ({
182186 anchor : InstanceSelector ;
183187} ) => {
184188 const instances = useStore ( $instances ) ;
189+ const metas = useStore ( $registeredComponentMetas ) ;
185190
186191 const optionPointerDownTime = useRef ( 0 ) ;
187192 const isMenuOpenedWithOption = useRef ( false ) ;
@@ -197,7 +202,7 @@ const TemplatesMenu = ({
197202
198203 const menuItems = templates ?. map ( ( [ template , templateSelector ] ) => ( {
199204 id : template . id ,
200- icon : < BoxIcon /> ,
205+ icon : < MetaIcon icon = { metas . get ( template . component ) ?. icon ?? BoxIcon } /> ,
201206 title : template . label ?? template . component ,
202207 value : templateSelector ,
203208 } ) ) ;
@@ -352,8 +357,8 @@ export const EditableBlockChildHoveredInstanceOutline = () => {
352357 < Flex
353358 css = { {
354359 width : "min-content" ,
355- height : "min-content" ,
356360 pointerEvents : isMenuOpen ? "none" : "all" ,
361+ clipPath : `polygon(0% 0%, 100% 0%, 100% 100%, 0% ${ iconButtonSize } )` ,
357362 } }
358363 onMouseEnter = { ( ) => {
359364 clearTimeout ( timeoutRef . current ) ;
@@ -385,20 +390,14 @@ export const EditableBlockChildHoveredInstanceOutline = () => {
385390 < IconButton
386391 variant = { "local" }
387392 css = { {
393+ mr : theme . spacing [ 4 ] ,
388394 borderStyle : "solid" ,
389395 borderColor : `oklch(from ${ theme . colors . backgroundPrimary } l c h / 0.7)` ,
390396 } }
391397 >
392398 < PlusIcon />
393399 </ IconButton >
394400 </ TemplatesMenu >
395- < Box
396- css = { {
397- width : theme . spacing [ 4 ] ,
398- // For easier hover
399- height : theme . spacing [ 12 ] ,
400- } }
401- > </ Box >
402401 </ Flex >
403402 </ EditableBlockChildAddButtonOutline >
404403 ) ;
0 commit comments