Skip to content

Commit

Permalink
Merge pull request #577 from woowacourse-teams/refactor/574-map-page-…
Browse files Browse the repository at this point in the history
…loading

지도의 로딩중이라는 이미지를 로딩 컴포넌트로 수정한다.
  • Loading branch information
solo5star authored Oct 12, 2023
2 parents 83227db + 81c8c39 commit 1743047
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions client/src/pages/CafeMapPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import { Status, Wrapper } from '@googlemaps/react-wrapper';
import { type ReactElement } from 'react';
import styled from 'styled-components';
import CafeMap from '../components/CafeMap';
import LoadingBar from '../components/LoadingBar';
import AppError from '../errors/AppError';

const render = (status: Status): ReactElement => {
if (status === Status.FAILURE) return <div>에러입니다.</div>;
return <div>로딩중...</div>;
if (status === Status.FAILURE) {
throw new AppError('지도를 불러오는데 실패하였습니다. 잠시 후 다시 시도해주세요');
}
return (
<Container>
<LoadingBar />
</Container>
);
};

const CafeMapPage = () => {
Expand All @@ -16,3 +25,12 @@ const CafeMapPage = () => {
};

export default CafeMapPage;

const Container = styled.div`
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
`;

0 comments on commit 1743047

Please sign in to comment.