-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop/fe' of https://github.com/woowacourse-teams/202…
…4-touroot into feature/fe/#419
- Loading branch information
Showing
30 changed files
with
543 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
frontend/src/components/common/GoogleMapLoadScript/GoogleMapLoadScript.constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Libraries } from "@react-google-maps/api"; | ||
|
||
export const LIBRARIES: Libraries = ["maps", "places", "marker"]; |
30 changes: 12 additions & 18 deletions
30
frontend/src/components/common/GoogleMapLoadScript/GoogleMapLoadScript.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,18 @@ | ||
import { Libraries, LoadScript } from "@react-google-maps/api"; | ||
import { useJsApiLoader } from "@react-google-maps/api"; | ||
|
||
interface GoogleMapLoadScriptProps { | ||
libraries: Libraries; | ||
loadingElement?: React.ReactNode; | ||
import { LIBRARIES } from "@components/common/GoogleMapLoadScript/GoogleMapLoadScript.constants"; | ||
|
||
interface GoogleMapLoadScriptProps extends React.PropsWithChildren { | ||
loadingElement: React.ReactNode; | ||
} | ||
|
||
const GoogleMapLoadScript = ({ | ||
children, | ||
libraries, | ||
loadingElement, | ||
}: React.PropsWithChildren<GoogleMapLoadScriptProps>) => { | ||
return ( | ||
<LoadScript | ||
googleMapsApiKey={process.env.REACT_APP_GOOGLE_MAP_API_KEY ?? ""} | ||
libraries={libraries} | ||
loadingElement={loadingElement} | ||
> | ||
{children} | ||
</LoadScript> | ||
); | ||
const GoogleMapLoadScript = ({ children, loadingElement }: GoogleMapLoadScriptProps) => { | ||
const { isLoaded } = useJsApiLoader({ | ||
googleMapsApiKey: process.env.REACT_APP_GOOGLE_MAP_API_KEY ?? "", | ||
libraries: LIBRARIES, | ||
}); | ||
|
||
return isLoaded ? <>{children}</> : loadingElement; | ||
}; | ||
|
||
export default GoogleMapLoadScript; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.