-
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.
Merge pull request #80 from Yeungnam-Nyang/develop
๐release:V0.0.2
- Loading branch information
Showing
31 changed files
with
854 additions
and
682 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,16 @@ | ||
import { motion } from "framer-motion"; | ||
import { pageEffect } from "../../styles/animation"; | ||
export default function Wrapper({ children, ...rest }) { | ||
return ( | ||
<motion.div | ||
initial="initial" | ||
animate="in" | ||
exit="out" | ||
transition={{ duration: 0.5 }} | ||
variants={pageEffect} | ||
{...rest} | ||
> | ||
{children} | ||
</motion.div> | ||
); | ||
} |
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,28 @@ | ||
import { useState, useEffect } from "react"; | ||
|
||
const useLocationPermission = () => { | ||
const [isLocationAllowed, setIsLocationAllowed] = useState(null); // ์์น ๊ถํ ์ํ (null: ํ์ธ ์ค, true: ํ์ฉ, false: ๊ฑฐ๋ถ) | ||
|
||
// ์์น ๊ถํ ์ํ ํ์ธ | ||
const checkLocationPermission = async () => { | ||
try { | ||
const permission = await navigator.permissions.query({ name: "geolocation" }); | ||
if (permission.state === "granted") { | ||
setIsLocationAllowed(true); | ||
} else { | ||
setIsLocationAllowed(false); | ||
} | ||
} catch (error) { | ||
|
||
setIsLocationAllowed(false); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
checkLocationPermission(); | ||
}, []); | ||
|
||
return { isLocationAllowed }; | ||
}; | ||
|
||
export default useLocationPermission; |
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,25 +1,52 @@ | ||
import Header from "../components/common/Header"; | ||
import NavBar from "../components/common/NavBar"; | ||
import Title from "../components/common/Title"; | ||
import Wrapper from "../components/common/Wrapper"; | ||
import KakoMap from "../components/nyangmap/KakaoMap"; | ||
import NyangBox from "../components/nyangmap/NyangBox"; | ||
import useLocationPermission from "../hooks/useLocationPermission"; | ||
import { useCatMapPosts } from "../store/useCatMapPosts"; | ||
|
||
export default function CatsMap() { | ||
const { postsCount } = useCatMapPosts(); | ||
//์์น ์ ๋ณด ํ์ฉ์ฌ๋ถ | ||
const { isLocationAllowed } = useLocationPermission(); | ||
return ( | ||
<div> | ||
<Wrapper> | ||
<Header /> | ||
<div className="h-20"></div> | ||
<Title text={"NYANG MAP"} /> | ||
<main className="px-6 gap-4 pb-32"> | ||
<KakoMap /> | ||
<div className="text-slate-400 py-3"> | ||
ํ์ฌ ์์น ๊ธฐ์ค 200๋ฏธํฐ ๋ด์ ๊ณ ์์ด๋ค์ด ๋ฑ์ฅํด์! | ||
</div> | ||
<NyangBox catNumber={postsCount} /> | ||
{isLocationAllowed === null && <div>์์น ํ์ฉ์ฌ๋ถ ํ์ธ์ค...</div>} | ||
{/* ์์น ํ์ฉ์ด ์๋ฝ๋์์ ๋ */} | ||
{isLocationAllowed === true && ( | ||
<> | ||
<KakoMap /> | ||
<div className="text-slate-400 py-3"> | ||
ํ์ฌ ์์น ๊ธฐ์ค 200๋ฏธํฐ ๋ด์ ๊ณ ์์ด๋ค์ด ๋ฑ์ฅํด์! | ||
</div> | ||
<NyangBox catNumber={postsCount} /> | ||
</> | ||
)} | ||
{/* ์์น ํ์ฉ์ด ๊ฑฐ๋ถ๋์์ ๋ */} | ||
{isLocationAllowed === false && ( | ||
<div className="flex flex-col text-left gap-5"> | ||
<a className="font-['Bungee'] text-lg pr-6 text-red-500"> | ||
์์น ๊ถํ์ด ๊ฑฐ๋ถ๋์์ต๋๋ค. ์ค์ ์์ ์์น ๊ถํ์ ํ์ฉํด์ฃผ์ธ์. | ||
</a> | ||
<a className="font-['Bungee'] text-2xl pr-6">ios</a> | ||
<a className="font-['Bungee'] text-sm"> | ||
์ค์ ->์์น ์๋น์ค->์ ์ํ ๋ธ๋ผ์ฐ์ ์ ํ->์์น | ||
์ ๊ทผํ์ฉ-["์ฑ์ ์ฌ์ฉํ๋ ๋์"]์ ํ | ||
</a> | ||
<a className="font-['Bungee'] text-2xl pr-6 pt-5">์๋๋ก์ด๋</a> | ||
<a className="font-['Bungee'] text-sm"> | ||
์ค์ ->์์น->์์น์ฌ์ฉ-["์ฌ์ฉ"]์ ํ | ||
</a> | ||
</div> | ||
)} | ||
</main> | ||
<NavBar /> | ||
</div> | ||
</Wrapper> | ||
); | ||
} |
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.