@daeryun/dr_components 0.1.8 → 0.1.10

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.
@@ -0,0 +1,239 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import style from './TopBanner.module.css';
11
+ import { useEffect, useState, useCallback } from 'react';
12
+ import 'swiper/css';
13
+ import { Swiper, SwiperSlide } from 'swiper/react';
14
+ import { Autoplay } from 'swiper/modules';
15
+ import Image from 'next/image';
16
+ import { useQuery } from 'react-query';
17
+ import { isCurrentTimeWithinPopupRange, paramFetch } from '../../lib';
18
+ import { DateTime } from 'luxon';
19
+ import classNames from 'classnames';
20
+ const TopBanner = () => {
21
+ //이미지 패스
22
+ const ImagePath = process.env.NEXT_PUBLIC_S3_URL + '';
23
+ //팝업 리스트
24
+ const [popup, setPopup] = useState([]);
25
+ const [isTop, setIsTop] = useState(true);
26
+ const addClickCnt = (idx) => {
27
+ paramFetch('https://mng.daeryunlaw.com/api/popup/top/click', { idx: idx }, null);
28
+ };
29
+ const handleScroll = useCallback(() => {
30
+ const scrollElm = document.scrollingElement;
31
+ if (scrollElm !== null) {
32
+ const scrollTop = Math.max(scrollElm.scrollTop, document.body.scrollTop);
33
+ if (scrollTop > 0) {
34
+ setIsTop(false);
35
+ }
36
+ else {
37
+ setIsTop(true);
38
+ }
39
+ }
40
+ }, []);
41
+ useEffect(() => {
42
+ const handleScroll = () => {
43
+ setIsTop(window.scrollY <= 0);
44
+ };
45
+ // Add scroll event listener
46
+ window.addEventListener('scroll', handleScroll);
47
+ // Remove scroll event listener on component unmount
48
+ return () => {
49
+ window.removeEventListener('scroll', handleScroll);
50
+ };
51
+ }, []);
52
+ useEffect(() => {
53
+ setIsTop(true);
54
+ document.addEventListener('scroll', handleScroll);
55
+ return () => {
56
+ document.removeEventListener('scroll', handleScroll); //clean up
57
+ };
58
+ }, [handleScroll]);
59
+ //userQuery
60
+ useQuery({
61
+ queryKey: ['popUpImg'],
62
+ queryFn: () => getPopUpData(),
63
+ //브라우저 화면을 focus할 때 새로 api를 호출할 건지 설정하는 옵션
64
+ refetchOnWindowFocus: false,
65
+ //기본설정 cacheTime:5분, staleTime:0초, 값을 Infinity로 설정할 경우 api return 값이 바뀌지 않는 이상 서버에 새로 요청하지 않고 캐싱된 데이터를 영구적으로 사용하여 api 호출 최적화
66
+ cacheTime: Infinity,
67
+ staleTime: Infinity,
68
+ onSuccess: (res) => {
69
+ const kstDateTime = DateTime.now().setZone('Asia/Seoul');
70
+ const nowDate = Number(kstDateTime.year + '' + zeroMaker(kstDateTime.month) + '' + zeroMaker(kstDateTime.day));
71
+ const nowTime = Number(zeroMaker(kstDateTime.hour) + zeroMaker(kstDateTime.minute));
72
+ const weekday = kstDateTime.weekdayShort + '';
73
+ const dateData = res.list.filter((item) => findDate(item, 'start') <= nowDate &&
74
+ findDate(item, 'end') >= nowDate &&
75
+ findDays(item, weekday) &&
76
+ findTime(item, nowTime));
77
+ setPopup(dateData.filter((item) => !(localStorage.getItem(item.idx + '_CloseTopPop') &&
78
+ Number(localStorage.getItem(item.idx + '_CloseTopPop')) > new Date().getTime())));
79
+ }
80
+ });
81
+ const findDays = (item, today) => {
82
+ if (item.days) {
83
+ return item.days.includes(today);
84
+ }
85
+ else {
86
+ return false;
87
+ }
88
+ };
89
+ const findDate = (item, key) => {
90
+ if (key === 'start') {
91
+ const start = new Date(item.start_at).toISOString().split('T');
92
+ return Number(start[0].split('-')[0] + start[0].split('-')[1] + start[0].split('-')[2]);
93
+ }
94
+ else {
95
+ const end = new Date(item.end_at).toISOString().split('T');
96
+ return Number(end[0].split('-')[0] + end[0].split('-')[1] + end[0].split('-')[2]);
97
+ }
98
+ };
99
+ const findTime = (item, nowTime) => {
100
+ if (item.start_hour === null || item.start_min === null || item.end_hour === null || item.end_min === null) {
101
+ return true;
102
+ }
103
+ const start = Number(zeroMaker(item.start_hour) + zeroMaker(item.start_min));
104
+ const end = Number(zeroMaker(item.end_hour) + zeroMaker(item.end_min));
105
+ if (start < end) {
106
+ if (start <= nowTime && end >= nowTime) {
107
+ return true;
108
+ }
109
+ else {
110
+ return false;
111
+ }
112
+ }
113
+ else {
114
+ if (nowTime >= start) {
115
+ return true;
116
+ }
117
+ else if (nowTime <= end) {
118
+ return true;
119
+ }
120
+ else {
121
+ return false;
122
+ }
123
+ }
124
+ };
125
+ const zeroMaker = (x) => {
126
+ if (x.toString().length == 1) {
127
+ return '0' + x.toString();
128
+ }
129
+ else {
130
+ return x.toString();
131
+ }
132
+ };
133
+ //데이터 패칭 함수
134
+ const getPopUpData = () => __awaiter(void 0, void 0, void 0, function* () {
135
+ const response = yield fetch('/api/popup/top/list');
136
+ return yield response.json();
137
+ });
138
+ //data.list에서 해당 idx를 삭제하는 함수
139
+ const filterClose = (idx) => {
140
+ const filterData = popup.filter((item) => item.idx !== idx);
141
+ setPopup(filterData);
142
+ };
143
+ //스토리지 저장
144
+ const addCookie = (idx) => {
145
+ //내일 현재시간까지
146
+ const nowDate = new Date();
147
+ const expires = nowDate.setHours(nowDate.getHours() + 24);
148
+ localStorage.setItem(idx + '_CloseTopPop', String(expires));
149
+ };
150
+ // //query보다 먼저 실행
151
+ // useEffect(() => {
152
+ // if (typeof localStorage != 'undefined') {
153
+ // // 저장된 값은 제외
154
+ // const newInit = initData.filter((item) => !localStorage.getItem(item.idx + '_CloseTopPop'))
155
+ // setPopup(newInit)
156
+ // }
157
+ // }, [])
158
+ // console.log(currentHours, currentMinutes)
159
+ // 팝업이 뜨는 시간 조정
160
+ // const startHour =7 //팝업시작 시간의 '시'
161
+ // const startMin = 2//팝업시작 시간의 '분'
162
+ // const endHour = 8//팝업종료 시간의 '시'
163
+ // const endMin = 50//팝업종료 시간의 '분'
164
+ return (<>
165
+ <div className={style.header_banner_wrap}>
166
+ {/*pc*/}
167
+ <div className={style.header_banner}>
168
+ <Swiper autoplay={{ delay: 5000 }} modules={[Autoplay]} loop={popup.filter(item => item.file_type === 'file_pc').length > 1}>
169
+ {popup.length > 0 ? (popup
170
+ .filter((item) => item.file_type === 'file_pc' &&
171
+ isCurrentTimeWithinPopupRange(item.days, item.startHour, item.startMin, item.endHour, item.endMin))
172
+ .map((item, index) => {
173
+ // {popup.length > 0 ? popup.filter((item: IBannerTypes) => item.file_type === 'file_pc').map((item: IBannerTypes, index: number) => {
174
+ return (<SwiperSlide key={index}>
175
+ <div className={style.header_banner_btn}>
176
+ <button onClick={() => {
177
+ filterClose(item.idx);
178
+ addCookie(item.idx);
179
+ }}>
180
+ 하루동안 보지않기
181
+ </button>
182
+ <button onClick={() => {
183
+ filterClose(item.idx);
184
+ }}>
185
+ <Image src="/images/banner_btn.webp" alt="대륜 배너 이미지" width={42} height={42}/>
186
+ </button>
187
+ </div>
188
+ <div className={style.banner_block} style={{ background: `#${item.color_code}` }}>
189
+ <a href={item.p_link} target={item.link_type} onClick={() => {
190
+ addClickCnt(item.idx);
191
+ }}>
192
+ <Image src={ImagePath + item.file_path + '/' + item.save_file_name} alt={item.file_alt} width={2000} height={60} priority={true} quality={100} loading={'eager'}/>
193
+ {/*<Image src={"/images/대표메인_팝업_PC.jpg"} alt={item.file_alt} width={1920} height={50} priority={true} />*/}
194
+ </a>
195
+ </div>
196
+ </SwiperSlide>);
197
+ })) : (<></>)}
198
+ </Swiper>
199
+ </div>
200
+
201
+ {/*mobile*/}
202
+ <div className={classNames({
203
+ [style.header_banner_m]: true,
204
+ [style.header_banner_fix]: isTop === true ? true : false
205
+ })}>
206
+ <Swiper autoplay={{ delay: 5000 }} modules={[Autoplay]} loop={popup.filter((item) => item.file_type === 'file_mobile').length > 1}>
207
+ {popup.length > 0 ? (popup
208
+ .filter((item) => item.file_type === 'file_mobile')
209
+ .map((item, index) => {
210
+ return (<SwiperSlide key={index}>
211
+ <div className={style.header_banner_m_btn}>
212
+ <button onClick={() => {
213
+ filterClose(item.idx);
214
+ addCookie(item.idx);
215
+ }}>
216
+ 하루동안 보지않기
217
+ </button>
218
+ <button onClick={() => {
219
+ filterClose(item.idx);
220
+ }}>
221
+ 닫기
222
+ </button>
223
+ </div>
224
+ <div className={style.banner_block_m}>
225
+ <a href={item.p_link} target={item.link_type}>
226
+ <Image src={ImagePath + item.file_path + '/' + item.save_file_name} alt={item.file_alt} width={900} height={150} priority={true} onClick={() => {
227
+ addClickCnt(item.idx);
228
+ }} quality={100}/>
229
+ {/*<Image src={"/images/대표메인_팝업_900.jpg"} alt={item.file_alt} width={900} height={70} priority={true} />*/}
230
+ </a>
231
+ </div>
232
+ </SwiperSlide>);
233
+ })) : (<></>)}
234
+ </Swiper>
235
+ </div>
236
+ </div>
237
+ </>);
238
+ };
239
+ export default TopBanner;
@@ -0,0 +1,111 @@
1
+ /*header_banner 20230322*/
2
+ .header_banner_wrap {
3
+ z-index: 99;
4
+ position: fixed;
5
+ bottom: 0;
6
+ width: 100%;
7
+ }
8
+ .header_banner {
9
+ position: relative;
10
+ margin: 0 auto;
11
+ }
12
+ .header_banner_btn {
13
+ position: absolute;
14
+ color: #fff;
15
+ right: 50px;
16
+ top: 50%;
17
+ transform: translateY(-50%);
18
+ display: flex;
19
+ }
20
+ .header_banner_btn button {
21
+ background: transparent;
22
+ color: #fff;
23
+ font-size: 16px;
24
+ cursor: pointer;
25
+ }
26
+ .header_banner_btn button img {
27
+ width: 20px;
28
+ height: auto;
29
+ margin-left: 15px;
30
+ vertical-align: middle;
31
+ cursor: pointer;
32
+ }
33
+ .header_banner .banner_block img {
34
+ width: 100%;
35
+ height: auto !important;
36
+ }
37
+ .header_banner_m {
38
+ display: none;
39
+ }
40
+
41
+ @media (max-width: 1280px) {
42
+ .header_banner .banner_block img {
43
+ max-height: 40px !important;
44
+ }
45
+ .header_banner_btn button {
46
+ font-size: 14px;
47
+ }
48
+ .header_banner_btn button img {
49
+ width: 14px;
50
+ }
51
+ }
52
+
53
+ @media (max-width: 1024px) {
54
+ .header_banner_wrap{
55
+ position:relative;
56
+ }
57
+ }
58
+
59
+ @media (max-width: 900px) {
60
+ .header_banner {
61
+ display: none;
62
+ }
63
+ .header_banner_fix {
64
+ position: fixed;
65
+ bottom: 0;
66
+ }
67
+ .header_banner_m {
68
+ display: block;
69
+ margin: 0 auto;
70
+ text-align: center;
71
+ width: 100%;
72
+ }
73
+ .header_banner_m .banner_block_m a {
74
+ display: flex;
75
+ justify-content: center;
76
+ align-items: center;
77
+ }
78
+ .header_banner_m .banner_block_m a img {
79
+ height: auto;
80
+ max-height: 150px !important;
81
+ }
82
+ .header_banner_m_btn {
83
+ display: flex;
84
+ width: 100%;
85
+ }
86
+ .header_banner_m_btn button {
87
+ width: 50%;
88
+ padding: 4px 0;
89
+ color: #fff;
90
+ background: #0a1932;
91
+ font-size: 12px;
92
+ cursor: pointer;
93
+ }
94
+ .header_banner_m_btn button:nth-child(2) {
95
+ background: #050404;
96
+ }
97
+ }
98
+
99
+ @media (max-width: 480px) {
100
+ .header_banner_m .banner_block_m a img {
101
+ max-height: 120px !important;
102
+ }
103
+ }
104
+ /*header_banner 20230322 end*/
105
+
106
+ @media (max-width: 340px) {
107
+ /* .header_banner_wrap{min-width: 360px;} */
108
+ .header_banner_m .banner_block_m a img {
109
+ min-width: 360px;
110
+ }
111
+ }
@@ -0,0 +1,341 @@
1
+ import style from './TopBanner.module.css';
2
+ import { useEffect, useState, useCallback } from 'react';
3
+ import 'swiper/css';
4
+ import { Swiper, SwiperSlide } from 'swiper/react';
5
+ import { Autoplay } from 'swiper/modules';
6
+ import Image from 'next/image';
7
+ import { useQuery } from 'react-query';
8
+ import { isCurrentTimeWithinPopupRange, paramFetch } from '../../lib';
9
+ import { DateTime } from 'luxon';
10
+ import classNames from 'classnames';
11
+
12
+ //배너타입
13
+ interface IBannerTypes {
14
+ color_code: string;
15
+ days: number[];
16
+ end_at: string;
17
+ file_alt: string;
18
+ file_path: string;
19
+ file_type: string;
20
+ idx: number;
21
+ is_show: boolean;
22
+ link_type: string;
23
+ p_link: string;
24
+ p_sort: number;
25
+ save_file_name: string;
26
+ start_at: string;
27
+ }
28
+
29
+ const TopBanner = () => {
30
+ //이미지 패스
31
+ const ImagePath: string = process.env.NEXT_PUBLIC_S3_URL + '';
32
+
33
+ //팝업 리스트
34
+ const [popup, setPopup] = useState<IBannerTypes[]>([]);
35
+ const [isTop, setIsTop] = useState(true);
36
+
37
+ const addClickCnt = (idx: number) => {
38
+ paramFetch('https://mng.daeryunlaw.com/api/popup/top/click', { idx: idx }, null);
39
+ };
40
+
41
+ const handleScroll = useCallback(() => {
42
+ const scrollElm: Element | null = document.scrollingElement;
43
+ if (scrollElm !== null) {
44
+ const scrollTop: number = Math.max(scrollElm.scrollTop, document.body.scrollTop);
45
+ if (scrollTop > 0) {
46
+ setIsTop(false);
47
+ } else {
48
+ setIsTop(true);
49
+ }
50
+ }
51
+ }, []);
52
+
53
+ useEffect(() => {
54
+ const handleScroll = () => {
55
+ setIsTop(window.scrollY <= 0);
56
+ };
57
+
58
+ // Add scroll event listener
59
+ window.addEventListener('scroll', handleScroll);
60
+
61
+ // Remove scroll event listener on component unmount
62
+ return () => {
63
+ window.removeEventListener('scroll', handleScroll);
64
+ };
65
+ }, []);
66
+
67
+ useEffect(() => {
68
+ setIsTop(true);
69
+ document.addEventListener('scroll', handleScroll);
70
+ return () => {
71
+ document.removeEventListener('scroll', handleScroll); //clean up
72
+ };
73
+ }, [handleScroll]);
74
+
75
+ //userQuery
76
+ useQuery({
77
+ queryKey: ['popUpImg'],
78
+ queryFn: () => getPopUpData(),
79
+ //브라우저 화면을 focus할 때 새로 api를 호출할 건지 설정하는 옵션
80
+ refetchOnWindowFocus: false,
81
+ //기본설정 cacheTime:5분, staleTime:0초, 값을 Infinity로 설정할 경우 api return 값이 바뀌지 않는 이상 서버에 새로 요청하지 않고 캐싱된 데이터를 영구적으로 사용하여 api 호출 최적화
82
+ cacheTime: Infinity,
83
+ staleTime: Infinity,
84
+ onSuccess: (res: { list: any[] }) => {
85
+ const kstDateTime = DateTime.now().setZone('Asia/Seoul');
86
+ const nowDate = Number(
87
+ kstDateTime.year + '' + zeroMaker(kstDateTime.month) + '' + zeroMaker(kstDateTime.day)
88
+ );
89
+ const nowTime = Number(zeroMaker(kstDateTime.hour) + zeroMaker(kstDateTime.minute));
90
+ const weekday = kstDateTime.weekdayShort + '';
91
+ const dateData = res.list.filter(
92
+ (item: any) =>
93
+ findDate(item, 'start') <= nowDate &&
94
+ findDate(item, 'end') >= nowDate &&
95
+ findDays(item, weekday) &&
96
+ findTime(item, nowTime)
97
+ );
98
+ setPopup(
99
+ dateData.filter(
100
+ (item: IBannerTypes) =>
101
+ !(
102
+ localStorage.getItem(item.idx + '_CloseTopPop') &&
103
+ Number(localStorage.getItem(item.idx + '_CloseTopPop')) > new Date().getTime()
104
+ )
105
+ )
106
+ );
107
+ }
108
+ });
109
+
110
+ const findDays = (item: any, today: string) => {
111
+ if (item.days) {
112
+ return item.days.includes(today);
113
+ } else {
114
+ return false;
115
+ }
116
+ };
117
+
118
+ const findDate = (item: any, key: string) => {
119
+ if (key === 'start') {
120
+ const start = new Date(item.start_at).toISOString().split('T');
121
+ return Number(start[0].split('-')[0] + start[0].split('-')[1] + start[0].split('-')[2]);
122
+ } else {
123
+ const end = new Date(item.end_at).toISOString().split('T');
124
+ return Number(end[0].split('-')[0] + end[0].split('-')[1] + end[0].split('-')[2]);
125
+ }
126
+ };
127
+
128
+ const findTime = (item: any, nowTime: number) => {
129
+ if (item.start_hour === null || item.start_min === null || item.end_hour === null || item.end_min === null) {
130
+ return true;
131
+ }
132
+
133
+ const start = Number(zeroMaker(item.start_hour) + zeroMaker(item.start_min));
134
+ const end = Number(zeroMaker(item.end_hour) + zeroMaker(item.end_min));
135
+ if (start < end) {
136
+ if (start <= nowTime && end >= nowTime) {
137
+ return true;
138
+ } else {
139
+ return false;
140
+ }
141
+ } else {
142
+ if (nowTime >= start) {
143
+ return true;
144
+ } else if (nowTime <= end) {
145
+ return true;
146
+ } else {
147
+ return false;
148
+ }
149
+ }
150
+ };
151
+
152
+ const zeroMaker = (x: number) => {
153
+ if (x.toString().length == 1) {
154
+ return '0' + x.toString();
155
+ } else {
156
+ return x.toString();
157
+ }
158
+ };
159
+
160
+ //데이터 패칭 함수
161
+ const getPopUpData = async () => {
162
+ const response = await fetch('/api/popup/top/list');
163
+ return await response.json();
164
+ };
165
+
166
+ //data.list에서 해당 idx를 삭제하는 함수
167
+ const filterClose = (idx: number) => {
168
+ const filterData = popup.filter((item: IBannerTypes) => item.idx !== idx);
169
+ setPopup(filterData);
170
+ };
171
+
172
+ //스토리지 저장
173
+ const addCookie = (idx: number) => {
174
+ //내일 현재시간까지
175
+ const nowDate = new Date();
176
+ const expires = nowDate.setHours(nowDate.getHours() + 24);
177
+ localStorage.setItem(idx + '_CloseTopPop', String(expires));
178
+ };
179
+
180
+ // //query보다 먼저 실행
181
+ // useEffect(() => {
182
+ // if (typeof localStorage != 'undefined') {
183
+ // // 저장된 값은 제외
184
+ // const newInit = initData.filter((item) => !localStorage.getItem(item.idx + '_CloseTopPop'))
185
+ // setPopup(newInit)
186
+ // }
187
+ // }, [])
188
+
189
+ // console.log(currentHours, currentMinutes)
190
+ // 팝업이 뜨는 시간 조정
191
+ // const startHour =7 //팝업시작 시간의 '시'
192
+ // const startMin = 2//팝업시작 시간의 '분'
193
+ // const endHour = 8//팝업종료 시간의 '시'
194
+ // const endMin = 50//팝업종료 시간의 '분'
195
+
196
+ return (
197
+ <>
198
+ <div className={style.header_banner_wrap}>
199
+ {/*pc*/}
200
+ <div className={style.header_banner}>
201
+ <Swiper
202
+ autoplay={{ delay: 5000 }}
203
+ modules={[Autoplay]}
204
+ loop={popup.filter(item => item.file_type === 'file_pc').length > 1}
205
+ >
206
+ {popup.length > 0 ? (
207
+ popup
208
+ .filter(
209
+ (item: any) =>
210
+ item.file_type === 'file_pc' &&
211
+ isCurrentTimeWithinPopupRange(
212
+ item.days,
213
+ item.startHour,
214
+ item.startMin,
215
+ item.endHour,
216
+ item.endMin
217
+ )
218
+ )
219
+ .map((item: IBannerTypes, index: number) => {
220
+ // {popup.length > 0 ? popup.filter((item: IBannerTypes) => item.file_type === 'file_pc').map((item: IBannerTypes, index: number) => {
221
+ return (
222
+ <SwiperSlide key={index}>
223
+ <div className={style.header_banner_btn}>
224
+ <button
225
+ onClick={() => {
226
+ filterClose(item.idx);
227
+ addCookie(item.idx);
228
+ }}
229
+ >
230
+ 하루동안 보지않기
231
+ </button>
232
+ <button
233
+ onClick={() => {
234
+ filterClose(item.idx);
235
+ }}
236
+ >
237
+ <Image
238
+ src="/images/banner_btn.webp"
239
+ alt="대륜 배너 이미지"
240
+ width={42}
241
+ height={42}
242
+ />
243
+ </button>
244
+ </div>
245
+ <div
246
+ className={style.banner_block}
247
+ style={{ background: `#${item.color_code}` }}
248
+ >
249
+ <a
250
+ href={item.p_link}
251
+ target={item.link_type}
252
+ onClick={() => {
253
+ addClickCnt(item.idx);
254
+ }}
255
+ >
256
+ <Image
257
+ src={ImagePath + item.file_path + '/' + item.save_file_name}
258
+ alt={item.file_alt}
259
+ width={2000}
260
+ height={60}
261
+ priority={true}
262
+ quality={100}
263
+ loading={'eager'}
264
+ />
265
+ {/*<Image src={"/images/대표메인_팝업_PC.jpg"} alt={item.file_alt} width={1920} height={50} priority={true} />*/}
266
+ </a>
267
+ </div>
268
+ </SwiperSlide>
269
+ );
270
+ })
271
+ ) : (
272
+ <></>
273
+ )}
274
+ </Swiper>
275
+ </div>
276
+
277
+ {/*mobile*/}
278
+ <div
279
+ className={classNames({
280
+ [style.header_banner_m]: true,
281
+ [style.header_banner_fix]: isTop === true ? true : false
282
+ })}
283
+ >
284
+ <Swiper
285
+ autoplay={{ delay: 5000 }}
286
+ modules={[Autoplay]}
287
+ loop={popup.filter((item: IBannerTypes) => item.file_type === 'file_mobile').length > 1}
288
+ >
289
+ {popup.length > 0 ? (
290
+ popup
291
+ .filter((item: IBannerTypes) => item.file_type === 'file_mobile')
292
+ .map((item: IBannerTypes, index: number) => {
293
+ return (
294
+ <SwiperSlide key={index}>
295
+ <div className={style.header_banner_m_btn}>
296
+ <button
297
+ onClick={() => {
298
+ filterClose(item.idx);
299
+ addCookie(item.idx);
300
+ }}
301
+ >
302
+ 하루동안 보지않기
303
+ </button>
304
+ <button
305
+ onClick={() => {
306
+ filterClose(item.idx);
307
+ }}
308
+ >
309
+ 닫기
310
+ </button>
311
+ </div>
312
+ <div className={style.banner_block_m}>
313
+ <a href={item.p_link} target={item.link_type}>
314
+ <Image
315
+ src={ImagePath + item.file_path + '/' + item.save_file_name}
316
+ alt={item.file_alt}
317
+ width={900}
318
+ height={150}
319
+ priority={true}
320
+ onClick={() => {
321
+ addClickCnt(item.idx);
322
+ }}
323
+ quality={100}
324
+ />
325
+ {/*<Image src={"/images/대표메인_팝업_900.jpg"} alt={item.file_alt} width={900} height={70} priority={true} />*/}
326
+ </a>
327
+ </div>
328
+ </SwiperSlide>
329
+ );
330
+ })
331
+ ) : (
332
+ <></>
333
+ )}
334
+ </Swiper>
335
+ </div>
336
+ </div>
337
+ </>
338
+ );
339
+ };
340
+
341
+ export default TopBanner;