Skip to content

Commit f34a97b

Browse files
authored
Merge pull request #6 from DevKor-github/feat/#5/view-layout
[#5] View ๋ ˆ์ด์•„์›ƒ ๊ด€๋ จ ์„ค์ • !
2 parents df9a983 + 01d3726 commit f34a97b

5 files changed

Lines changed: 40 additions & 10 deletions

File tree

โ€Žindex.htmlโ€Ž

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
66
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/reset-css@4.0.1/reset.min.css" />
77
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" />
8-
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width, user-scalable=no" />
8+
<meta
9+
name="viewport"
10+
content="minimum-scale=1, initial-scale=1, width=device-width, user-scalable=no, viewport-fit=cover"
11+
/>
912
<title>Repicka</title>
1013
</head>
1114
<body>
12-
<div id="root"></div>
15+
<div id="root" style="position: fixed; top: 0; right: 0; bottom: 0; left: 0"></div>
1316
<script type="module" src="/src/main.tsx"></script>
1417
</body>
1518
</html>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import type { PropsWithChildren } from 'react';
2+
3+
import { AppScreen } from '@stackflow/plugin-basic-ui';
4+
5+
/**
6+
* ๋ชจ๋ฐ”์ผ์—์„œ ๋ดค์„ ๋•Œ ์งค๋ฆผ ์˜์—ญ์ด (์•„๋งˆ๋„)์—†๋Š” AppScreen
7+
*/
8+
const AppScreenWithSafeArea = ({ children }: PropsWithChildren) => {
9+
return (
10+
<AppScreen>
11+
<div
12+
style={{
13+
position: 'absolute',
14+
top: 'calc(env(safe-area-inset-top))',
15+
left: 'calc(env(safe-area-inset-left))',
16+
right: 'calc(env(safe-area-inset-right))',
17+
}}
18+
>
19+
{children}
20+
</div>
21+
</AppScreen>
22+
);
23+
};
24+
export default AppScreenWithSafeArea;

โ€Žsrc/pages/HomePage.tsxโ€Ž

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
import { useFlow } from '@/libs/routes/stack';
2-
import { AppScreen } from '@stackflow/plugin-basic-ui';
32
import type { ActivityComponentType } from '@stackflow/react';
43
import { css } from '@styled-system/css';
54

5+
import AppScreenWithSafeArea from '@/common/components/AppScreenWithSafeArea';
6+
67
const HomePage: ActivityComponentType = () => {
78
const { push } = useFlow();
89
return (
9-
<AppScreen>
10+
<AppScreenWithSafeArea>
1011
<h1>๋ฆฌํ”ผ์นด ์งฑ</h1>
1112
<div className={css({ display: 'flex', flexDirection: 'column', gap: '1rem' })}>
1213
<a href={`${import.meta.env.VITE_API_URL}/oauth2/authorization/kakao`}>์นด์นด์˜คํ†ก ๋กœ๊ทธ์ธ</a>
1314
<a href={`${import.meta.env.VITE_API_URL}/oauth2/authorization/google`}>๊ตฌ๊ธ€ ๋กœ๊ทธ์ธ</a>
1415
<i>๋ฐฑ์—”๋“œ์—๋ชฝ ๋กœ๊ทธ์ธ ๊ณ ์ณ์ค˜</i>
1516
<button onClick={() => push('PostPage', {})}>์ด๋™</button>
1617
</div>
17-
</AppScreen>
18+
</AppScreenWithSafeArea>
1819
);
1920
};
2021

โ€Žsrc/pages/NotFoundPage.tsxโ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { AppScreen } from '@stackflow/plugin-basic-ui';
21
import type { ActivityComponentType } from '@stackflow/react';
32

3+
import AppScreenWithSafeArea from '@/common/components/AppScreenWithSafeArea';
4+
45
const NotFoundPage: ActivityComponentType = () => {
5-
return <AppScreen>ํŽ˜์ด์ง€๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์–ด์š” . . .</AppScreen>;
6+
return <AppScreenWithSafeArea>ํŽ˜์ด์ง€๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์–ด์š” . . .</AppScreenWithSafeArea>;
67
};
78
export default NotFoundPage;

โ€Žsrc/pages/PostPage.tsxโ€Ž

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import type { ActivityComponentType } from '@stackflow/react';
2-
import { AppScreen } from '@stackflow/plugin-basic-ui';
32
import { useFlow } from '@/libs/routes/stack';
43
import { css } from '@styled-system/css';
54

5+
import AppScreenWithSafeArea from '@/common/components/AppScreenWithSafeArea';
6+
67
const PostPage: ActivityComponentType = () => {
78
const { pop } = useFlow();
89

910
return (
10-
<AppScreen>
11+
<AppScreenWithSafeArea>
1112
<button
1213
className={css({
1314
padding: '1rem',
@@ -19,7 +20,7 @@ const PostPage: ActivityComponentType = () => {
1920
๋’ค๋กœ๊ฐ€๊ธฐ
2021
</button>
2122
<div>ํ…Œ์ŠคํŠธ ํ…Œ์ŠคํŠธ ํฌ์ŠคํŠธ ํŽ˜์ด์ง€</div>
22-
</AppScreen>
23+
</AppScreenWithSafeArea>
2324
);
2425
};
2526
export default PostPage;

0 commit comments

Comments
ย (0)