diff --git a/src/components/editor/elements/container.tsx b/src/components/editor/elements/container.tsx index 9021a1b7..55d44781 100644 --- a/src/components/editor/elements/container.tsx +++ b/src/components/editor/elements/container.tsx @@ -162,17 +162,16 @@ export default function Container({ element }: Props) { }, }); break; - case "map": + case "navigation": dispatch({ type: "ADD_ELEMENT", payload: { containerId: id, elementDetails: { - type: "map", + type: "navigation", id: nanoid(), - name: "map", + name: "navigation", styles: { - color: "black", ...containerDefaultStyles, }, content: { diff --git a/src/components/editor/elements/kakao-map.tsx b/src/components/editor/elements/kakao-map.tsx index 978a4f96..9eab5eee 100644 --- a/src/components/editor/elements/kakao-map.tsx +++ b/src/components/editor/elements/kakao-map.tsx @@ -2,7 +2,7 @@ import { KakaoAddressProvider } from "~/components/editor/elements/kakao-map-con import KakaoMapElement from "~/components/editor/elements/kakao-map-element"; import ElementWrapper from "~/components/editor/elements/element-wrapper"; -import MapShareComponents from "~/components/editor/elements/map-share"; +import NavigationElement from "~/components/editor/elements/navigation-element"; import type { InferEditorElement } from "~/components/editor/type"; type Props = { @@ -13,7 +13,11 @@ export default function KakaoMap({ element }: Props) { {element.content.isMapUse && } - {element.content.isShareUse && } + {element.content.isShareUse && ( + } + /> + )} ); diff --git a/src/components/editor/elements/map-share.tsx b/src/components/editor/elements/navigation-element.tsx similarity index 58% rename from src/components/editor/elements/map-share.tsx rename to src/components/editor/elements/navigation-element.tsx index 47504012..32a87cb9 100644 --- a/src/components/editor/elements/map-share.tsx +++ b/src/components/editor/elements/navigation-element.tsx @@ -7,13 +7,11 @@ type MapType = "naver" | "kakao"; type MapUrls = Record; type Props = { - element: InferEditorElement<"kakaoMap">; + element: InferEditorElement<"navigation">; }; -const MapShareComponents = ({ element }: Props) => { - const { content } = element; - const address = - !Array.isArray(content) && content.address ? content.address : ""; +export default function NavigationElement({ element }: Props) { + const { address } = element.content; const openMap = (mapType: MapType, address: string) => { const mapUrls: MapUrls = { @@ -47,19 +45,15 @@ const MapShareComponents = ({ element }: Props) => { return ( -
- - - -
+ + +
); -}; - -export default MapShareComponents; +} diff --git a/src/components/editor/elements/recursive.tsx b/src/components/editor/elements/recursive.tsx index ecfbf8c3..706a3fe0 100644 --- a/src/components/editor/elements/recursive.tsx +++ b/src/components/editor/elements/recursive.tsx @@ -3,6 +3,7 @@ import Container from "~/components/editor/elements/container"; import ImageElement from "~/components/editor/elements/image-element"; import KakaoMap from "~/components/editor/elements/kakao-map"; import LogoBannerElement from "~/components/editor/elements/logo-banner-element"; +import NavigationElement from "~/components/editor/elements/navigation-element"; import Text from "~/components/editor/elements/text"; import type { EditorElement } from "~/components/editor/type"; @@ -22,6 +23,8 @@ export default function Recursive({ element }: { element: EditorElement }) { return ; case "kakaoMap": return ; + case "navigation": + return ; case "logoBanner": return ; default: diff --git a/src/components/editor/placeholders.tsx b/src/components/editor/placeholders.tsx index 102ed17e..99ab71da 100644 --- a/src/components/editor/placeholders.tsx +++ b/src/components/editor/placeholders.tsx @@ -1,4 +1,10 @@ -import { BoxSelectIcon, ImageIcon, MapIcon, TypeIcon } from "lucide-react"; +import { + BoxSelectIcon, + ImageIcon, + MapIcon, + NavigationIcon, + TypeIcon, +} from "lucide-react"; import type { EditorElementType } from "~/components/editor/type"; import { LogoTextIcon } from "~/components/ui/icons"; import { cn } from "~/lib/utils"; @@ -46,14 +52,6 @@ export function TwoColumnsPlaceholder() { ); } -export function MapPlaceholder() { - return ( - - - - ); -} - export function ContainerPlaceholder() { return ( @@ -70,6 +68,14 @@ export function ImagePlaceholder() { ); } +export function NavigationPlaceholder() { + return ( + + + + ); +} + export function KakaoMapPlaceholder() { return ( diff --git a/src/components/editor/sidebar-element-settings-tab/index.tsx b/src/components/editor/sidebar-element-settings-tab/index.tsx index 6ffee636..1f813221 100644 --- a/src/components/editor/sidebar-element-settings-tab/index.tsx +++ b/src/components/editor/sidebar-element-settings-tab/index.tsx @@ -24,19 +24,12 @@ export default function SidebarElementSettingsTab(props: Props) {
- {selectedElement.type === "map" && ( - <> - - - - )} {selectedElement.type === "kakaoMap" && ( <> )} - - {selectedElement.type === "map" && ( + {selectedElement.type === "navigation" && ( <> diff --git a/src/components/editor/sidebar-element-settings-tab/map-setting.tsx b/src/components/editor/sidebar-element-settings-tab/map-setting.tsx index 5a757308..5846c311 100644 --- a/src/components/editor/sidebar-element-settings-tab/map-setting.tsx +++ b/src/components/editor/sidebar-element-settings-tab/map-setting.tsx @@ -4,7 +4,7 @@ import { useEditor } from "~/components/editor/provider"; import type { InferEditorElement } from "~/components/editor/type"; import { Input } from "~/components/ui/input"; -type Props = { element: InferEditorElement<"map"> }; +type Props = { element: InferEditorElement<"navigation"> }; export default function MapSetting({ element }: Props) { const { dispatch } = useEditor(); @@ -15,7 +15,7 @@ export default function MapSetting({ element }: Props) { payload: { elementDetails: { ...element, - type: "map", + type: "navigation", content: { ...element.content, address: e.target.value, diff --git a/src/components/editor/sidebar-elements-tab.tsx b/src/components/editor/sidebar-elements-tab.tsx index 4ba30a8a..2187c73b 100644 --- a/src/components/editor/sidebar-elements-tab.tsx +++ b/src/components/editor/sidebar-elements-tab.tsx @@ -5,6 +5,7 @@ import { ImagePlaceholder, KakaoMapPlaceholder, LogoBannerPlaceholder, + NavigationPlaceholder, TextPlaceholder, TwoColumnsPlaceholder, } from "~/components/editor/placeholders"; @@ -66,6 +67,12 @@ export default function SidebarElementsTab(props: Props) { Component: , group: "elements", }, + { + id: "navigation", + label: "Navigation", + Component: , + group: "elements", + }, { id: "logoBanner", label: "Logo Banner", diff --git a/src/components/editor/type.ts b/src/components/editor/type.ts index ea3a50b7..4307e56e 100644 --- a/src/components/editor/type.ts +++ b/src/components/editor/type.ts @@ -20,7 +20,7 @@ type EditorElementContentMap = { isMapUse: boolean; isShareUse: boolean; }; - map: { address: string }; + navigation: { address: string }; blank: {}; empty: {}; logoBanner: {};