Skip to content

Commit

Permalink
Merge pull request #104 from themoment-team/feature/logo
Browse files Browse the repository at this point in the history
Feature/logo
  • Loading branch information
sunwoo0706 authored Jan 13, 2023
2 parents cb1db8a + a7fb012 commit 50996f7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/components/Map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import useMarker from 'hooks/use-marker';
import { SideBar } from 'components/SideBar';
import { MarkerList } from 'components/MarkerList';
import { Launcher } from 'components/Launcher';
import defaultMapConfig from 'shared/DefaultMapConfig';

interface MapProps {
cookies: {
Expand All @@ -20,8 +21,8 @@ export const MapComponent: React.FC<MapProps> = ({ cookies }) => {
<>
<Map
center={{
lat: 36.658563176254795,
lng: 127.86119616960151,
lat: defaultMapConfig.lat,
lng: defaultMapConfig.lng,
}}
style={{
position: 'fixed',
Expand All @@ -32,7 +33,7 @@ export const MapComponent: React.FC<MapProps> = ({ cookies }) => {
right: '2.2rem',
}}
onCreate={setMap}
level={12}
level={defaultMapConfig.level}
>
<MarkerList markers={markers} />
<SideBar cookies={cookies} />
Expand Down
7 changes: 4 additions & 3 deletions src/components/MobileMap/MobileMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { MobileWrapper } from './Mobile.styles';
import { Map } from 'react-kakao-maps-sdk';
import useMarker from 'hooks/use-marker';
import { MarkerList } from 'components/MarkerList';
import defaultMapConfig from 'shared/DefaultMapConfig';

interface MobileMapProps {
cookies: {
Expand All @@ -19,15 +20,15 @@ export const MobileMapComponent: React.FC<MobileMapProps> = ({ cookies }) => {
<MobileWrapper>
<Map
center={{
lat: 36.658563176254795,
lng: 127.86119616960151,
lat: defaultMapConfig.lat,
lng: defaultMapConfig.lng,
}}
style={{
width: '100vw',
height: '100vh',
}}
onCreate={setMap}
level={12}
level={defaultMapConfig.level}
>
<MarkerList markers={markers} />
<BottomSheetComponent cookies={cookies} />
Expand Down
16 changes: 15 additions & 1 deletion src/components/common/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import * as S from './Header.styles';
import { handleAuth, handleLogout } from './container';
import { AxiosError } from 'axios';
import Link from 'next/link';
import { useMap } from 'react-kakao-maps-sdk';
import defaultMapConfig from 'shared/DefaultMapConfig';

interface HeaderProps {
userRules: UserRule;
Expand All @@ -24,6 +26,8 @@ export const HeaderComponent: React.FC<HeaderProps> = ({
menuVisible,
setMenuVisible,
}) => {
const map = useMap();

const handleMenuClick = () => {
axiosClient
.get(workerUrl.getMeWorker())
Expand All @@ -42,10 +46,20 @@ export const HeaderComponent: React.FC<HeaderProps> = ({
});
};

const clickLogo = () => {
const moveCoord = new kakao.maps.LatLng(
defaultMapConfig.lat,
defaultMapConfig.lng,
);

map.setLevel(defaultMapConfig.level);
map.panTo(moveCoord);
};

return (
<S.Header>
<Link href="/" passHref>
<a>
<a onClick={clickLogo}>
<Logo logoColor="blue" />
</a>
</Link>
Expand Down
7 changes: 7 additions & 0 deletions src/shared/DefaultMapConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const defaultMapConfig = {
lat: 36.658563176254795,
lng: 127.86119616960151,
level: 12,
};

export default defaultMapConfig;

1 comment on commit 50996f7

@vercel
Copy link

@vercel vercel bot commented on 50996f7 Jan 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.