Skip to content

Commit

Permalink
Feat: connect map drawer with diaryList page #100
Browse files Browse the repository at this point in the history
  • Loading branch information
hummingbbird committed May 23, 2024
1 parent 61f584f commit 46af6cb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/common/map/MapDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,18 @@ import { PropTypes } from "prop-types";
import Jeju from "../../../assets/images/jeju.jpg";
import Button from "@mui/material/Button";
import LocationOnIcon from "@mui/icons-material/LocationOn";
import { useNavigate } from "react-router";
import { useRecoilState } from "recoil";
import { tripNameState } from "../../../recoil/commonState";
const MapDrawer = (props) => {
const navigate = useNavigate();
const [tripName, setTripName] = useRecoilState(tripNameState);
const goToDiary = () => {
setTripName(props.data.title);
navigate("/triptable", {
state: { id: props.data._id},
});
};
return (
<StMapDrawer>
<TripImg src={props.url} />
Expand All @@ -17,7 +28,7 @@ const MapDrawer = (props) => {
<LocationP>{props.data.location.region}</LocationP>
</LocationDiv>
</InfoDiv>
<GoToTripBtn>여행 보러 가기</GoToTripBtn>
<GoToTripBtn onClick={goToDiary}>여행 보러 가기</GoToTripBtn>
</StMapDrawer>
);
};
Expand Down

0 comments on commit 46af6cb

Please sign in to comment.