-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from glen15/update/origin
Update/origin
- Loading branch information
Showing
59 changed files
with
2,571 additions
and
366 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from "react"; | ||
|
||
const ChatAlert = ({ chatData }) => { | ||
const { content, updatedAt } = chatData; | ||
|
||
return ( | ||
<div className="chat--container alert"> | ||
<div className="text">{content}</div> | ||
<div className="time">{`${new Date(updatedAt).getMonth()}-${new Date( | ||
updatedAt | ||
).getDate()} ${new Date(updatedAt).getHours()}:${new Date( | ||
updatedAt | ||
).getMinutes()}`}</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ChatAlert; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React, { useEffect, useState } from "react"; | ||
import { useSelector } from "react-redux"; | ||
|
||
const Message = ({ chatData }) => { | ||
const userInfo = useSelector((state) => state.userInfo); | ||
const { userId, content, updatedAt } = chatData; | ||
const [isMine, setIsMine] = useState(true); | ||
|
||
useEffect(() => { | ||
if (userInfo.userId === userId) { | ||
setIsMine(true); | ||
} else { | ||
setIsMine(false); | ||
} | ||
}, []); | ||
|
||
return ( | ||
<div className={`chat--container${isMine ? " mine" : ""}`}> | ||
<div className="content--box">{content}</div> | ||
<div className="time">{`${new Date(updatedAt).getMonth()}-${new Date( | ||
updatedAt | ||
).getDate()} ${new Date(updatedAt).getHours()}:${new Date( | ||
updatedAt | ||
).getMinutes()}`}</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Message; |
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,89 @@ | ||
import { useEffect, useRef, useState } from "react"; | ||
import Postcode from "react-daum-postcode"; | ||
|
||
const { kakao } = window; | ||
|
||
const ChooseMap = ({ inputValue, setInputValue }) => { | ||
const container = useRef(null); | ||
const addr = useRef(null); | ||
|
||
const [isOn, setIsOn] = useState(false); | ||
|
||
useEffect(() => { | ||
let data = inputValue.place.split("|"); | ||
const location = new kakao.maps.LatLng(data[0], data[1]); | ||
let map = new kakao.maps.Map(container.current, { | ||
center: location, | ||
}), | ||
marker = new kakao.maps.Marker({ | ||
map, | ||
position: location, | ||
}), | ||
infowindow = new kakao.maps.InfoWindow({ | ||
map, | ||
position: new kakao.maps.LatLng(Number(data[0]) + 0.0004, data[1]), | ||
content: `<div class="map--infowindow">${ | ||
data[3] === "null" ? data[2] : data[3] | ||
}</div>`, | ||
removable: true, | ||
}); | ||
}, [inputValue.place]); | ||
|
||
// '위도|경도|주소|빌딩이름|리스트에서 보일 주소' | ||
const addrFinder = (data) => { | ||
const geocoder = new kakao.maps.services.Geocoder(); | ||
addr.current.textContent = data.address; | ||
console.log("data", data); | ||
geocoder.addressSearch(data.address, (result, status) => { | ||
if (status === "OK") { | ||
console.log(result[0]); | ||
const lat = result[0].y; | ||
const lng = result[0].x; | ||
const place = result[0].road_address.address_name; | ||
const building = result[0].road_address.building_name || "null"; | ||
const region = `${result[0].road_address.region_1depth_name} ${result[0].road_address.region_2depth_name} ${result[0].road_address.region_3depth_name}`; | ||
setInputValue({ | ||
...inputValue, | ||
place: `${lat}|${lng}|${place}|${building}|${region}`, | ||
}); | ||
} | ||
}); | ||
}; | ||
|
||
return ( | ||
<div className="post--map--container"> | ||
<div className="post--map--input--container"> | ||
<div className="post--address" ref={addr}></div> | ||
<button | ||
onClick={() => { | ||
setIsOn(true); | ||
}} | ||
> | ||
주소찾기 | ||
</button> | ||
</div> | ||
{isOn ? ( | ||
<div | ||
className="modal--backdrop" | ||
onClick={() => { | ||
setIsOn(false); | ||
}} | ||
> | ||
<div className="modal--view postcode"> | ||
<Postcode | ||
onComplete={(data) => { | ||
addrFinder(data); | ||
setIsOn(false); | ||
}} | ||
className="post--map--postcode" | ||
/> | ||
</div> | ||
</div> | ||
) : null} | ||
|
||
<div className="post--map" ref={container} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ChooseMap; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from "react"; | ||
import { Link } from "react-router-dom"; | ||
|
||
const CreatePostBtn = () => { | ||
return ( | ||
<div className="fixedBtn create"> | ||
<Link to="/doc"> | ||
<div>생성</div> | ||
</Link> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CreatePostBtn; |
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,25 @@ | ||
import { useHistory } from "react-router"; | ||
|
||
export default function EditCompleteModal({ | ||
docId, | ||
isModalOpen, | ||
openModalHandler, | ||
}) { | ||
const history = useHistory(); | ||
return ( | ||
<> | ||
{isModalOpen ? ( | ||
<div className="modal--backdrop"> | ||
<div className="modal--view"> | ||
<div>게시글 수정이 완료되었습니다</div> | ||
<div className="modal--btnContainer"> | ||
<button onClick={() => history.replace(`/post/${docId}`)}> | ||
확인 | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
) : null} | ||
</> | ||
); | ||
} |
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.