diff --git a/web/src/beta/features/Visualizer/Crust/Infobox/index.tsx b/web/src/beta/features/Visualizer/Crust/Infobox/index.tsx index 7e99c16b16..d711fcb96c 100644 --- a/web/src/beta/features/Visualizer/Crust/Infobox/index.tsx +++ b/web/src/beta/features/Visualizer/Crust/Infobox/index.tsx @@ -1,7 +1,7 @@ import BlockAddBar from "@reearth/beta/features/Visualizer/shared/components/BlockAddBar"; import { EditModeProvider } from "@reearth/beta/features/Visualizer/shared/contexts/editModeContext"; import { InstallableBlock } from "@reearth/beta/features/Visualizer/shared/types"; -import { DragAndDropList } from "@reearth/beta/lib/reearth-ui"; +import { DragAndDropList, Icon } from "@reearth/beta/lib/reearth-ui"; import { ValueType, ValueTypes } from "@reearth/beta/utils/value"; import { Layer, Spacing } from "@reearth/core"; import { styled } from "@reearth/services/theme"; @@ -66,6 +66,7 @@ export type Props = { schemaGroupId?: string, itemId?: string ) => Promise; + onCloseInfobox?: () => void; }; const Infobox: FC = ({ @@ -80,7 +81,8 @@ const Infobox: FC = ({ onPropertyUpdate, onPropertyItemAdd, onPropertyItemMove, - onPropertyItemDelete + onPropertyItemDelete, + onCloseInfobox }) => { const { wrapperRef, @@ -170,31 +172,30 @@ const Infobox: FC = ({ return showInfobox ? ( - - {isEditable && !disableSelection && ( - handleBlockOpen(-1)} - onBlockAdd={handleBlockCreate?.(0)} - /> - )} - {infoboxBlocks && infoboxBlocks.length > 0 && ( - - )} + + + + {isEditable && !disableSelection && ( + handleBlockOpen(-1)} + onBlockAdd={handleBlockCreate?.(0)} + /> + )} + {infoboxBlocks && infoboxBlocks.length > 0 && ( + + )} + ) : null; @@ -205,26 +206,50 @@ export default memo(Infobox); const Wrapper = styled("div")<{ position?: InfoboxPosition; padding?: Spacing; -}>(({ position, padding, theme }) => ({ +}>(({ position, theme }) => ({ display: "flex", flexDirection: "column", position: "absolute", top: "37px", - minHeight: "370px", - maxHeight: "515px", width: `${INFOBOX_WIDTH}px`, background: "#ffffff", borderRadius: theme.radius.normal, zIndex: theme.zIndexes.visualizer.infobox, boxSizing: "border-box", - overflow: "auto", + [position ?? POSITION_DEFAULT_VALUE]: "13px" +})); + +const Content = styled("div")<{ + padding?: Spacing; +}>(({ padding }) => ({ + minHeight: "370px", + maxHeight: "515px", + display: "flex", + flexDirection: "column", + gap: `${padding?.top ?? `${PADDING_DEFAULT_VALUE}px`}`, paddingTop: padding?.top ?? `${PADDING_DEFAULT_VALUE}px`, paddingBottom: padding?.bottom ?? `${PADDING_DEFAULT_VALUE}px`, paddingLeft: padding?.left ?? `${PADDING_DEFAULT_VALUE}px`, paddingRight: padding?.right ?? `${PADDING_DEFAULT_VALUE}px`, - [position ?? POSITION_DEFAULT_VALUE]: "13px" + boxSizing: "border-box", + overflow: "auto" })); const ItemWrapper = styled("div")(() => ({ background: "#ffffff" })); + +const CloseButton: FC<{ + onClick?: () => void; +}> = ({ onClick }) => { + return ( +
+
+ +
+
+ ); +}; diff --git a/web/src/beta/features/Visualizer/Crust/index.tsx b/web/src/beta/features/Visualizer/Crust/index.tsx index e7d26b0fab..015fa69bb8 100644 --- a/web/src/beta/features/Visualizer/Crust/index.tsx +++ b/web/src/beta/features/Visualizer/Crust/index.tsx @@ -12,7 +12,7 @@ import { type MapRef } from "@reearth/core"; import { NLSLayer } from "@reearth/services/api/layersApi/utils"; -import { useMemo, type RefObject, useContext } from "react"; +import { useMemo, type RefObject, useContext, useCallback } from "react"; import { useWidgetContext } from "./context"; import useHooks from "./hooks"; @@ -306,6 +306,10 @@ export default function Crust({ selectedComputedFeature ]); + const handleCloseInfobox = useCallback(() => { + mapRef?.current?.layers?.select(undefined); + }, [mapRef]); + return ( {showStoryPanel && (