
๐ก์ฌ์ฉํด๋ณด๋ฉด์ ๊ด์ฐฎ์๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๊ณ์ ์ถ๊ฐํ๋ ํฌ์คํ ์ ๋๋ค.
๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ฐ๋ฉด ๊ด์ฐฎ์ ๊ฒ ๊ฐ๋ค!
data๋ฐ์ธ๋ฉ์ด ๋๋๊ณ ํ์ด์ง๋ฅผ ์คํ์ผ๋ง์ ํด๋ณด๊ธฐ๋ก ํ๋ค.
์ง์ ์ฝ๋๋ก position์ ์ฐ์ด๊ฐ๋ฉด์ ์ ๋๋ฉ์ด์
์ ๋ง๋๋ ๋ฐฉ๋ฒ๋ ์์ง๋ง, ์๊ฐ๋ ์ค๋ ๊ฑธ๋ฆด ๋ฟ ๋๋ผ ๊ทธ๋ฐ ๋ฅ๋ ฅ์ ์๋ค! ๊ทธ๋ฌ๋ฏ๋ก ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ํ์ฉํด์ ์ข๋ ๋์ ์ธ ํจ๊ณผ๋ฅผ ๋ด๋ณด๋ ๊ฒ์ด ๋ชฉํ์ด๋ค.
โจ๋ฆฌ์กํธ๋ถํธ์คํธ๋ฉ
emotion, react-spinner๋ ๋ณด์์ง๋ง emotion์ ์์ง ์ดํด๊ฐ ์ ์๋ผ๊ณ ... react-spinner๋ํ ๋ญ๊ฐ ์ฑ์ ์์ฐจ๋ ์์ค ๋ฐ๊ฒฌํ react bootstrap.
spinner ๋ง๊ณ ๋ ๋ค์ํ component๋ฅผ ์ ๊ณตํด์ฃผ๊ธฐ ๋๋ฌธ์ ์ ์ฌ์ฉ ํ ์ ์์ ๊ฒ ๊ฐ๋ค.
react bootstrap์ ์ฌ์ฉํ๊ธฐ ์ํด์๋ vanilla bootstrap์ด ์ค์น๋์ด ์์ด์ผํ๋ค.
npm install react-bootstrap
npm install bootstrap
์คํผ๋๋ถํฐ ๋ฒํผ, ๋ชจ๋ฌ, ํ
์ด๋ธ๊น์ง ๋ค์ํ ์ต์
๋ค์ด ๋ง์์ ์์ ํ์ด์ง๋ฅผ ์ฝ๊ฒ ๋ง๋ค ์ ์๋ค.
โจํ๋์ด๋จธ ๋ชจ์
์ ๋๋งค์ด์
ํจ๊ณผ๋ฅผ ์ฝ๊ณ ๋ค์ํ๊ฒ ๊ตฌํํ ์ ์๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ.
์ฌ์ฉ๋ฒ ๋ํ ๊ฐ๋จํ๋ค.
npm i framer-motion
๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ธ์คํจ ํ ๋ค์์, ํ์ํ ํ์ด์ง์ ์ํฌํธ ํ๋ฉด ๋๋ค.
import { motion } from "framer-motion"
HTMLํ๊ทธ ์์ motion์ ๋ถ์ฌ์ motion component ํ์ฌ ์ฌ์ฉํ๋ค.
์ด๊ธฐ ์ํ๋ ์์ฑinitial๋ก, ์ ๋๋ฉ์ด์
์ํ๋ ์์ฑ animate๋ก ๊ฐ๊ฐ ๊ฐ์ฒดํํ๋ก ๋ฃ์ด์ค๋ค.
//์์
<motion.h1
className="mainTt"
whileInView={{
opacity: 1,
rotate: [0, 360],
transition: { delay: 0.05 },
}}
whileHover={{
scale: 1.1,
transition: {
type: 'spring',
stiffness: 400,
damping: 10,
},
}}
>
Hello! this is thetititle's portfolio
<em>.</em>
</motion.h1>
์ต์
์ด ๋ง์ ๋งํผ ๊ผผ๊ผผํ ์ดํด๋ด์ผํ์ง๋ง ๊ต์ฅํ ๋ง์์ ๋๋ ํจ๊ณผ๋ฅผ ์ป์ ์ ์์๋ค.
โจreact-device-detect
๋ฆฌ์กํธ์์ ์ฌ์ฉํ๋ ๋๋ฐ์ด์ค ์ฒดํฌ ๋ผ์ด๋ธ๋ฌ๋ฆฌ.
์ฌ์ฉ๋ฐฉ๋ฒ๋ ๊ต์ฅํ ๊ฐํธํ๋ค.
import { MobileView, isMobile } from 'react-device-detect';
๋ชจ๋ฐ์ผ์ธ์ง ์ฒดํฌํ ์๊ฐ์ด๋ผ๋ฉด ์์ ํ์๋๋ก ์ํฌํธํ๋ฉด ๋๋ค.
API์ Selectors๋ฅผ ์ฐธ๊ณ ํ์ฌ ๋ค์ํ ๋๋ฐ์ด์ค๋ฅผ ํ์ธํ ์ ์์ด์ ์ข์๋ค.