diff --git a/package.json b/package.json index 567d1d6..7a58440 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-intersection-observer": "^9.10.2", + "react-iphone-layout": "^1.1.1", "react-responsive-carousel": "^3.2.23", "react-router-dom": "6.22.2", "react-toastify": "^10.0.5", diff --git a/src/app/layout/RootLayout.tsx b/src/app/layout/RootLayout.tsx index 48594cb..58ce683 100644 --- a/src/app/layout/RootLayout.tsx +++ b/src/app/layout/RootLayout.tsx @@ -1,10 +1,20 @@ +import { IPhoneLayout } from 'react-iphone-layout'; +import 'react-iphone-layout/dist/ReactIPhoneLayout.css'; import { Outlet } from 'react-router-dom'; + import './RootLayout.scss'; +/** + * 🚨 ν˜„μž¬ μ μš©λ˜μ–΄ μžˆλŠ” IPhoneLayout은 DEV λͺ¨λ“œμ—μ„œλ§Œ ν™œμ„±ν™”λ˜μ–΄μ•Ό ν•˜μ§€λ§Œ, + * μ‹€μ œ 개발 μ„œλ²„μ—μ„œλ„ λ³Ό 수 μžˆλ„λ‘ ν•˜κΈ° μœ„ν•΄ λ”°λ‘œ μ²˜λ¦¬ν•˜μ§€ μ•Šκ² μŠ΅λ‹ˆλ‹€. + * ν•˜μ§€λ§Œ μ‹€μ œ PROD λͺ¨λ“œλ‘œ 배포할 κ²½μš°μ—λŠ” 을 μ œκ±°ν•΄μ£Όμ„Έμš”. + */ export const RootLayout = () => { return ( -
- -
+ +
+ +
+
); }; diff --git a/src/app/layout/iPhone/hooks/useUtilityIPhone.tsx b/src/app/layout/iPhone/hooks/useUtilityIPhone.tsx deleted file mode 100644 index 67b00d3..0000000 --- a/src/app/layout/iPhone/hooks/useUtilityIPhone.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import { useEffect, useRef } from 'react'; - -const IPHONE_MIN_SIZE = 75; -const IPHONE_INIT_SIZE = 75; -const IPHONE_MAX_SIZE = 100; - -const IPHONE_PROTRAIT_MODE = 0; // μ„Έλ‘œ λͺ¨λ“œ -const IPHONE_LANDSCAPE_MODE = -90; // κ°€λ‘œ λͺ¨λ“œ - -/** - * iPhone λ ˆμ΄μ•„μ›ƒμ˜ 크기λ₯Ό λ™μ μœΌλ‘œ λ³€κ²½ν•˜λŠ” ν›…μž…λ‹ˆλ‹€. - * @returns iPhone λ ˆμ΄μ•„μ›ƒμ˜ 참쑰와 μ‚¬μ΄μ¦ˆ λ³€κ²½ ν•Έλ“€λŸ¬ - */ -export const useUtilityIPhone = () => { - const iPhoneSizeRef = useRef(IPHONE_INIT_SIZE); - const iPhoneModeRef = useRef(IPHONE_PROTRAIT_MODE); - const iPhoneLayoutRef = useRef(null); - - useEffect(() => { - document.documentElement.style.setProperty( - '--iphone-size', - `${IPHONE_INIT_SIZE}%`, - ); - - document.documentElement.style.setProperty( - '--iphone-mode', - `${IPHONE_PROTRAIT_MODE}deg`, - ); - }, []); - - const changeStyle = () => { - if (iPhoneLayoutRef.current) { - iPhoneLayoutRef.current.style.height = `${iPhoneSizeRef.current}%`; - document.documentElement.style.setProperty( - '--iphone-size', - `${iPhoneSizeRef.current}%`, - ); - } - }; - - const handleSizeUp = () => { - if (iPhoneSizeRef.current >= IPHONE_MAX_SIZE) return; - - iPhoneSizeRef.current += 1; - changeStyle(); - }; - - const handleSizeDown = () => { - if (iPhoneSizeRef.current <= IPHONE_MIN_SIZE) return; - - iPhoneSizeRef.current -= 1; - changeStyle(); - }; - - const handleRotate = () => { - if (iPhoneModeRef.current === IPHONE_PROTRAIT_MODE) { - // κ°€λ‘œ λͺ¨λ“œλ‘œ λ³€κ²½ - iPhoneModeRef.current = IPHONE_LANDSCAPE_MODE; - document.documentElement.style.setProperty( - '--iphone-mode', - `${IPHONE_LANDSCAPE_MODE}deg`, - ); - } else { - // μ„Έλ‘œ λͺ¨λ“œλ‘œ λ³€κ²½ - iPhoneModeRef.current = IPHONE_PROTRAIT_MODE; - document.documentElement.style.setProperty( - '--iphone-mode', - `${IPHONE_PROTRAIT_MODE}deg`, - ); - } - }; - - return { iPhoneLayoutRef, handleRotate, handleSizeUp, handleSizeDown }; -}; diff --git a/src/app/layout/iPhone/index.ts b/src/app/layout/iPhone/index.ts deleted file mode 100644 index 2aea9c1..0000000 --- a/src/app/layout/iPhone/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { IPhoneLayout } from './ui'; diff --git a/src/app/layout/iPhone/ui/IPhoneLayout.scss b/src/app/layout/iPhone/ui/IPhoneLayout.scss deleted file mode 100644 index 0fa8431..0000000 --- a/src/app/layout/iPhone/ui/IPhoneLayout.scss +++ /dev/null @@ -1,92 +0,0 @@ -.iPhone-status, -.iPhone-utility-container { - display: none; -} - -@media (min-width: 1080px) { - .root-layout { - width: 100vw; - height: 100vh; - - background-color: #eff2f9; - - display: flex; - justify-content: center; - align-items: center; - - .iPhone-layout { - position: relative; - - background-image: url('/assets/image/iPhone.png'); - background-size: cover; - background-repeat: no-repeat; - background-position: center center; - - /* 아이폰 μ΄λ―Έμ§€μ˜ λΉ„μœ¨ μ„€μ • */ - aspect-ratio: 256 / 538; - height: var(--iphone-size); - rotate: var(--iphone-mode); - - transition: rotate 1.5s; - - .iPhone-status { - /* children의 크기λ₯Ό 아이폰 ν™”λ©΄ 크기에 맞게 μ„€μ • */ - display: block; - width: 100%; - background-color: white; - overflow: hidden; - - z-index: 9999; - position: sticky; - top: 0; - } - - .client-area { - /* children의 크기λ₯Ό 아이폰 ν™”λ©΄ 크기에 맞게 μ„€μ • */ - position: absolute; - bottom: 9.25%; - left: 3.5%; - right: 2.75%; - top: 10.3%; - - z-index: 32; - background-color: white; - - overflow-x: hidden; - } - - .iPhone-utility-container { - position: absolute; - left: 50%; - bottom: calc(2% + (var(--iphone-size) - 80%) * 0.025); - transform: translateX(-50%); - - display: flex; - align-items: center; - gap: 24px; - - .size-down-btn, - .rotation-btn, - .size-up-btn { - width: 40px; - height: 40px; - - border-radius: 50%; - border: 1px solid $gray5; - - color: white; - font-size: 24px; - - cursor: pointer; - } - } - } - } - - .Toastify__toast-container { - padding: 0; - margin-bottom: 0; - - bottom: calc(26% - (var(--iphone-size) - 60%) * 0.4); - } -} diff --git a/src/app/layout/iPhone/ui/IPhoneLayout.tsx b/src/app/layout/iPhone/ui/IPhoneLayout.tsx deleted file mode 100644 index 0ae508b..0000000 --- a/src/app/layout/iPhone/ui/IPhoneLayout.tsx +++ /dev/null @@ -1,37 +0,0 @@ -/** - * ν•΄λ‹Ή λ ˆμ΄μ•„μ›ƒμ€ DEV λͺ¨λ“œμ—μ„œλ§Œ ν™œμ„±ν™”λ˜λŠ” λ ˆμ΄μ•„μ›ƒμž…λ‹ˆλ‹€. - * 이 λ ˆμ΄μ•„μ›ƒμ€ 아이폰 λ ˆμ΄μ•„μ›ƒμ„ κ΅¬ν˜„ν•˜λ©°, 아이폰 λ ˆμ΄μ•„μ›ƒμ€ 1440px μ΄μƒμ˜ ν™˜κ²½μ—μ„œλ§Œ ν™•μΈν•˜μ‹€ 수 μžˆμŠ΅λ‹ˆλ‹€. - */ - -import { Outlet } from 'react-router-dom'; - -import { useUtilityIPhone } from '../hooks/useUtilityIPhone'; - -import iPhoneStatus from '/assets/image/iPhone_status.png'; -import './IPhoneLayout.scss'; - -export const IPhoneLayout = () => { - const { iPhoneLayoutRef, handleSizeDown, handleRotate, handleSizeUp } = - useUtilityIPhone(); - - return ( -
-
-
- - -
- -
- - -
-
-
- ); -}; diff --git a/src/app/layout/iPhone/ui/index.ts b/src/app/layout/iPhone/ui/index.ts deleted file mode 100644 index 092276f..0000000 --- a/src/app/layout/iPhone/ui/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { IPhoneLayout } from './IPhoneLayout'; diff --git a/src/app/layout/index.ts b/src/app/layout/index.ts index feb618f..8e1d631 100644 --- a/src/app/layout/index.ts +++ b/src/app/layout/index.ts @@ -1,2 +1 @@ -export { IPhoneLayout } from './iPhone'; export { RootLayout } from './RootLayout'; diff --git a/src/app/routers/index.tsx b/src/app/routers/index.tsx index 80215d9..468f196 100644 --- a/src/app/routers/index.tsx +++ b/src/app/routers/index.tsx @@ -3,17 +3,12 @@ import { createBrowserRouter, RouteObject } from 'react-router-dom'; import { FeedMainPage } from '@/pages/feed-main'; import { ProfileMainPage } from '@/pages/profile'; -import { IPhoneLayout } from '../layout'; +import { RootLayout } from '../layout'; -/** - * 🚨 ν˜„μž¬ iPhone Layout은 DEV λͺ¨λ“œμ—μ„œλ§Œ ν™œμ„±ν™”λ˜λŠ” λΆ€λΆ„μ΄μ§€λ§Œ, - * μ‹€μ œ PROD ν™˜κ²½μ—μ„œλ„ λ³Ό 수 μžˆλ„λ‘ ν•˜κΈ° μœ„ν•΄ λ”°λ‘œ μ²˜λ¦¬ν•˜μ§€ μ•Šκ² μŠ΅λ‹ˆλ‹€. - * ν•˜μ§€λ§Œ μ‹€μ œ PROD λͺ¨λ“œλ‘œ 배포할 κ²½μš°μ—λŠ” 을 μ œκ±°ν•˜κ³  으둜 λ³€κ²½ν•΄μ£Όμ„Έμš”. - */ const root: RouteObject[] = [ { path: '/', - element: , + element: , children: [ { index: true, element: }, { path: 'users/:userId', element: }, diff --git a/yarn.lock b/yarn.lock index ee6671a..454e388 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3557,6 +3557,14 @@ react-intersection-observer@^9.10.2: resolved "https://registry.yarnpkg.com/react-intersection-observer/-/react-intersection-observer-9.10.2.tgz#d5b14f80c9a6bed525becc228db7dccac5d0ec1c" integrity sha512-j2hGADK2hCbAlfaq6L3tVLb4iqngoN7B1fT16MwJ4J16YW/vWLcmAIinLsw0lgpZeMi4UDUWtHC9QDde0/P1yQ== +react-iphone-layout@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/react-iphone-layout/-/react-iphone-layout-1.1.1.tgz#d1cc3e758ce61d33d210d45728f8ae36b4d2e9ac" + integrity sha512-Xg6bq7IzSf6tg8hNCKntjSF0s7Ao3+QlqYUEWDgMpHMBvZ209dz7Ezg6EKAErAn16HTxTI9s5dAefY6L8R0Mxg== + dependencies: + react "^18.2.0" + react-dom "^18.2.0" + react-is@^16.13.1: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"