@daeryun/dr_components 1.2.52 → 1.2.54

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,183 @@
1
+ import { IBannerTypes } from './TopBanner';
2
+ import { useEffect, useMemo, useRef, useState } from 'react';
3
+ import { Swiper } from 'swiper';
4
+ import Link from 'next/link';
5
+ import Image from 'next/image';
6
+ import { useTranslation } from 'next-i18next';
7
+ import { tempData } from './common';
8
+ import useBrowser from '../hook/useBrowser';
9
+ import { Autoplay } from 'swiper/modules';
10
+
11
+ const MobileTopBanner = ({
12
+ popup,
13
+ setMobileOpen,
14
+ addClickCnt
15
+ }: {
16
+ popup: IBannerTypes[];
17
+ setMobileOpen: (v: boolean) => void;
18
+ addClickCnt: (idx: number) => void;
19
+ }) => {
20
+ const { width } = useBrowser(true);
21
+ const swiper = useRef<Swiper | null>(null);
22
+ const [index, setIndex] = useState(1);
23
+ // const currentPopup = useMemo(() => {
24
+ // if (width === 0) return []
25
+ // return popup.filter((item) => item.file_type === (width >= 640 ? 'file_tab' : 'file_mobile'))
26
+ // }, [popup, width])
27
+ const currentPopup = useMemo(() => {
28
+ if (width === 0) return [];
29
+ return tempData.filter(item => item.file_type === (width >= 480 ? 'file_tab' : 'file_mobile'));
30
+ }, [popup, width]);
31
+
32
+ //이미지 패스
33
+ const ImagePath: string = process.env.NEXT_PUBLIC_S3_URL + '';
34
+
35
+ useEffect(() => {
36
+ const el = document.querySelector('#swiper-banner');
37
+ if (!el) return;
38
+
39
+ swiper.current = new Swiper(el as HTMLElement, {
40
+ spaceBetween: 0,
41
+ slidesPerView: 1,
42
+ autoplay: { delay: 3500, disableOnInteraction: false },
43
+ modules: [Autoplay],
44
+ on: {
45
+ slideChange(sw) {
46
+ if (sw.destroyed) return;
47
+ setIndex(sw.realIndex + 1);
48
+ }
49
+ }
50
+ });
51
+
52
+ return () => {
53
+ if (swiper.current && swiper.current.destroy) {
54
+ swiper.current.destroy();
55
+ }
56
+ };
57
+ }, [currentPopup]);
58
+
59
+ //휠 잠금
60
+ useEffect(() => {
61
+ if (currentPopup.length > 0) {
62
+ const scrollY = window.scrollY;
63
+ document.body.style.position = 'fixed';
64
+ document.body.style.top = `-${scrollY}px`;
65
+ document.body.style.width = '100%';
66
+ }
67
+ return () => {
68
+ document.body.style.position = '';
69
+ document.body.style.top = '';
70
+ document.body.style.width = '';
71
+ window.scrollTo(0, scrollY);
72
+ };
73
+ }, [currentPopup]);
74
+
75
+ // 하루동안 보지않기
76
+ const closeForOneDay = () => {
77
+ //내일 현재시간까지
78
+ const nowDate = new Date();
79
+ const expires = nowDate.setHours(nowDate.getHours() + 24);
80
+ localStorage.setItem('topPopupMobileHideUntil', String(expires));
81
+ setMobileOpen(false);
82
+ };
83
+
84
+ // Link Component rel='nofollow' 적용 유무를 위한 함수
85
+ const validateUrl = (linkUrl: string) => {
86
+ if (linkUrl.includes('http')) {
87
+ // 해당 링크가 대륜 페이지로 이동하는지 재확인
88
+ if (linkUrl.includes('daeryunlaw')) {
89
+ return '';
90
+ }
91
+
92
+ // 대륜 이외 페이지라면 nofollow
93
+ return 'nofollow';
94
+ } else {
95
+ return '';
96
+ }
97
+ };
98
+
99
+ return (
100
+ currentPopup.length > 0 && (
101
+ <>
102
+ <div
103
+ className={
104
+ 'animate-fadeInFast pointer-events-auto fixed left-0 top-0 z-[9999] h-full w-full bg-[#000] bg-opacity-75'
105
+ }
106
+ onClick={() => {
107
+ setMobileOpen(false);
108
+ }}
109
+ />
110
+ <div className={'pointer-events-auto fixed bottom-0 left-0 z-[99991] flex w-full flex-col '}>
111
+ <div
112
+ className={
113
+ 'mb-[16px] mr-[60px] flex w-[66px] items-center justify-center self-end rounded-full bg-[#90909080] py-[6px] text-[18px] tracking-[-0.02em] text-white ' +
114
+ 'max-md:mr-[40px] ' +
115
+ 'max-sm:mr-[16px] max-sm:w-[47px] max-sm:py-[4px] max-sm:text-[14px]'
116
+ }
117
+ >
118
+ {index} / {currentPopup.length}
119
+ </div>
120
+ <div
121
+ id={'swiper-banner'}
122
+ className={
123
+ 'swiper aspect-[900/392] h-auto w-full rounded-t-[40px] bg-[#ddd] ' +
124
+ 'max-xs:aspect-[360/216] max-xs:rounded-t-[20px] '
125
+ }
126
+ >
127
+ <span className={'swiper-wrapper'}>
128
+ {currentPopup.map((item: IBannerTypes, index: number) => {
129
+ return (
130
+ <Link
131
+ key={'Banner_m_' + index}
132
+ href={item.mobile_link || item.p_link}
133
+ target={item.link_type}
134
+ className={'swiper-slide relative'}
135
+ rel={validateUrl(item.mobile_link || item.p_link)}
136
+ >
137
+ <Image
138
+ src={ImagePath + item.file_path + '/' + item.save_file_name}
139
+ // alt={item.file_alt}
140
+ alt={'주말, 공휴일에도 방문상담 접수 진행 중입니다.'}
141
+ fill
142
+ onClick={() => {
143
+ addClickCnt(item.idx);
144
+ }}
145
+ priority
146
+ fetchPriority="high"
147
+ sizes={'100vw'}
148
+ className={'h-full w-full object-contain'}
149
+ />
150
+ </Link>
151
+ );
152
+ })}
153
+ </span>
154
+ </div>
155
+ <div
156
+ className={
157
+ 'flex h-[80px] w-full items-start justify-between bg-white px-[60px] py-[20px] ' +
158
+ 'max-md:px-[40px] max-md:text-[16px] ' +
159
+ 'max-sm:h-[60px] max-sm:p-[16px]'
160
+ }
161
+ >
162
+ <button
163
+ className={'text-[18px] leading-[1.4] tracking-[-0.02em] text-[#909090] max-sm:text-[13px]'}
164
+ onClick={closeForOneDay}
165
+ >
166
+ 오늘 하루 보지 않기
167
+ </button>
168
+ <button
169
+ className={'text-[18px] leading-[1.4] tracking-[-0.02em] max-sm:text-[13px]'}
170
+ onClick={() => {
171
+ setMobileOpen(false);
172
+ }}
173
+ >
174
+ 닫기
175
+ </button>
176
+ </div>
177
+ </div>
178
+ </>
179
+ )
180
+ );
181
+ };
182
+
183
+ export default MobileTopBanner;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { IBannerTypes } from './TopBanner';
3
+ import { SetterOrUpdater } from 'recoil';
4
+ declare const PCTopBanner: ({ popup, setPopup, addClickCnt, setBannerHeight }: {
5
+ popup: IBannerTypes[];
6
+ setPopup: (v: IBannerTypes[]) => void;
7
+ addClickCnt: (idx: number) => void;
8
+ setBannerHeight?: SetterOrUpdater<number>;
9
+ }) => React.JSX.Element;
10
+ export default PCTopBanner;
@@ -0,0 +1,101 @@
1
+ import style from './TopBanner.module.css';
2
+ import { Swiper, SwiperSlide } from 'swiper/react';
3
+ import Image from 'next/image';
4
+ import Link from 'next/link';
5
+ import React, { useEffect, useRef, useState } from 'react';
6
+ import { isCurrentTimeWithinPopupRange } from '../../lib';
7
+ import useBrowser from '../hook/useBrowser';
8
+ import { Autoplay } from 'swiper/modules';
9
+ const PCTopBanner = ({ popup, setPopup, addClickCnt, setBannerHeight }) => {
10
+ const { width } = useBrowser(true);
11
+ const [swiperKey, setSwiperKey] = useState(0);
12
+ const bannerRef = useRef(null);
13
+ //이미지 패스
14
+ const ImagePath = process.env.NEXT_PUBLIC_S3_URL + '';
15
+ // 배너 높이
16
+ useEffect(() => {
17
+ const updateBannerHeight = () => {
18
+ if (bannerRef.current) {
19
+ const height = bannerRef.current.offsetHeight;
20
+ if (setBannerHeight)
21
+ setBannerHeight(height);
22
+ }
23
+ };
24
+ updateBannerHeight();
25
+ if (bannerRef.current && setBannerHeight) {
26
+ const resizeObserver = new ResizeObserver(() => {
27
+ updateBannerHeight();
28
+ });
29
+ resizeObserver.observe(bannerRef.current);
30
+ return () => {
31
+ resizeObserver.disconnect();
32
+ };
33
+ }
34
+ }, [setBannerHeight]);
35
+ useEffect(() => {
36
+ setSwiperKey(prev => prev + 1);
37
+ }, [width]);
38
+ //data.list에서 해당 idx를 삭제하는 함수
39
+ const filterClose = (idx) => {
40
+ const filterData = popup.filter((item) => item.idx !== idx);
41
+ setPopup(filterData);
42
+ };
43
+ //스토리지 저장
44
+ const addCookie = (idx) => {
45
+ //내일 현재시간까지
46
+ const nowDate = new Date();
47
+ const expires = nowDate.setHours(nowDate.getHours() + 24);
48
+ localStorage.setItem(idx + '_CloseTopPop', String(expires));
49
+ };
50
+ // 하루동안 보지않기 (localStorage 저장 + 캐시 무효화)
51
+ const closeForOneDay = (idx) => {
52
+ addCookie(idx);
53
+ filterClose(idx);
54
+ };
55
+ // Link Component rel='nofollow' 적용 유무를 위한 함수
56
+ const validateUrl = (linkUrl) => {
57
+ if (linkUrl.includes('http')) {
58
+ // 해당 링크가 대륜 페이지로 이동하는지 재확인
59
+ if (linkUrl.includes('daeryunlaw')) {
60
+ return '';
61
+ }
62
+ // 대륜 이외 페이지라면 nofollow
63
+ return 'nofollow';
64
+ }
65
+ else {
66
+ return '';
67
+ }
68
+ };
69
+ return (<div ref={bannerRef} id={'banner_wrap'} className={popup.length > 0 ? style.header_banner_wrap : ' pointer-events-auto hidden'}>
70
+ <div className={style.header_banner + ' pointer-events-auto'}>
71
+ {popup && popup.filter(item => item.file_type === 'file_pc').length > 0 ? (<Swiper key={swiperKey} autoplay={{ delay: 3000, disableOnInteraction: false }} modules={[Autoplay]} speed={600} loop={popup.filter(item => item.file_type === 'file_pc').length > 1}>
72
+ {popup
73
+ .filter((item) => item.file_type === 'file_pc' &&
74
+ isCurrentTimeWithinPopupRange(item.days, item.startHour, item.startMin, item.endHour, item.endMin))
75
+ .map((item, index) => {
76
+ // {popup.length > 0 ? popup.filter((item: IBannerTypes) => item.file_type === 'file_pc').map((item: IBannerTypes, index: number) => {
77
+ return (<SwiperSlide key={index}>
78
+ <div className={style.header_banner_btn}>
79
+ <button onClick={() => closeForOneDay(item.idx)}>하루동안 보지않기</button>
80
+ <button onClick={() => {
81
+ filterClose(item.idx);
82
+ }}>
83
+ <Image src="/images/banner_btn.webp" alt="하단 팝업 닫기" width={42} height={42}/>
84
+ </button>
85
+ </div>
86
+ <div className={style.banner_block} style={{ background: `#${item.color_code}` }}>
87
+ <Link href={item.pc_link || item.p_link} target={item.link_type} onClick={() => {
88
+ addClickCnt(item.idx);
89
+ }} rel={validateUrl(item.p_link)}>
90
+ <Image src={ImagePath + item.file_path + '/' + item.save_file_name}
91
+ // alt={item.file_alt}
92
+ alt={item.file_alt} width={2000} height={60} quality={85} priority fetchPriority="high"/>
93
+ </Link>
94
+ </div>
95
+ </SwiperSlide>);
96
+ })}
97
+ </Swiper>) : (<></>)}
98
+ </div>
99
+ </div>);
100
+ };
101
+ export default PCTopBanner;
@@ -0,0 +1,172 @@
1
+ import style from './TopBanner.module.css';
2
+ import { Swiper, SwiperSlide } from 'swiper/react';
3
+ import Image from 'next/image';
4
+ import Link from 'next/link';
5
+ import React, { useEffect, useRef, useState } from 'react';
6
+ import { IBannerTypes } from './TopBanner';
7
+ import { SetterOrUpdater } from 'recoil';
8
+ import { isCurrentTimeWithinPopupRange } from '../../lib';
9
+ import useBrowser from '../hook/useBrowser';
10
+ import { Autoplay } from 'swiper/modules';
11
+
12
+ const PCTopBanner = ({
13
+ popup,
14
+ setPopup,
15
+ addClickCnt,
16
+ setBannerHeight
17
+ }: {
18
+ popup: IBannerTypes[];
19
+ setPopup: (v: IBannerTypes[]) => void;
20
+ addClickCnt: (idx: number) => void;
21
+ setBannerHeight?: SetterOrUpdater<number>;
22
+ }) => {
23
+ const { width } = useBrowser(true);
24
+ const [swiperKey, setSwiperKey] = useState(0);
25
+ const bannerRef = useRef<HTMLDivElement>(null);
26
+
27
+ //이미지 패스
28
+ const ImagePath: string = process.env.NEXT_PUBLIC_S3_URL + '';
29
+
30
+ // 배너 높이
31
+ useEffect(() => {
32
+ const updateBannerHeight = () => {
33
+ if (bannerRef.current) {
34
+ const height = bannerRef.current.offsetHeight;
35
+ if (setBannerHeight) setBannerHeight(height);
36
+ }
37
+ };
38
+ updateBannerHeight();
39
+
40
+ if (bannerRef.current && setBannerHeight) {
41
+ const resizeObserver = new ResizeObserver(() => {
42
+ updateBannerHeight();
43
+ });
44
+ resizeObserver.observe(bannerRef.current);
45
+ return () => {
46
+ resizeObserver.disconnect();
47
+ };
48
+ }
49
+ }, [setBannerHeight]);
50
+
51
+ useEffect(() => {
52
+ setSwiperKey(prev => prev + 1);
53
+ }, [width]);
54
+
55
+ //data.list에서 해당 idx를 삭제하는 함수
56
+ const filterClose = (idx: number) => {
57
+ const filterData = popup.filter((item: IBannerTypes) => item.idx !== idx);
58
+ setPopup(filterData);
59
+ };
60
+
61
+ //스토리지 저장
62
+ const addCookie = (idx: number) => {
63
+ //내일 현재시간까지
64
+ const nowDate = new Date();
65
+ const expires = nowDate.setHours(nowDate.getHours() + 24);
66
+ localStorage.setItem(idx + '_CloseTopPop', String(expires));
67
+ };
68
+
69
+ // 하루동안 보지않기 (localStorage 저장 + 캐시 무효화)
70
+ const closeForOneDay = (idx: number) => {
71
+ addCookie(idx);
72
+ filterClose(idx);
73
+ };
74
+
75
+ // Link Component rel='nofollow' 적용 유무를 위한 함수
76
+ const validateUrl = (linkUrl: string) => {
77
+ if (linkUrl.includes('http')) {
78
+ // 해당 링크가 대륜 페이지로 이동하는지 재확인
79
+ if (linkUrl.includes('daeryunlaw')) {
80
+ return '';
81
+ }
82
+
83
+ // 대륜 이외 페이지라면 nofollow
84
+ return 'nofollow';
85
+ } else {
86
+ return '';
87
+ }
88
+ };
89
+
90
+ return (
91
+ <div
92
+ ref={bannerRef}
93
+ id={'banner_wrap'}
94
+ className={popup.length > 0 ? style.header_banner_wrap : ' pointer-events-auto hidden'}
95
+ >
96
+ <div className={style.header_banner + ' pointer-events-auto'}>
97
+ {popup && popup.filter(item => item.file_type === 'file_pc').length > 0 ? (
98
+ <Swiper
99
+ key={swiperKey}
100
+ autoplay={{ delay: 3000, disableOnInteraction: false }}
101
+ modules={[Autoplay]}
102
+ speed={600}
103
+ loop={popup.filter(item => item.file_type === 'file_pc').length > 1}
104
+ >
105
+ {popup
106
+ .filter(
107
+ (item: any) =>
108
+ item.file_type === 'file_pc' &&
109
+ isCurrentTimeWithinPopupRange(
110
+ item.days,
111
+ item.startHour,
112
+ item.startMin,
113
+ item.endHour,
114
+ item.endMin
115
+ )
116
+ )
117
+ .map((item: IBannerTypes, index: number) => {
118
+ // {popup.length > 0 ? popup.filter((item: IBannerTypes) => item.file_type === 'file_pc').map((item: IBannerTypes, index: number) => {
119
+ return (
120
+ <SwiperSlide key={index}>
121
+ <div className={style.header_banner_btn}>
122
+ <button onClick={() => closeForOneDay(item.idx)}>하루동안 보지않기</button>
123
+ <button
124
+ onClick={() => {
125
+ filterClose(item.idx);
126
+ }}
127
+ >
128
+ <Image
129
+ src="/images/banner_btn.webp"
130
+ alt="하단 팝업 닫기"
131
+ width={42}
132
+ height={42}
133
+ />
134
+ </button>
135
+ </div>
136
+ <div
137
+ className={style.banner_block}
138
+ style={{ background: `#${item.color_code}` }}
139
+ >
140
+ <Link
141
+ href={item.pc_link || item.p_link}
142
+ target={item.link_type}
143
+ onClick={() => {
144
+ addClickCnt(item.idx);
145
+ }}
146
+ rel={validateUrl(item.p_link)}
147
+ >
148
+ <Image
149
+ src={ImagePath + item.file_path + '/' + item.save_file_name}
150
+ // alt={item.file_alt}
151
+ alt={item.file_alt}
152
+ width={2000}
153
+ height={60}
154
+ quality={85}
155
+ priority
156
+ fetchPriority="high"
157
+ />
158
+ </Link>
159
+ </div>
160
+ </SwiperSlide>
161
+ );
162
+ })}
163
+ </Swiper>
164
+ ) : (
165
+ <></>
166
+ )}
167
+ </div>
168
+ </div>
169
+ );
170
+ };
171
+
172
+ export default PCTopBanner;
@@ -1,5 +1,26 @@
1
1
  import 'swiper/css';
