Skip to content

Commit

Permalink
refactor: Map에 data 로딩 상태 추가 (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
D0Dam committed Jul 29, 2023
1 parent 389520b commit 3a8a10e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions frontend/src/components/@common/Map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface MapProps {
data: RestaurantData[];
setBoundary: React.Dispatch<React.SetStateAction<CoordinateBoundary>>;
toggleMapExpand: () => void;
loadingData: boolean;
}

const render = (status: Status) => {
Expand All @@ -27,7 +28,7 @@ const render = (status: Status) => {
return <LoadingDots />;
};

function Map({ data, setBoundary, toggleMapExpand }: MapProps) {
function Map({ data, setBoundary, toggleMapExpand, loadingData }: MapProps) {
const [center, setCenter] = useState<Coordinate>({ lat: 37.5057482, lng: 127.050727 });
const [clicks, setClicks] = useState<google.maps.LatLng[]>([]);
const [zoom, setZoom] = useState(16);
Expand Down Expand Up @@ -93,7 +94,7 @@ function Map({ data, setBoundary, toggleMapExpand }: MapProps) {
);
})}
{myPosition && <OverlayMyLocation position={myPosition} />}
{loading && (
{(loadingData || loading) && (
<LoadingUI>
<LoadingDots />
</LoadingUI>
Expand Down Expand Up @@ -127,8 +128,7 @@ const LoadingUI = styled.div`
right: calc(50% - 41px);
width: 82px;
padding: 1.6rem 2.4rem;
height: 40px;
`;

const StyledMyPositionButtonUI = styled.button`
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function MainPage() {
<RestaurantCardList restaurantDataList={data} loading={loading} />
</StyledLeftSide>
<StyledRightSide>
<Map setBoundary={setBoundary} data={data?.content} toggleMapExpand={toggleMapExpand} />
<Map setBoundary={setBoundary} data={data?.content} toggleMapExpand={toggleMapExpand} loadingData={loading} />
</StyledRightSide>
</StyledLayout>
<Footer />
Expand Down

0 comments on commit 3a8a10e

Please sign in to comment.