-
Notifications
You must be signed in to change notification settings - Fork 1
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 #16 from JupGo/diary/12
[feat] 나무 상세 화면 구현
- Loading branch information
Showing
39 changed files
with
1,029 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
|
||
# misc | ||
.DS_Store | ||
.env | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
|
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
/* /index.html 200 |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 +1,10 @@ | ||
export { ReactComponent as IcAlbum } from './IcAlbum.svg'; | ||
export { ReactComponent as IcBackBtn } from './IcBackBtn.svg'; | ||
export { ReactComponent as IcCamera } from './IcCamera.svg'; | ||
export { ReactComponent as IcFloggingStart } from './IcFlogging.svg'; | ||
export { ReactComponent as IcLogo } from './IcLogo.svg'; | ||
export { ReactComponent as IcMainDefault } from './IcMainDefault.svg'; | ||
export { ReactComponent as IcTemporaryPause } from './IcPause.svg'; | ||
export { ReactComponent as IcRunning } from './IcRunning.svg'; | ||
export { ReactComponent as IcStop } from './IcStop.svg'; | ||
export { ReactComponent as IcSubDefault } from './IcSubDefault.svg'; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,45 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import { IcFloggingStart, IcStop, IcTemporaryPause } from '../../asset/icon'; | ||
|
||
interface JupgoButtonProps { | ||
btnType: string; | ||
handleBtnClick: React.MouseEventHandler; | ||
} | ||
|
||
const JupgoButton = (props: JupgoButtonProps) => { | ||
const { btnType, handleBtnClick } = props; | ||
|
||
return ( | ||
<JupgoBtn onClick={handleBtnClick} btnType={btnType}> | ||
{btnType === 'floggingPause' ? ( | ||
<IcTemporaryPause /> | ||
) : btnType === 'floggingStart' ? ( | ||
<IcFloggingStart /> | ||
) : ( | ||
<IcStop /> | ||
)} | ||
</JupgoBtn> | ||
); | ||
}; | ||
|
||
export default JupgoButton; | ||
|
||
const JupgoBtn = styled.button<{ btnType: string }>` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 45%; | ||
height: 100%; | ||
background-color: ${({ theme, btnType }) => | ||
btnType === 'floggingPause' | ||
? theme.colors.gray_01 | ||
: btnType === 'floggingStart' | ||
? theme.colors.green_dark | ||
: theme.colors.pink}; | ||
border: none; | ||
border-radius: 2rem; | ||
`; |
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,39 @@ | ||
import { useEffect, useState } from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import { KakaoMapInfo } from '../../types/map'; | ||
|
||
const KakaoMap = () => { | ||
const [map, setMap] = useState({}); | ||
const [kakaoMapInfo, setKakaoMapInfo] = useState<KakaoMapInfo>(); | ||
const { kakao } = window; | ||
|
||
useEffect(() => { | ||
if (navigator.geolocation) { | ||
navigator.geolocation.getCurrentPosition((position) => { | ||
setKakaoMapInfo({ latitude: position.coords.latitude, longitude: position.coords.longitude }); | ||
}); | ||
} | ||
}, []); | ||
useEffect(() => { | ||
if (kakaoMapInfo) { | ||
const container = document.getElementById('map'); | ||
const options = { | ||
center: new kakao.maps.LatLng(kakaoMapInfo.latitude, kakaoMapInfo.longitude), | ||
level: 3, | ||
}; | ||
|
||
setMap(new kakao.maps.Map(container, options)); | ||
} | ||
}, [kakaoMapInfo]); | ||
|
||
if (!kakaoMapInfo) return <div>Loading중...</div>; | ||
return <StMapWrapper id="map" />; | ||
}; | ||
|
||
export default KakaoMap; | ||
|
||
const StMapWrapper = styled.div` | ||
width: 100%; | ||
height: 100%; | ||
`; |
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,106 @@ | ||
import { useState } from 'react'; | ||
import { useRecoilState } from 'recoil'; | ||
import styled from 'styled-components'; | ||
|
||
import { IcRunning } from '../../asset/icon'; | ||
import useCouter from '../../lib/hooks/useCouter'; | ||
import { floggingInfoState } from '../../recoil/atom'; | ||
import { getDateParse } from '../../utils/dateParse'; | ||
import JupgoButton from './JupgoButton'; | ||
|
||
const RunningControl = () => { | ||
const [isFloggingPause, setIsFloggintPause] = useState(false); | ||
const [floggingInfo, setFloggingInfo] = useRecoilState(floggingInfoState); | ||
const { count, start, stop } = useCouter(0, 1000); | ||
const { distance, duration } = floggingInfo; | ||
|
||
const handleFloggingStart = () => { | ||
start(); | ||
setIsFloggintPause(!isFloggingPause); | ||
}; | ||
const handleFloggingPause = () => { | ||
stop(); | ||
setIsFloggintPause(!isFloggingPause); | ||
}; | ||
const handleFloggingStop = () => { | ||
stop(); | ||
setFloggingInfo({ ...floggingInfo }); | ||
}; | ||
|
||
return ( | ||
<RunningControlWrapper> | ||
<HeaderWrapper> | ||
<header> | ||
<h1>{distance}</h1> | ||
<h1>km</h1> | ||
<IcRunning /> | ||
</header> | ||
<p>{getDateParse(count).map((data, idx) => (idx !== 2 ? data + ' : ' : data))}</p> | ||
</HeaderWrapper> | ||
|
||
<article> | ||
{isFloggingPause ? ( | ||
<JupgoButton btnType={'floggingPause'} handleBtnClick={handleFloggingPause} /> | ||
) : ( | ||
<JupgoButton btnType={'floggingStart'} handleBtnClick={handleFloggingStart} /> | ||
)} | ||
|
||
<JupgoButton btnType={'floggingStop'} handleBtnClick={handleFloggingStop} /> | ||
</article> | ||
</RunningControlWrapper> | ||
); | ||
}; | ||
|
||
export default RunningControl; | ||
|
||
const RunningControlWrapper = styled.section` | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
width: 94%; | ||
height: 14%; | ||
padding: 4% 8%; | ||
background-color: rgba(250, 250, 250, 0.9); | ||
border-radius: 1rem; | ||
article { | ||
display: flex; | ||
justify-content: space-between; | ||
width: 100%; | ||
height: 40%; | ||
} | ||
`; | ||
const HeaderWrapper = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
width: 100%; | ||
header { | ||
display: flex; | ||
justify-content: flex-start; | ||
align-items: center; | ||
gap: 0.5rem; | ||
& > h1 { | ||
vertical-align: bottom; | ||
${({ theme }) => theme.fonts.Jupgo_Bold_32} | ||
:nth-child(2) { | ||
font-size: 2rem; | ||
} | ||
} | ||
} | ||
p { | ||
margin-right: 12%; | ||
${({ theme }) => theme.fonts.Jupgo_Bold_20} | ||
color:${({ theme }) => theme.colors.gray_01}; | ||
} | ||
`; |
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,2 @@ | ||
export { default as KakaoMap } from './KakaoMap'; | ||
export { default as RunningControl } from './RunningControl'; |
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,23 @@ | ||
import { useCallback, useRef, useState } from 'react'; | ||
|
||
const useCouter = (initMinutes: number, ms: number) => { | ||
const [count, setCount] = useState(initMinutes); | ||
const intervalRef = useRef<NodeJS.Timeout | null>(null); | ||
|
||
const start = useCallback(() => { | ||
if (intervalRef.current) return; | ||
intervalRef.current = setInterval(() => { | ||
setCount((prev) => prev + 1); | ||
}, ms); | ||
}, []); | ||
|
||
const stop = useCallback(() => { | ||
if (!intervalRef.current) return; | ||
clearInterval(intervalRef.current); | ||
intervalRef.current = null; | ||
}, []); | ||
|
||
return { count, start, stop }; | ||
}; | ||
|
||
export default useCouter; |
Oops, something went wrong.