2
2
  import { SetterOrUpdater } from 'recoil';
3
+ export interface IBannerTypes {
4
+ color_code: string;
5
+ days: string[];
6
+ start_at: string;
7
+ start_hour: number;
8
+ start_min: number;
9
+ end_at: string;
10
+ end_hour: number;
11
+ end_min: number;
12
+ file_alt: string;
13
+ file_path: string;
14
+ file_type: string;
15
+ idx: number;
16
+ is_show: boolean;
17
+ link_type: string;
18
+ p_link: string;
19
+ p_sort: number;
20
+ save_file_name: string;
21
+ pc_link?: string;
22
+ mobile_link?: string;
23
+ }
3
24
  declare const TopBanner: ({ setBannerHeight }: {
4
25
  setBannerHeight?: SetterOrUpdater<number>;
5
26
  }) => import("react").JSX.Element;
@@ -8,19 +8,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- import style from './TopBanner.module.css';
12
11
  import { useEffect, useState, useRef } from 'react';
13
12
  import 'swiper/css';
14
- import { Swiper, SwiperSlide } from 'swiper/react';
15
- import { Autoplay } from 'swiper/modules';
16
- import Image from 'next/image';
17
13
  import { useQuery } from '@tanstack/react-query';
18
- import { isCurrentTimeWithinPopupRange, paramFetch } from '../../lib';
14
+ import { paramFetch } from '../../lib';
19
15
  import { DateTime } from 'luxon';
