@daeryun/dr_components 0.2.30 → 0.2.32

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.
@@ -3,5 +3,6 @@ declare const BrochureBtn: (props: {
3
3
  width?: string;
4
4
  height?: string;
5
5
  className?: string;
6
+ type?: string;
6
7
  }) => import("react").JSX.Element;
7
8
  export default BrochureBtn;
@@ -2,9 +2,12 @@ import Link from 'next/link';
2
2
  import Image from 'next/image';
3
3
  import btnImg from '../../asset/images/BrochureBtn/download_btn.webp';
4
4
  const BrochureBtn = (props) => {
5
- const { rounded = true, width = '100%', height = '100%', className = '' } = props;
5
+ const { rounded = true, width = '100%', height = '100%', className = '', type = 'comp' } = props;
6
6
  const downloadUrl_comp = 'https://d1tgonli21s4df.cloudfront.net/comp/daeryunBrochure.pdf';
7
- return (<Link href={downloadUrl_comp} rel={'nofollow'} target={'_blank'} style={{
7
+ const downloadUrl_estate = 'https://d1tgonli21s4df.cloudfront.net/estate-group/daeryunBrochure_estate.pdf';
8
+ const link = type === 'comp' ? downloadUrl_comp : type === 'estate' ? downloadUrl_estate : '';
9
+ const text = type === 'comp' ? '기업법무 브로슈어' : type === 'estate' ? '건설부동산그룹 브로슈어' : '';
10
+ return (<Link href={link} rel={'nofollow'} target={'_blank'} style={{
8
11
  width: width,
9
12
  height: height,
10
13
  borderRadius: rounded ? '1000px' : '0'
@@ -21,7 +24,7 @@ const BrochureBtn = (props) => {
21
24
  Brochure <span className={'font-[800]'}>download</span>
22
25
  </p>
23
26
  <p className={'text-[14px] font-[800] leading-none max-[590px]:text-[13px] max-xs:text-[14px]'}>
24
- {'기업법무 브로슈어'}
27
+ {text}
25
28
  </p>
26
29
  </span>
27
30
  </Link>);
@@ -6,8 +6,15 @@ declare const meta: {
6
6
  width?: string;
7
7
  height?: string;
8
8
  className?: string;
9
+ type?: string;
9
10
  }) => import("react").JSX.Element;
10
11
  title: string;
12
+ argTypes: {
13
+ type: {
14
+ control: string;
15
+ options: string[];
16
+ };
17
+ };
11
18
  };
12
19
  export default meta;
13
20
  type Story = StoryObj<typeof meta>;
@@ -3,14 +3,23 @@ import '../../styles/globals.css';
3
3
  import MedicalBrochureBtn from './MedicalBrochureBtn';
4
4
  const meta = {
5
5
  component: BrochureBtn, //컴포넌트
6
- title: 'BrochureBtn' //스토리 이름
6
+ title: 'BrochureBtn', //스토리 이름
7
+ argTypes: {
8
+ type: {
9
+ control: 'select',
10
+ options: ['comp', 'estate']
11
+ }
12
+ }
7
13
  };
8
14
  export default meta;
9
15
  export const Default = {
10
- render: () => (<>
16
+ render: args => (<>
11
17
  <div className={'h-[100vh] w-full pt-10'}>
12
- <BrochureBtn rounded={false} width={'280px'} height={'55px'} className={''}/>
18
+ <BrochureBtn rounded={false} width={'280px'} height={'55px'} className={''} {...args}/>
13
19
  <MedicalBrochureBtn rounded={false} width={'280px'} height={'55px'} className={''}/>
14
20
  </div>
15
- </>)
21
+ </>),
22
+ args: {
23
+ type: 'comp'
24
+ }
16
25
  };
@@ -6,19 +6,28 @@ import MedicalBrochureBtn from './MedicalBrochureBtn';
6
6
 
7
7
  const meta = {
8
8
  component: BrochureBtn, //컴포넌트
9
- title: 'BrochureBtn' //스토리 이름
9
+ title: 'BrochureBtn', //스토리 이름
10
+ argTypes: {
11
+ type: {
12
+ control: 'select',
13
+ options: ['comp', 'estate']
14
+ }
15
+ }
10
16
  } satisfies Meta<typeof BrochureBtn>;
11
17
 
12
18
  export default meta;
13
19
  type Story = StoryObj<typeof meta>;
14
20
 
15
21
  export const Default: Story = {
16
- render: () => (
22
+ render: args => (
17
23
  <>
18
24
  <div className={'h-[100vh] w-full pt-10'}>
19
- <BrochureBtn rounded={false} width={'280px'} height={'55px'} className={''} />
25
+ <BrochureBtn rounded={false} width={'280px'} height={'55px'} className={''} {...args} />
20
26
  <MedicalBrochureBtn rounded={false} width={'280px'} height={'55px'} className={''} />
21
27
  </div>
22
28
  </>
23
- )
29
+ ),
30
+ args: {
31
+ type: 'comp'
32
+ }
24
33
  };
@@ -1,12 +1,23 @@
1
1
  import Link from 'next/link';
2
2
  import Image from 'next/image';
3
3
  import btnImg from '../../asset/images/BrochureBtn/download_btn.webp';
4
- const BrochureBtn = (props: { rounded?: boolean; width?: string; height?: string; className?: string }) => {
5
- const { rounded = true, width = '100%', height = '100%', className = '' } = props;
4
+ const BrochureBtn = (props: {
5
+ rounded?: boolean;
6
+ width?: string;
7
+ height?: string;
8
+ className?: string;
9
+ type?: string;
10
+ }) => {
11
+ const { rounded = true, width = '100%', height = '100%', className = '', type = 'comp' } = props;
6
12
  const downloadUrl_comp = 'https://d1tgonli21s4df.cloudfront.net/comp/daeryunBrochure.pdf';
13
+ const downloadUrl_estate = 'https://d1tgonli21s4df.cloudfront.net/estate-group/daeryunBrochure_estate.pdf';
14
+
15
+ const link = type === 'comp' ? downloadUrl_comp : type === 'estate' ? downloadUrl_estate : '';
16
+ const text = type === 'comp' ? '기업법무 브로슈어' : type === 'estate' ? '건설부동산그룹 브로슈어' : '';
17
+
7
18
  return (
8
19
  <Link
9
- href={downloadUrl_comp}
20
+ href={link}
10
21
  rel={'nofollow'}
11
22
  target={'_blank'}
12
23
  style={{
@@ -40,7 +51,7 @@ const BrochureBtn = (props: { rounded?: boolean; width?: string; height?: string
40
51
  Brochure <span className={'font-[800]'}>download</span>
41
52
  </p>
42
53
  <p className={'text-[14px] font-[800] leading-none max-[590px]:text-[13px] max-xs:text-[14px]'}>
43
- {'기업법무 브로슈어'}
54
+ {text}
44
55
  </p>
45
56
  </span>
46
57
  </Link>
@@ -17,6 +17,70 @@ import { useQuery } from 'react-query';
17
17
  import { isCurrentTimeWithinPopupRange, paramFetch } from '../../lib';
18
18
  import { DateTime } from 'luxon';
19
19
  import classNames from 'classnames';
20
+ import Link from 'next/link';
21
+ // 팝업 컴포넌트 스토리북 확인용 더미 데이터
22
+ // const POPUP_DUMMY: IBannerTypes[] = [
23
+ // {
24
+ // color_code: '',
25
+ // days: [0, 1, 2, 3, 4, 5, 6],
26
+ // end_at: '2025-01-30T10:15:00.000Z',
27
+ // file_alt: '법무법인대륜 상단 팝업 더미 이미지 (1) - pc',
28
+ // file_path: '/upload/board/popup',
29
+ // file_type: 'file_pc',
30
+ // idx: 73,
31
+ // is_show: true,
32
+ // link_type: '_blank',
33
+ // p_link: 'https://forms.gle/GAkHoRwHriLHZM46A',
34
+ // p_sort: 0,
35
+ // save_file_name: '20250114105159551.webp',
36
+ // start_at: '2025-01-20T10:15:00.000Z'
37
+ // },
38
+ // {
39
+ // color_code: '',
40
+ // days: [0, 1, 2, 3, 4, 5, 6],
41
+ // end_at: '2025-01-30T10:15:00.000Z',
42
+ // file_alt: '법무법인대륜 상단 팝업 더미 이미지 (1) - mobile',
43
+ // file_path: '/upload/board/popup',
44
+ // file_type: 'file_mobile',
45
+ // idx: 74,
46
+ // is_show: true,
47
+ // link_type: '_blank',
48
+ // p_link: '"https://forms.gle/GAkHoRwHriLHZM46A"',
49
+ // p_sort: 0,
50
+ // save_file_name: '20250114105200057.webp',
51
+ // start_at: '2025-01-20T10:15:00.000Z'
52
+ // },
53
+ // {
54
+ // color_code: '',
55
+ // days: [0, 1, 2, 3, 4, 5, 6],
56
+ // end_at: '2025-01-30T10:15:00.000Z',
57
+ // file_alt: '법무법인대륜 상단 팝업 더미 이미지 (2) - pc',
58
+ // file_path: '/upload/board/popup',
59
+ // file_type: 'file_pc',
60
+ // idx: 73,
61
+ // is_show: true,
62
+ // link_type: '_blank',
63
+ // p_link: 'https://www.daeryunlaw.com/choice',
64
+ // p_sort: 0,
65
+ // save_file_name: '20250116011646039.webp',
66
+ // start_at: '2025-01-20T10:15:00.000Z'
67
+ // },
68
+ // {
69
+ // color_code: '',
70
+ // days: [0, 1, 2, 3, 4, 5, 6],
71
+ // end_at: '2025-01-30T10:15:00.000Z',
72
+ // file_alt: '법무법인대륜 상단 팝업 더미 이미지 (2) - mobile',
73
+ // file_path: '/upload/board/popup',
74
+ // file_type: 'file_mobile',
75
+ // idx: 74,
76
+ // is_show: true,
77
+ // link_type: '_blank',
78
+ // p_link: 'https://www.daeryunlaw.com/choice',
79
+ // p_sort: 0,
80
+ // save_file_name: '20250116011645661.webp',
81
+ // start_at: '2025-01-20T10:15:00.000Z'
82
+ // }
83
+ // ];
20
84
  const TopBanner = () => {
21
85
  //이미지 패스
22
86
  const ImagePath = process.env.NEXT_PUBLIC_S3_URL + '';
@@ -56,7 +120,7 @@ const TopBanner = () => {
56
120
  document.removeEventListener('scroll', handleScroll); //clean up
57
121
  };
58
122
  }, [handleScroll]);
59
- //userQuery
123
+ // userQuery
60
124
  useQuery({
61
125
  queryKey: ['popUpImg'],
62
126
  queryFn: () => getPopUpData(),
@@ -78,6 +142,11 @@ const TopBanner = () => {
78
142
  Number(localStorage.getItem(item.idx + '_CloseTopPop')) > new Date().getTime())));
79
143
  }
80
144
  });
145
+ // 테스트 로직, 스토리북으로 확인할 때만 활성화 (useQuery는 주석하고)
146
+ // useEffect(() => {
147
+ // setPopup(POPUP_DUMMY);
148
+ // console.log('popup : ', popup);
149
+ // }, [popup]);
81
150
  const findDays = (item, today) => {
82
151
  if (item.days) {
83
152
  return item.days.includes(today);
@@ -147,6 +216,20 @@ const TopBanner = () => {
147
216
  const expires = nowDate.setHours(nowDate.getHours() + 24);
148
217
  localStorage.setItem(idx + '_CloseTopPop', String(expires));
149
218
  };
219
+ // Link Component rel='nofollow' 적용 유무를 위한 함수
220
+ const validateUrl = (linkUrl) => {
221
+ if (linkUrl.includes('http')) {
222
+ // 해당 링크가 대륜 페이지로 이동하는지 재확인
223
+ if (linkUrl.includes('daeryunlaw')) {
224
+ return '';
225
+ }
226
+ // 대륜 이외 페이지라면 nofollow
227
+ return 'nofollow';
228
+ }
229
+ else {
230
+ return '';
231
+ }
232
+ };
150
233
  // //query보다 먼저 실행
151
234
  // useEffect(() => {
152
235
  // if (typeof localStorage != 'undefined') {
@@ -163,75 +246,75 @@ const TopBanner = () => {
163
246
  // const endMin = 50//팝업종료 시간의 '분'
164
247
  return (<>
165
248
  <div className={style.header_banner_wrap}>
166
- {/*pc*/}
249
+ {/* pc */}
167
250
  <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>
251
+ {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}>
252
+ {popup.length > 0 ? (popup
253
+ .filter((item) => item.file_type === 'file_pc' &&
254
+ isCurrentTimeWithinPopupRange(item.days, item.startHour, item.startMin, item.endHour, item.endMin))
255
+ .map((item, index) => {
256
+ // {popup.length > 0 ? popup.filter((item: IBannerTypes) => item.file_type === 'file_pc').map((item: IBannerTypes, index: number) => {
257
+ return (<SwiperSlide key={index}>
258
+ <div className={style.header_banner_btn}>
259
+ <button onClick={() => {
260
+ filterClose(item.idx);
261
+ addCookie(item.idx);
262
+ }}>
263
+ 하루동안 보지않기
264
+ </button>
265
+ <button onClick={() => {
266
+ filterClose(item.idx);
267
+ }}>
268
+ <Image src="/images/banner_btn.webp" alt="대륜 배너 닫기 이미지" width={42} height={42}/>
269
+ </button>
270
+ </div>
271
+ <div className={style.banner_block} style={{ background: `#${item.color_code}` }}>
272
+ <Link href={item.p_link} target={item.link_type} onClick={() => {
273
+ addClickCnt(item.idx);
274
+ }} rel={validateUrl(item.p_link)}>
275
+ <Image src={ImagePath + item.file_path + '/' + item.save_file_name} alt={item.file_alt} width={2000} height={60} priority={true} quality={100} loading={'eager'}/>
276
+ {/*<Image src={"/images/대표메인_팝업_PC.jpg"} alt={item.file_alt} width={1920} height={50} priority={true} />*/}
277
+ </Link>
278
+ </div>
279
+ </SwiperSlide>);
280
+ })) : (<></>)}
281
+ </Swiper>) : (<></>)}
199
282
  </div>
200
283
 
201
- {/*mobile*/}
284
+ {/* mobile */}
202
285
  <div className={classNames({
203
286
  [style.header_banner_m]: true,
204
287
  [style.header_banner_fix]: isTop === true ? true : false
205
288
  })}>
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>
289
+ {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}>
290
+ {popup.length > 0 ? (popup
291
+ .filter((item) => item.file_type === 'file_mobile')
292
+ .map((item, index) => {
293
+ return (<SwiperSlide key={index}>
294
+ <div className={style.header_banner_m_btn}>
295
+ <button onClick={() => {
296
+ filterClose(item.idx);
297
+ addCookie(item.idx);
298
+ }}>
299
+ 하루동안 보지않기
300
+ </button>
301
+ <button onClick={() => {
302
+ filterClose(item.idx);
303
+ }}>
304
+ 닫기
305
+ </button>
306
+ </div>
307
+ <div className={style.banner_block_m}>
308
+ <Link href={item.p_link} target={item.link_type} rel={validateUrl(item.p_link)}>
309
+ <Image src={ImagePath + item.file_path + '/' + item.save_file_name} alt={item.file_alt} width={900} height={150} priority={true} onClick={() => {
310
+ addClickCnt(item.idx);
311
+ }} quality={100}/>
312
+ {/*<Image src={"/images/대표메인_팝업_900.jpg"} alt={item.file_alt} width={900} height={70} priority={true} />*/}
313
+ </Link>
314
+ </div>
315
+ </SwiperSlide>);
316
+ })) : (<></>)}
317
+ </Swiper>) : (<></>)}
235
318
  </div>
236
319
  </div>
237
320
  </>);