프론트엔드
-
[React] React.js로 전화걸기 링크 제공 하기프론트앤드/[React] 2023. 4. 22. 20:54
기업협업중 import React from 'react'; import { CopyToClipboard } from 'react-copy-to-clipboard'; import * as S from './CallModal.style'; const CallModal = ({ detailMartList, handleModal }) => { const handleCopy = () => { alert('복사되었습니다.'); }; return ( {detailMartList[0].martPhoneNumber.replace( /(\d{2})(\d{3,4})(\d{4})/, '$1-$2-$3' )} 전화 걸기 연락처 저장하기 클립보드 복사하기 ); }; export default CallModal; 부모 컴포넌트로 ..
-
[React] 인터넷 연결확인 모달 + 컴포넌트 종료(?) 나가기프론트앤드/[React] 2023. 4. 5. 16:52
매일매일이 새롭당 : ) 하핳 이 전 포스팅에서는 인터넷 연결 확인 및 경고 모달을 띄웠다면, https://hayley-0616.tistory.com/47 [React] 인터넷 연결확인 및 경고모달 기업협업 중이당...ㅎ 이 전 포스트 글과 마찬가지로, login ->home 으로 이어지는데 이 때, login 컴포넌트가 제일 처음 랜더링 될 때, 인터넷 연결을 확인하고, 만약 안되어 있는경우에는 경고모달을 hayley-0616.tistory.com 이 번 포스팅에서는 모달의 '확인'을 누른 경우 컴포넌트가 종료(?) 혹은 나가지는 로직을 구현해 보았다. 점점 새로운것을 알게되면서 적용하니 아주 신기하다눙.. 👀 Login.jsx (부모컴포넌트) 에서 선언 => props 로 NetworkCheckMo..
-
[React] 인터넷 연결확인 및 경고모달프론트앤드/[React] 2023. 4. 5. 11:48
기업협업 중이당...ㅎ 이 전 포스트 글과 마찬가지로, login ->home 으로 이어지는데 이 때, login 컴포넌트가 제일 처음 랜더링 될 때, 인터넷 연결을 확인하고, 만약 안되어 있는경우에는 경고모달을 띄우는 로직을 구현하였다. 정말.. 기업협업하면서 여러가지를 시도하고있다... 레벨업 중.. ㅎ_ㅎ 1. 연결확인을 위한 useEffect useEffect(() => { const checkConnection = async () => { try { const response = await fetch('https://www.google.com', { mode: 'no-cors' }); const status = response && response.status; if (status === 200..
-
[React] React에서 setTimeout 매서드로 스플래쉬(Splash) 구현하기프론트앤드/[React] 2023. 4. 4. 14:43
기업협업중이다 😂 React Native로 모바일 앱을 많이 구현하지만 아직 RN은 미숙하기때문에.. React.js 로 Splash 구현을 해 보았다. 현재 프로젝트에서는 앱으로 들어가면 바로 login -> home 으로 갈 수 있게 구현해야 했다. 그래서 splash는 login.jsx에 구현하였다. 1. HomeSplash.jsx 만들기 import React from 'react'; import * as S from './HomeSplash.style'; const HomeSplash = () => { return ( ); }; export default HomeSplash; 2. Splash 넣을 컴포넌트 가서 추가해주기 import HomeSplash from '../Home/HomeComp..
-
[React] 네이버 지도 API 이용 캐러셀 + center 움직이기프론트앤드/[React] 2023. 3. 31. 18:06
지난 포스트에 Marker 누를때 해당 정보를 가진 캐러셀이 맨 첫번 째 슬라이드로 보이게 하는 것을 정리 했었는데 (참고) https://hayley-0616.tistory.com/43 [React] 네이버 지도 API 이용 + Slick 캐러셀 띄우기 기업협업 중이다.. 여전히 Home을 맡았는데, 홈 자체가 네이버 지도를 불러와서 각각 Marker 를 클릭하면 그 Marker(가게) 의 정보가 담긴 캐러셀이 나오게 해야했다! 처음에 했을때는, Marker를 누르면 hayley-0616.tistory.com 이번에는, Marker을 눌렀을 때, 해당 데이터 같이 불러오는 캐러셀도 보이기 + 센터 좌표 바뀌기 를 해 보았다. 정리를 또 해 보겠다.... 이번에도.. 어려웠다... 지도 api.. 정말 ..
-
[React] 네이버 지도 API 이용 + Slick 캐러셀 띄우기프론트앤드/[React] 2023. 3. 31. 14:06
기업협업 중이다.. 여전히 Home을 맡았는데, 홈 자체가 네이버 지도를 불러와서 각각 Marker 를 클릭하면 그 Marker(가게) 의 정보가 담긴 캐러셀이 나오게 해야했다! 처음에 했을때는, Marker를 누르면 해당 정보들은 모두 나오는데, 캐러셀 형태로 나오지않았어서 애를 먹었다... 일단 코드를 보면서 정리를 해 보겠다. 아직 데이터가 완성되지 않아서 Mock data 를 이용했다. 📌 여기가 부모컴포넌트인 Home const Home = () => { const [homeMartList, setHomeMartList] = useState([]); const [selectedMart, setSelectedMart] = useState(null); const handleMarkerClick = ..
-
[React] 로그인 구현 + 비밀번호 보이게 기능 코드정리프론트앤드/[React] 2023. 3. 27. 15:26
기업협업중이다. 로그인 페이지부터 맡았는데, westagram 을 하고 난 뒤 그 후로는 카카오로그인을 맡았던 터라.. (?) 구현하는방법이 긴가민가..했다 그래서 기억기억 🤨 여차저차 생각해냈다! 기억난 김에 블로그에 정리해야지 🙋🏻♀️ 일단 처음에 적은 코드이고, 여기서는 백엔드와 해야하는 통신을 하는 로직은 주석처리해서 따로 여기에 적지는 않았다! //Login.jsx const Login = () => { const navigate = useNavigate(); const [inputId, setInputId] = useState(''); const [inputPw, setInputPw] = useState(''); const [showPw, setShowPw] = useState(false);..
-
[React] 네이버 지도 API 이용 주소->좌표 구하기프론트앤드/[React] 2023. 3. 22. 13:21
1. 서브module 로드 하기 원래 naver api를 로드하던 index.html 파일에 &modules=geocoder를 추가한다. 주소-> 좌표로 변환 import React, { useEffect } from 'react'; import { Container as MapDiv, NaverMap, Marker, useNavermaps, } from 'react-naver-maps'; import * as S from './Home.style'; const Home = () => { // useEffect(()=>{ // if (인터넷연결 확인 = true) // {Navigate("스플래시 링크")} // else { // alert("문제 발생") // 앱종료되는 로직 // } // },[]) ..