-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlayout.tsx
More file actions
103 lines (90 loc) · 2.2 KB
/
layout.tsx
File metadata and controls
103 lines (90 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
'use client';
import Loader, { LoaderContainer } from '@/components/common/Loader';
import NavigatorBar from '@/components/common/NavigatorBar';
import ProgressBar from '@/components/common/ProgressBar';
import { theme } from '@/styles/theme';
import { usePathname, useSearchParams } from 'next/navigation';
import React, { Suspense } from 'react';
import styled from 'styled-components';
interface SendLayoutProps {
children: React.ReactNode;
}
const SendLayout = ({ children }: SendLayoutProps) => {
const pathname = usePathname();
const searchParams = useSearchParams();
const isGuest = searchParams.get('guest') === 'true';
const current =
pathname === '/send/receiver'
? 1
: pathname === '/send/content'
? 2
: isGuest
? pathname === '/send/sender'
? 3
: pathname === '/send/template'
? 4
: null
: pathname === '/send/template'
? 3
: null;
return (
<Container>
<NavigatorBarWrapper>
<NavigatorBar title="편지 보내기" cancel={false} />
</NavigatorBarWrapper>
{current && (
<ProgressBarWrapper>
<ProgressBar current={current} total={isGuest ? 4 : 3} />
</ProgressBarWrapper>
)}
{children}
</Container>
);
};
export default function SendLayouting({ children }: SendLayoutProps) {
return (
<Suspense
fallback={
<LoaderContainer>
<Loader />
</LoaderContainer>
}
>
<SendLayout>{children}</SendLayout>
</Suspense>
);
}
const Container = styled.div`
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow-x: hidden;
overflow-y: hidden;
gap: 7px;
padding: 20px;
background-color: ${theme.colors.bg};
position: relative;
@media (max-height: 550px) {
padding-top: 0px;
}
`;
const ProgressBarWrapper = styled.div`
width: 100%;
padding: 32px 0 72px 0;
@media (max-height: 795px) {
padding: 24px 0 40px 0;
}
@media (max-height: 650px) {
padding: 20px 0 36px 0;
}
@media (max-height: 580px) {
padding: 15px 0 36px 0;
}
`;
const NavigatorBarWrapper = styled.div`
width: 100%;
height: 44px;
display: flex;
position: relative;
`;