@daeryun/dr_components 1.1.55 → 1.1.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Daeryuntalk/index.jsx +58 -0
- package/dist/components/Daeryuntalk/index.tsx +66 -0
- package/dist/components/page/Notice/NoticeList.jsx +29 -24
- package/dist/components/page/Notice/NoticeList.tsx +35 -24
- package/dist/styles/daeryuntalk.css +14 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -8,10 +8,13 @@ import mobile from 'is-mobile';
|
|
|
8
8
|
import Head from 'next/head';
|
|
9
9
|
import { usePathname } from 'next/navigation';
|
|
10
10
|
import ViewportHandler from './ViewportHandler';
|
|
11
|
+
import { useWindowSize } from './_hooks/useWindowSize';
|
|
11
12
|
const Daeryuntalk = ({ tel = '1800-7905', centerCode = 'CT0000', bannerHeight = 0 }) => {
|
|
12
13
|
const [isOpen, setIsOpen] = useState(false);
|
|
13
14
|
const [isMobile, setIsMobile] = useState(false);
|
|
14
15
|
const pathName = usePathname();
|
|
16
|
+
const windowSize = useWindowSize();
|
|
17
|
+
const isMobileSize = windowSize.width <= 480;
|
|
15
18
|
// const isMobile = mobile();
|
|
16
19
|
const [hashValue, setHashValue] = useState(null);
|
|
17
20
|
const [showCustomTitle, setShowCustomTitle] = useState(false); // ← 추가
|
|
@@ -89,10 +92,65 @@ const Daeryuntalk = ({ tel = '1800-7905', centerCode = 'CT0000', bannerHeight =
|
|
|
89
92
|
document.body.style.overflow = '';
|
|
90
93
|
};
|
|
91
94
|
}, [isOpen, isMobile]);
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (!((isMobileSize || isMobile) && isOpen))
|
|
97
|
+
return;
|
|
98
|
+
const { body, documentElement } = document;
|
|
99
|
+
// 현재 스크롤 위치 저장
|
|
100
|
+
const scrollY = window.scrollY || documentElement.scrollTop || body.scrollTop || 0;
|
|
101
|
+
// 스크롤 잠금 (iOS 대응: position: fixed + top 보정)
|
|
102
|
+
body.style.position = 'fixed';
|
|
103
|
+
body.style.top = `-${scrollY}px`;
|
|
104
|
+
body.style.left = '0';
|
|
105
|
+
body.style.right = '0';
|
|
106
|
+
body.style.width = '100%';
|
|
107
|
+
body.style.overflow = 'hidden'; // 안드/데스크탑용
|
|
108
|
+
// 불필요한 끌어내리기 방지
|
|
109
|
+
documentElement.style.overscrollBehavior = 'none'; // 모바일 브라우저 안전
|
|
110
|
+
// (선택) 스크롤바 보정: 데스크탑에서 레이아웃 점프 방지
|
|
111
|
+
// const scrollBarW = window.innerWidth - documentElement.clientWidth;
|
|
112
|
+
// if (scrollBarW > 0) body.style.paddingRight = `${scrollBarW}px`;
|
|
113
|
+
return () => {
|
|
114
|
+
// 해제 + 스크롤 복원
|
|
115
|
+
body.style.position = '';
|
|
116
|
+
body.style.top = '';
|
|
117
|
+
body.style.left = '';
|
|
118
|
+
body.style.right = '';
|
|
119
|
+
body.style.width = '';
|
|
120
|
+
body.style.overflow = '';
|
|
121
|
+
// body.style.paddingRight = '';
|
|
122
|
+
documentElement.style.overscrollBehavior = '';
|
|
123
|
+
window.scrollTo(0, scrollY);
|
|
124
|
+
};
|
|
125
|
+
}, [isMobile, isOpen]);
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
if (!(isMobile && isOpen)) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
document.documentElement.classList.add('drtop-inflow-active');
|
|
131
|
+
return () => document.documentElement.classList.remove('drtop-inflow-active');
|
|
132
|
+
}, [isMobile, isOpen]);
|
|
133
|
+
// ios일 경우 확대영 class 추가
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
const ua = navigator.userAgent;
|
|
136
|
+
const isiOS = /iP(hone|od|ad)/.test(ua);
|
|
137
|
+
const isWebKit = /WebKit/.test(ua) && !/CriOS|FxiOS|OPiOS/.test(ua);
|
|
138
|
+
if (isiOS && isWebKit) {
|
|
139
|
+
document.documentElement.classList.add('ios');
|
|
140
|
+
return () => document.documentElement.classList.remove('ios');
|
|
141
|
+
}
|
|
142
|
+
}, []);
|
|
92
143
|
return (<div className="daeryuntalk-wrapper my-scroll-container">
|
|
93
144
|
{showCustomTitle && (<Head>
|
|
94
145
|
<title>법무법인 (유한)대륜 채팅상담</title>
|
|
95
146
|
</Head>)}
|
|
147
|
+
<style>
|
|
148
|
+
{`
|
|
149
|
+
@media (max-width: 360px) {
|
|
150
|
+
html.drtop-inflow-active #wrap { min-width: 0 !important; }
|
|
151
|
+
}
|
|
152
|
+
`}
|
|
153
|
+
</style>
|
|
96
154
|
<DaeryuntalkToastProvider>
|
|
97
155
|
<ViewportHandler isMobile={isMobile} isDisable={!isOpen || !isMobile}/>
|
|
98
156
|
<DaeryuntalkProvider propsTel={tel} isMobile={isMobile} onClose={closeModal} centerCode={currentCenterCode || ''}>
|
|
@@ -9,6 +9,7 @@ import mobile from 'is-mobile';
|
|
|
9
9
|
import Head from 'next/head';
|
|
10
10
|
import { usePathname } from 'next/navigation';
|
|
11
11
|
import ViewportHandler from './ViewportHandler';
|
|
12
|
+
import { useWindowSize } from './_hooks/useWindowSize';
|
|
12
13
|
|
|
13
14
|
type DaeryuntalkProps = {
|
|
14
15
|
tel?: string;
|
|
@@ -20,6 +21,8 @@ const Daeryuntalk: React.FC<DaeryuntalkProps> = ({ tel = '1800-7905', centerCode
|
|
|
20
21
|
const [isOpen, setIsOpen] = useState(false);
|
|
21
22
|
const [isMobile, setIsMobile] = useState(false);
|
|
22
23
|
const pathName = usePathname();
|
|
24
|
+
const windowSize = useWindowSize();
|
|
25
|
+
const isMobileSize = windowSize.width <= 480;
|
|
23
26
|
|
|
24
27
|
// const isMobile = mobile();
|
|
25
28
|
const [hashValue, setHashValue] = useState<string | null>(null);
|
|
@@ -109,6 +112,62 @@ const Daeryuntalk: React.FC<DaeryuntalkProps> = ({ tel = '1800-7905', centerCode
|
|
|
109
112
|
};
|
|
110
113
|
}, [isOpen, isMobile]);
|
|
111
114
|
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
if (!((isMobileSize || isMobile) && isOpen)) return;
|
|
117
|
+
|
|
118
|
+
const { body, documentElement } = document;
|
|
119
|
+
|
|
120
|
+
// 현재 스크롤 위치 저장
|
|
121
|
+
const scrollY = window.scrollY || documentElement.scrollTop || body.scrollTop || 0;
|
|
122
|
+
|
|
123
|
+
// 스크롤 잠금 (iOS 대응: position: fixed + top 보정)
|
|
124
|
+
body.style.position = 'fixed';
|
|
125
|
+
body.style.top = `-${scrollY}px`;
|
|
126
|
+
body.style.left = '0';
|
|
127
|
+
body.style.right = '0';
|
|
128
|
+
body.style.width = '100%';
|
|
129
|
+
body.style.overflow = 'hidden'; // 안드/데스크탑용
|
|
130
|
+
// 불필요한 끌어내리기 방지
|
|
131
|
+
documentElement.style.overscrollBehavior = 'none'; // 모바일 브라우저 안전
|
|
132
|
+
|
|
133
|
+
// (선택) 스크롤바 보정: 데스크탑에서 레이아웃 점프 방지
|
|
134
|
+
// const scrollBarW = window.innerWidth - documentElement.clientWidth;
|
|
135
|
+
// if (scrollBarW > 0) body.style.paddingRight = `${scrollBarW}px`;
|
|
136
|
+
|
|
137
|
+
return () => {
|
|
138
|
+
// 해제 + 스크롤 복원
|
|
139
|
+
body.style.position = '';
|
|
140
|
+
body.style.top = '';
|
|
141
|
+
body.style.left = '';
|
|
142
|
+
body.style.right = '';
|
|
143
|
+
body.style.width = '';
|
|
144
|
+
body.style.overflow = '';
|
|
145
|
+
// body.style.paddingRight = '';
|
|
146
|
+
documentElement.style.overscrollBehavior = '';
|
|
147
|
+
|
|
148
|
+
window.scrollTo(0, scrollY);
|
|
149
|
+
};
|
|
150
|
+
}, [isMobile, isOpen]);
|
|
151
|
+
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
if (!(isMobile && isOpen)) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
document.documentElement.classList.add('drtop-inflow-active');
|
|
157
|
+
return () => document.documentElement.classList.remove('drtop-inflow-active');
|
|
158
|
+
}, [isMobile, isOpen]);
|
|
159
|
+
|
|
160
|
+
// ios일 경우 확대영 class 추가
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
const ua = navigator.userAgent;
|
|
163
|
+
const isiOS = /iP(hone|od|ad)/.test(ua);
|
|
164
|
+
const isWebKit = /WebKit/.test(ua) && !/CriOS|FxiOS|OPiOS/.test(ua);
|
|
165
|
+
if (isiOS && isWebKit) {
|
|
166
|
+
document.documentElement.classList.add('ios');
|
|
167
|
+
return () => document.documentElement.classList.remove('ios');
|
|
168
|
+
}
|
|
169
|
+
}, []);
|
|
170
|
+
|
|
112
171
|
return (
|
|
113
172
|
<div className="daeryuntalk-wrapper my-scroll-container">
|
|
114
173
|
{showCustomTitle && (
|
|
@@ -116,6 +175,13 @@ const Daeryuntalk: React.FC<DaeryuntalkProps> = ({ tel = '1800-7905', centerCode
|
|
|
116
175
|
<title>법무법인 (유한)대륜 채팅상담</title>
|
|
117
176
|
</Head>
|
|
118
177
|
)}
|
|
178
|
+
<style>
|
|
179
|
+
{`
|
|
180
|
+
@media (max-width: 360px) {
|
|
181
|
+
html.drtop-inflow-active #wrap { min-width: 0 !important; }
|
|
182
|
+
}
|
|
183
|
+
`}
|
|
184
|
+
</style>
|
|
119
185
|
<DaeryuntalkToastProvider>
|
|
120
186
|
<ViewportHandler isMobile={isMobile} isDisable={!isOpen || !isMobile} />
|
|
121
187
|
<DaeryuntalkProvider
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React, { useState, useEffect } from 'react';
|
|
3
|
-
import { useRouter } from 'next/
|
|
3
|
+
import { useRouter } from 'next/navigation';
|
|
4
4
|
import Link from 'next/link';
|
|
5
5
|
import SearchBar from '../../SearchBar/SearchBar';
|
|
6
6
|
import PageTitleBox from '../../PageTitleBox/PageTitleBox';
|
|
@@ -25,8 +25,9 @@ const NoticeList = ({ noticeList = [], noticeName = [] }) => {
|
|
|
25
25
|
// 검색 및 필터링 로직
|
|
26
26
|
useEffect(() => {
|
|
27
27
|
var _a;
|
|
28
|
-
const
|
|
29
|
-
const
|
|
28
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
29
|
+
const searchTxt = String(urlParams.get('search') || '').toLowerCase();
|
|
30
|
+
const searchFilter = String(urlParams.get('nameFilter') || '');
|
|
30
31
|
let searchResultList = [];
|
|
31
32
|
if (!searchFilter || searchFilter === '전체') {
|
|
32
33
|
searchResultList = (noticeList || []).filter((item) => { var _a, _b; return ((_a = item.title) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTxt)) || ((_b = item.summary) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTxt)); });
|
|
@@ -42,41 +43,45 @@ const NoticeList = ({ noticeList = [], noticeName = [] }) => {
|
|
|
42
43
|
setTotal(searchResultList.length);
|
|
43
44
|
setSearch(searchTxt || '');
|
|
44
45
|
setSearchInput(searchTxt || '');
|
|
45
|
-
setCurrentPage(Number(
|
|
46
|
-
}, [
|
|
46
|
+
setCurrentPage(Number(urlParams.get('page')) || 1);
|
|
47
|
+
}, [noticeList, noticeName]);
|
|
47
48
|
// 핸들러 함수들
|
|
48
49
|
const handleInputChange = (e) => {
|
|
49
50
|
setSearchInput(e.currentTarget.value);
|
|
50
51
|
};
|
|
51
52
|
const handleSearch = () => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
const params = new URLSearchParams();
|
|
54
|
+
params.set('page', '1');
|
|
55
|
+
if (searchInput) {
|
|
56
|
+
params.set('search', searchInput);
|
|
57
|
+
}
|
|
58
|
+
if (nameFilter.code_name && nameFilter.code_name !== '전체') {
|
|
59
|
+
params.set('nameFilter', nameFilter.code_name);
|
|
60
|
+
}
|
|
61
|
+
router.push(`/notice?${params.toString()}`);
|
|
58
62
|
setSearch(searchInput);
|
|
59
63
|
};
|
|
60
64
|
const handlePaginationChange = (pageNum) => {
|
|
61
|
-
const
|
|
65
|
+
const params = new URLSearchParams();
|
|
66
|
+
params.set('page', pageNum.toString());
|
|
62
67
|
if (search) {
|
|
63
|
-
|
|
68
|
+
params.set('search', search);
|
|
64
69
|
}
|
|
65
70
|
if (nameFilter.code_name && nameFilter.code_name !== '전체') {
|
|
66
|
-
|
|
71
|
+
params.set('nameFilter', nameFilter.code_name);
|
|
67
72
|
}
|
|
68
|
-
router.push({
|
|
69
|
-
pathname: '/notice',
|
|
70
|
-
query: queryParams
|
|
71
|
-
});
|
|
73
|
+
router.push(`/notice?${params.toString()}`);
|
|
72
74
|
};
|
|
73
75
|
const handleCategoryClick = (categoryName) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
const params = new URLSearchParams();
|
|
77
|
+
params.set('page', '1');
|
|
78
|
+
if (search) {
|
|
79
|
+
params.set('search', search);
|
|
80
|
+
}
|
|
81
|
+
if (categoryName && categoryName !== '전체') {
|
|
82
|
+
params.set('nameFilter', categoryName);
|
|
83
|
+
}
|
|
84
|
+
router.push(`/notice?${params.toString()}`);
|
|
80
85
|
};
|
|
81
86
|
return (<>
|
|
82
87
|
<PageTitleBox titleTxt={'공지사항'} subTxt={<>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import React, { useState, useEffect } from 'react';
|
|
4
|
-
import { useRouter } from 'next/
|
|
4
|
+
import { useRouter } from 'next/navigation';
|
|
5
5
|
|
|
6
6
|
// 스토리북용 전역 타입 선언
|
|
7
7
|
declare global {
|
|
@@ -60,8 +60,9 @@ const NoticeList = ({ noticeList = [], noticeName = [] }: NoticeListProps) => {
|
|
|
60
60
|
|
|
61
61
|
// 검색 및 필터링 로직
|
|
62
62
|
useEffect(() => {
|
|
63
|
-
const
|
|
64
|
-
const
|
|
63
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
64
|
+
const searchTxt = String(urlParams.get('search') || '').toLowerCase();
|
|
65
|
+
const searchFilter = String(urlParams.get('nameFilter') || '');
|
|
65
66
|
|
|
66
67
|
let searchResultList = [];
|
|
67
68
|
|
|
@@ -85,8 +86,8 @@ const NoticeList = ({ noticeList = [], noticeName = [] }: NoticeListProps) => {
|
|
|
85
86
|
setTotal(searchResultList.length);
|
|
86
87
|
setSearch(searchTxt || '');
|
|
87
88
|
setSearchInput(searchTxt || '');
|
|
88
|
-
setCurrentPage(Number(
|
|
89
|
-
}, [
|
|
89
|
+
setCurrentPage(Number(urlParams.get('page')) || 1);
|
|
90
|
+
}, [noticeList, noticeName]);
|
|
90
91
|
|
|
91
92
|
// 핸들러 함수들
|
|
92
93
|
const handleInputChange = (e: React.FormEvent<HTMLInputElement>) => {
|
|
@@ -94,39 +95,49 @@ const NoticeList = ({ noticeList = [], noticeName = [] }: NoticeListProps) => {
|
|
|
94
95
|
};
|
|
95
96
|
|
|
96
97
|
const handleSearch = () => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
98
|
+
const params = new URLSearchParams();
|
|
99
|
+
params.set('page', '1');
|
|
100
|
+
|
|
101
|
+
if (searchInput) {
|
|
102
|
+
params.set('search', searchInput);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (nameFilter.code_name && nameFilter.code_name !== '전체') {
|
|
106
|
+
params.set('nameFilter', nameFilter.code_name);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
router.push(`/notice?${params.toString()}`);
|
|
103
110
|
setSearch(searchInput);
|
|
104
111
|
};
|
|
105
112
|
|
|
106
113
|
const handlePaginationChange = (pageNum: number) => {
|
|
107
|
-
const
|
|
114
|
+
const params = new URLSearchParams();
|
|
115
|
+
params.set('page', pageNum.toString());
|
|
108
116
|
|
|
109
117
|
if (search) {
|
|
110
|
-
|
|
118
|
+
params.set('search', search);
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
if (nameFilter.code_name && nameFilter.code_name !== '전체') {
|
|
114
|
-
|
|
122
|
+
params.set('nameFilter', nameFilter.code_name);
|
|
115
123
|
}
|
|
116
124
|
|
|
117
|
-
router.push({
|
|
118
|
-
pathname: '/notice',
|
|
119
|
-
query: queryParams
|
|
120
|
-
});
|
|
125
|
+
router.push(`/notice?${params.toString()}`);
|
|
121
126
|
};
|
|
122
127
|
|
|
123
128
|
const handleCategoryClick = (categoryName: string) => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
129
|
+
const params = new URLSearchParams();
|
|
130
|
+
params.set('page', '1');
|
|
131
|
+
|
|
132
|
+
if (search) {
|
|
133
|
+
params.set('search', search);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (categoryName && categoryName !== '전체') {
|
|
137
|
+
params.set('nameFilter', categoryName);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
router.push(`/notice?${params.toString()}`);
|
|
130
141
|
};
|
|
131
142
|
|
|
132
143
|
return (
|
|
@@ -52,6 +52,20 @@
|
|
|
52
52
|
overflow-wrap: anywhere;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/* ios 확대 방지용 */
|
|
56
|
+
html.ios .daeryuntalk-wrapper .ProseMirror,
|
|
57
|
+
html.ios .daeryuntalk-wrapper [contenteditable="true"] {
|
|
58
|
+
font-size: 16px !important; /* ✅ 핵심: 자동 확대 방지 */
|
|
59
|
+
line-height: 22px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
html.ios .daeryuntalk-wrapper input,
|
|
63
|
+
html.ios .daeryuntalk-wrapper textarea,
|
|
64
|
+
html.ios .daeryuntalk-wrapper select {
|
|
65
|
+
font-size: 16px !important; /* ✅ 일반 입력들도 방지 */
|
|
66
|
+
line-height: 22px;
|
|
67
|
+
}
|
|
68
|
+
|
|
55
69
|
@layer components {
|
|
56
70
|
|
|
57
71
|
/* Titles */
|