Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
refactor: move Navigator to under Visualizer/Widget/Navigator
Browse files Browse the repository at this point in the history
  • Loading branch information
keiya01 committed Sep 27, 2022
1 parent 2289ecb commit 5877026
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { memo } from "react";

import Icon from "@reearth/components/atoms/Icon";
import { useT } from "@reearth/i18n";
import { styled } from "@reearth/theme";

import Icon from "../Icon";

import { useNavigator } from "./hooks";

export type Props = {
Expand Down Expand Up @@ -35,7 +34,7 @@ export type Props = {
onZoomOut?: () => void;
};

const Navigator: React.FC<Props> = memo(function NavigatorPresenter({
const NavigatorPresenter: React.FC<Props> = memo(function NavigatorPresenterMemo({
degree,
onRotate,
onStartOrbit,
Expand Down Expand Up @@ -174,4 +173,4 @@ const ToolIconButton = styled.button`
place-items: center;
`;

export default Navigator;
export default NavigatorPresenter;
4 changes: 2 additions & 2 deletions src/components/molecules/Visualizer/Widget/Navigator/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useState, useEffect, useCallback, useRef } from "react";

import { degreeToRadian, radianToDegree } from "@reearth/components/atoms/Navigator/utils";

import { SceneProperty } from "../../Engine";
import { useContext } from "../../Plugin";

import { degreeToRadian, radianToDegree } from "./NavigatorPresenter/utils";

export default function ({ sceneProperty }: { sceneProperty: SceneProperty }) {
const ctx = useContext();
const camera = ctx?.reearth.camera;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import NavigatorUI from "@reearth/components/atoms/Navigator";
import { ComponentProps as WidgetProps } from "@reearth/components/molecules/Visualizer/Widget";

import { SceneProperty } from "../../Engine";

import useHooks from "./hooks";
import NavigatorPresenter from "./NavigatorPresenter";

export type Props = WidgetProps<SceneProperty>;

const Navigator = ({ sceneProperty }: Props): JSX.Element | null => {
const { degree, events } = useHooks({ sceneProperty });

return <NavigatorUI degree={degree} {...events} />;
return <NavigatorPresenter degree={degree} {...events} />;
};

export default Navigator;

0 comments on commit 5877026

Please sign in to comment.