-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
912d89f
commit 94b199e
Showing
2 changed files
with
54 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { | ||
GoogleMap as GoogleMapComponent, | ||
MarkerF, | ||
} from "@react-google-maps/api"; | ||
import React, { FC } from "react"; | ||
import { useMap } from "./useMap"; | ||
|
||
type Props = { | ||
defaultPosition: { | ||
lat: number; | ||
lng: number; | ||
}; | ||
}; | ||
|
||
const MarkersOnGoogleMap: FC<Props> = (props) => { | ||
const { isLoaded, onLoad } = useMap({ | ||
defaultPosition: props.defaultPosition, | ||
}); | ||
|
||
const containerStyle = { | ||
width: "100vw", | ||
height: "75vh", | ||
}; | ||
|
||
const markerLabel: google.maps.MarkerLabel = { | ||
text: "ミライトデザイン", | ||
fontFamily: "sans-serif", | ||
fontSize: "15px", | ||
fontWeight: "bold", | ||
}; | ||
|
||
return ( | ||
<> | ||
{isLoaded ? ( | ||
<GoogleMapComponent mapContainerStyle={containerStyle} onLoad={onLoad}> | ||
<MarkerF | ||
position={props.defaultPosition} | ||
label={markerLabel} | ||
></MarkerF> | ||
</GoogleMapComponent> | ||
) : ( | ||
"loading" | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default React.memo(MarkersOnGoogleMap); |
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