20
- import classNames from 'classnames';
21
- import Link from 'next/link';
22
16
  import useBrowser from '../hook/useBrowser';
23
17
  import { usePathname, useRouter } from 'next/navigation';
18
+ import PCTopBanner from './PCTopBanner';
19
+ import MobileTopBanner from './MobileTopBanner';
20
+ import { isTopPopupMobileHidden } from './common';
24
21
  // 팝업 컴포넌트 스토리북 확인용 더미 데이터
25
22
  // const POPUP_DUMMY: IBannerTypes[] = [
26
23
  // {
@@ -93,6 +90,9 @@ const TopBanner = ({ setBannerHeight }) => {
93
90
  const pathname = usePathname();
94
91
  //팝업 리스트
95
92
  const [popup, setPopup] = useState([]);
93
+ const [mobileOpen, setMobileOpen] = useState(() => {
94
+ return !isTopPopupMobileHidden();
95
+ });
96
96
  const addClickCnt = (idx) => {
97
97
  paramFetch('https://mng.daeryunlaw.com/api/popup/top/click', { idx: idx }, null);
98
98
  };
@@ -293,83 +293,11 @@ const TopBanner = ({ setBannerHeight }) => {
293
293
  // const endHour = 8//팝업종료 시간의 '시'
294
294
  // const endMin = 50//팝업종료 시간의 '분'
295
295
  return (<>
296
- <div ref={bannerRef} className={style.header_banner_wrap}>
297
- {/* pc */}
298
- {width > 900 && (<div className={style.header_banner}>
299
- {popup && popup.filter(item => item.file_type === 'file_pc').length > 0 ? (<Swiper autoplay={{ delay: 5000 }} modules={[Autoplay]} loop={popup.filter(item => item.file_type === 'file_pc').length > 1}>
300
- {popup.length > 0 ? (popup
301
- .filter((item) => item.file_type === 'file_pc' &&
302
- isCurrentTimeWithinPopupRange(item.days, item.startHour, item.startMin, item.endHour, item.endMin))
303
- .map((item, index) => {
304
- // {popup.length > 0 ? popup.filter((item: IBannerTypes) => item.file_type === 'file_pc').map((item: IBannerTypes, index: number) => {
305
- return (<SwiperSlide key={index}>
306
- <div className={style.header_banner_btn}>
307
- <button onClick={() => {
308
- filterClose(item.idx);
309
- addCookie(item.idx);
310
- }}>
311
- 하루동안 보지않기
312
- </button>
313
- <button onClick={() => {
314
- filterClose(item.idx);
315
- }}>
316
- <Image src="/images/banner_btn.webp" alt="대륜 배너 닫기 이미지" width={42} height={42}/>
317
- </button>
318
- </div>
319
- <div className={style.banner_block} style={{ background: `#${item.color_code}` }}>
320
- <Link href={item.pc_link || item.p_link} target={item.link_type} onClick={() => {
321
- addClickCnt(item.idx);
322
- }} rel={validateUrl(item.p_link)}>
323
- <Image src={ImagePath +
324
- item.file_path +
325
- '/' +
326
- item.save_file_name} alt={item.file_alt} width={2000} height={60} priority={true} quality={100} loading={'eager'}/>
327
- {/*<Image src={"/images/대표메인_팝업_PC.jpg"} alt={item.file_alt} width={1920} height={50} priority={true} />*/}
328
- </Link>
329
- </div>
330
- </SwiperSlide>);
331
- })) : (<></>)}
332
- </Swiper>) : (<></>)}
333
- </div>)}
296
+ {/*pc*/}
297
+ {width > 900 && <PCTopBanner popup={popup} setPopup={setPopup} addClickCnt={addClickCnt}/>}
334
298
 
335
- {/* mobile */}
336
- {width <= 900 && (<div className={classNames({
337
- [style.header_banner_m]: true
338
- })}>
339
- {popup && popup.filter(item => item.file_type === 'file_mobile').length > 0 ? (<Swiper autoplay={{ delay: 5000 }} modules={[Autoplay]} loop={popup.filter((item) => item.file_type === 'file_mobile').length > 1}>
340
- {popup.length > 0 ? (popup
341
- .filter((item) => item.file_type === 'file_mobile')
342
- .map((item, index) => {
343
- return (<SwiperSlide key={index}>
344
- <div className={style.header_banner_m_btn}>
345
- <button onClick={() => {
346
- filterClose(item.idx);
347
- addCookie(item.idx);
348
- }}>
349
- 하루동안 보지않기
350
- </button>
351
- <button onClick={() => {
352
- filterClose(item.idx);
353
- }}>
354
- 닫기
355
- </button>
356
- </div>
357
- <div className={style.banner_block_m}>
358
- <Link href={item.mobile_link || item.p_link} target={item.link_type} rel={validateUrl(item.p_link)}>
359
- <Image src={ImagePath +
360
- item.file_path +
361
- '/' +
362
- item.save_file_name} alt={item.file_alt} width={900} height={150} priority={true} onClick={() => {
363
- addClickCnt(item.idx);
364
- }} quality={100}/>
365
- {/*<Image src={"/images/대표메인_팝업_900.jpg"} alt={item.file_alt} width={900} height={70} priority={true} />*/}
366
- </Link>
367
- </div>
368
- </SwiperSlide>);
369
- })) : (<></>)}
370
- </Swiper>) : (<></>)}
371
- </div>)}
372
- </div>
299
+ {/*mobile*/}
300
+ {width <= 900 && mobileOpen && (<MobileTopBanner popup={popup} setMobileOpen={setMobileOpen} addClickCnt={addClickCnt}/>)}
373
301
  </>);
374
302
  };
375
303
  export default TopBanner;