Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

지도의 로딩중이라는 이미지를 로딩 컴포넌트로 수정한다. #577

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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%;
`;
Loading