Skip to content

Commit

Permalink
fix: 사파리, 크롬 설치앱 구분
Browse files Browse the repository at this point in the history
  • Loading branch information
jiohjung98 committed Jun 9, 2024
1 parent 9a654fc commit bf314b2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/map/UseMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ const UseMap: React.FC = () => {
const [branchCount, SetBranchCount] = useState(0);
const [canBranchCount, SetCanBranchCount] = useState(0);
const [isIOS, setIsIOS] = useState(false);
const [isStandalone, setIsStandalone] = useState(false);

useEffect(() => {
const userAgent = window.navigator.userAgent;
if (/iPad|iPhone|iPod/.test(userAgent) && !(window as any).MSStream) {
setIsIOS(true);
}
setIsIOS(/iPad|iPhone|iPod/.test(userAgent) && !(window as any).MSStream);
setIsStandalone(window.matchMedia('(display-mode: standalone)').matches);
}, []);

useEffect(() => {
Expand Down Expand Up @@ -285,14 +285,13 @@ const UseMap: React.FC = () => {
/>
<button
id="current-location-button"
className={`absolute ${isModalOpen ? 'bottom-[300px]' : 'bottom-[105px]'} left-4 p-2 flex items-center justify-center ${isIOS ? 'mb-16' : ''}`}
className={`absolute ${isModalOpen ? 'bottom-[300px]' : 'bottom-[105px]'} left-4 p-2 flex items-center justify-center ${isIOS && !isStandalone ? 'mb-16' : ''}`}
onMouseEnter={() => setImageSrc('/map/MapLocationActive.png')}
onMouseLeave={() => setImageSrc('/map/MapLocation.png')}
onClick={handleCurrentLocationClick}
>
<Image src={imageSrc} alt="Current Location" width={48} height={48} />
</button>

{loading && (
<div className="absolute inset-0 bg-black bg-opacity-50 flex items-center justify-center">
<div className="loader"></div>
Expand Down

0 comments on commit bf314b2

Please sign in to comment.