@daeryun/dr_components 0.7.29 → 0.7.31

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.
@@ -8,12 +8,14 @@ import { IAddLinkTypes } from '../common/types/seo';
8
8
  import LogoYoutube from '../../asset/images/seo/seoAddLink/logo_youtube.webp';
9
9
  import IconYoutube from '../../asset/images/seo/seoYoutube/youtube_ico.svg';
10
10
  import IconYoutubeTxt from '../../asset/images/seo/seoYoutube/youtube_txt.svg';
11
+ import IconYoutubeSmall from '../../asset/images/seo/seoAddLink/youtubeSmall_ico.svg';
12
+ import IconLinkArrow from '../../asset/images/seo/seoAddLink/link_arrow.webp';
11
13
 
12
- const SeoYoutube = ({ linkList }: { linkList: IAddLinkTypes[] }) => {
14
+ const SeoYoutube = ({ type, linkList }: { type: 'shorts' | 'youtube'; linkList: IAddLinkTypes[] }) => {
13
15
  //유튜브 관련
14
16
  const [isYoutubeOn, setIsYoutubeOn] = useState<boolean>(false);
15
17
  const [youtubeId, setYoutubeId] = useState<string>('');
16
- const popOffBtnRef = useRef<HTMLButtonElement | null>(null);
18
+ const popOffBtnRef = useRef<HTMLButtonElement>(null!);
17
19
 
18
20
  const extractYouTubeID = (url: string): string => {
19
21
  const regex = /(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/;
@@ -37,66 +39,150 @@ const SeoYoutube = ({ linkList }: { linkList: IAddLinkTypes[] }) => {
37
39
 
38
40
  return linkList.length > 0 ? (
39
41
  <>
40
- <section
41
- className={
42
- 'mt-8 flex justify-between gap-[36px] border-b border-solid border-[#DBDBDB] pb-[60px] tracking-[-1.92px] ' +
43
- //1500px
44
- 'max-3xl:gap-[24px] ' +
45
- //640px
46
- 'max-md2:flex-col max-md2:pb-6'
47
- }
48
- >
49
- {/*pc 로고뷰*/}
50
- <div className={'flex w-fit min-w-[264px] flex-col gap-y-9 max-md2:hidden'}>
51
- <div className={'flex flex-col gap-5'}>
52
- <IconYoutube className={'h-[67px] w-[99px]'} />
53
- <IconYoutubeTxt className={'h-[35px] w-[117px]'} />
54
- </div>
55
- <p className={'text-2xl font-semibold leading-[34px] text-[#545454] '}>
56
- 해당 업무사례와 관련된
57
- <br />
58
- 영상 콘텐츠도 함께 확인하세요.
59
- </p>
60
- </div>
61
- {/*모바일 로고뷰*/}
62
- <div className={'hidden max-md2:block'}>
63
- <Image src={LogoYoutube} alt="" className={'h-[29px] w-[96px] object-contain'} />
42
+ {type === 'shorts' ? (
43
+ <div
44
+ className={
45
+ 'flex items-center gap-[14px] border-[1px] border-solid border-[#D0D0D0] pr-[30px] ' +
46
+ //640px
47
+ 'max-sm:gap-[14px] ' +
48
+ //520px
49
+ 'max-2sm:gap-[10px] '
50
+ }
51
+ >
52
+ <span
53
+ className={
54
+ 'relative flex h-[47px] w-[130px] shrink-0 items-center ' +
55
+ //1500px
56
+ 'max-3xl:h-[42px] max-3xl:w-[120px] ' +
57
+ //640px
58
+ 'max-sm:h-[38px] max-sm:w-[110px] ' +
59
+ //520px
60
+ 'max-2sm:h-[33px] max-2sm:w-[100px] '
61
+ }
62
+ style={{ paddingLeft: '15px' }}
63
+ >
64
+ <Image
65
+ src={LogoYoutube}
66
+ alt=""
67
+ className={'h-6 w-[105px] object-contain'}
68
+ width={210}
69
+ height={48}
70
+ />
71
+ </span>
72
+ <ul
73
+ className={
74
+ 'flex flex-col gap-[20px] py-[24px] text-[20px] font-normal tracking-[-0.7px] ' +
75
+ // 쇼츠타입 추가
76
+ `${type == 'shorts' ? 'flex min-h-[98px] items-center justify-center ' : 'text-[#0D74CE] '}` +
77
+ //1500px
78
+ 'max-3xl:text-[18px] ' +
79
+ //640px
80
+ 'max-sm:gap-[12px] max-sm:py-[20px] max-sm:text-[16px] '
81
+ }
82
+ >
83
+ {linkList
84
+ .filter(l => l.title.length > 0)
85
+ .map((linkData, index) => (
86
+ <li key={linkData.title + linkData.idx}>
87
+ <button
88
+ className={'relative flex w-fit items-center gap-[8px] text-left font-[600]'}
89
+ onClick={() => handleButtonClick(extractYouTubeID(linkData.link) ?? '', index)}
90
+ >
91
+ <Image
92
+ src={IconLinkArrow}
93
+ alt={''}
94
+ width={8}
95
+ height={14}
96
+ className={
97
+ 'relative mr-2 h-[14px] w-[8px] object-contain ' +
98
+ //640px
99
+ 'max-sm:mr-0 max-sm:w-[6px]'
100
+ }
101
+ />
102
+ <p
103
+ className={
104
+ 'line-clamp-1 flex items-center leading-[1.25] max-md:line-clamp-none'
105
+ }
106
+ >
107
+ {linkData.title}
108
+ </p>
109
+ <IconYoutubeSmall
110
+ className={
111
+ 'inline aspect-square w-[24px] shrink-0 ' +
112
+ //1500px
113
+ 'max-3xl:w-[20px] ' +
114
+ //640px
115
+ 'max-sm:w-[16px] '
116
+ }
117
+ />
118
+ </button>
119
+ </li>
120
+ ))}
121
+ </ul>
64
122
  </div>
65
- <ol className={'h-fit w-full max-w-[657px] gap-y-4 max-md2:max-w-full'}>
66
- {linkList
67
- .filter(l => l.title.length > 0)
68
- .map((linkData, index) => (
69
- <li
70
- key={linkData.title + linkData.idx}
71
- className={'flex w-full flex-col gap-4 max-md2:gap-[10px]'}
72
- onClick={() => handleButtonClick(extractYouTubeID(linkData.link) ?? '', index)}
73
- >
74
- <div className="aspect-video w-full">
75
- <iframe
76
- className="pointer-events-none h-full w-full"
77
- src={`https://www.youtube.com/embed/${extractYouTubeID(linkData.link)}?autoplay=0&mute=1&controls=0`}
78
- title="YouTube preview"
79
- frameBorder="0"
80
- allow=""
81
- ></iframe>
82
- </div>
83
- <p
84
- className={
85
- 'line-clamp-1 text-2xl font-semibold leading-9 text-[#545454] max-md2:text-[18px] max-md2:leading-6'
86
- }
123
+ ) : (
124
+ <section
125
+ className={
126
+ 'mt-8 flex justify-between gap-[36px] border-b border-solid border-[#DBDBDB] pb-[60px] tracking-[-1.92px] ' +
127
+ //1500px
128
+ 'max-3xl:gap-[24px] ' +
129
+ //640px
130
+ 'max-md2:flex-col max-md2:pb-6'
131
+ }
132
+ >
133
+ {/*pc 로고뷰*/}
134
+ <div className={'flex w-fit min-w-[264px] flex-col gap-y-9 max-md2:hidden'}>
135
+ <div className={'flex flex-col gap-5'}>
136
+ <IconYoutube className={'h-[67px] w-[99px]'} />
137
+ <IconYoutubeTxt className={'h-[35px] w-[117px]'} />
138
+ </div>
139
+ <p className={'text-2xl font-semibold leading-[34px] text-[#545454] '}>
140
+ 해당 업무사례와 관련된
141
+ <br />
142
+ 영상 콘텐츠도 함께 확인하세요.
143
+ </p>
144
+ </div>
145
+ {/*모바일 로고뷰*/}
146
+ <div className={'hidden max-md2:block'}>
147
+ <Image src={LogoYoutube} alt="" className={'h-[29px] w-[96px] object-contain'} />
148
+ </div>
149
+ <ol className={'h-fit w-full max-w-[657px] gap-y-4 max-md2:max-w-full'}>
150
+ {linkList
151
+ .filter(l => l.title.length > 0)
152
+ .map((linkData, index) => (
153
+ <li
154
+ key={linkData.title + linkData.idx}
155
+ className={'flex w-full flex-col gap-4 max-md2:gap-[10px]'}
156
+ onClick={() => handleButtonClick(extractYouTubeID(linkData.link) ?? '', index)}
87
157
  >
88
- {linkData.title}
89
- </p>
90
- </li>
91
- ))}
92
- </ol>
93
- <YoutubeModal
94
- onClick={handleClickUpYoutube}
95
- isYoutubeOn={isYoutubeOn}
96
- youtubeId={youtubeId}
97
- popOffBtnRef={popOffBtnRef ?? null}
98
- />
99
- </section>
158
+ <div className="aspect-video w-full">
159
+ <iframe
160
+ className="pointer-events-none h-full w-full"
161
+ src={`https://www.youtube.com/embed/${extractYouTubeID(linkData.link)}?autoplay=0&mute=1&controls=0`}
162
+ title="YouTube preview"
163
+ frameBorder="0"
164
+ allow=""
165
+ ></iframe>
166
+ </div>
167
+ <p
168
+ className={
169
+ 'line-clamp-1 text-2xl font-semibold leading-9 text-[#545454] max-md2:text-[18px] max-md2:leading-6'
170
+ }
171
+ >
172
+ {linkData.title}
173
+ </p>
174
+ </li>
175
+ ))}
176
+ </ol>
177
+ </section>
178
+ )}
179
+ <YoutubeModal
180
+ onClick={handleClickUpYoutube}
181
+ isYoutubeOn={isYoutubeOn}
182
+ youtubeId={youtubeId}
183
+ popOffBtnRef={popOffBtnRef}
184
+ isShorts={type === 'shorts'}
185
+ />
100
186
  </>
101
187
  ) : (
102
188
  <></>
@@ -1,8 +1,9 @@
1
- import React from 'react';
1
+ import { RefObject } from 'react';
2
2
  declare const YoutubeModal: (props: {
3
3
  onClick: () => void;
4
4
  isYoutubeOn: boolean;
5
5
  youtubeId: string;
6
- popOffBtnRef: React.RefObject<HTMLButtonElement> | null;
7
- }) => React.JSX.Element;
6
+ popOffBtnRef: RefObject<HTMLButtonElement>;
7
+ isShorts?: boolean;
8
+ }) => import("react").JSX.Element;
8
9
  export default YoutubeModal;
@@ -1,15 +1,15 @@
1
1
  'use client';
2
- import React from 'react';
3
2
  //상단 유튜브 클릭 시 모달
4
3
  const YoutubeModal = (props) => {
5
- const { onClick, isYoutubeOn, youtubeId, popOffBtnRef } = props;
4
+ const { onClick, isYoutubeOn, youtubeId, popOffBtnRef, isShorts } = props;
6
5
  return (<div className={'fixed left-0 top-0 z-[9999] h-full w-full bg-black bg-opacity-50 ' + `${isYoutubeOn ? '' : 'hidden'}`}>
7
- <div className={'absolute left-[50%] top-[50%] aspect-[110/62] w-[80%] max-w-[1100px] translate-x-[-50%] translate-y-[-50%] ' +
6
+ <div className={'absolute left-[50%] top-[50%] max-w-[1100px] translate-x-[-50%] translate-y-[-50%] ' +
7
+ `${isShorts ? 'aspect-[6/11] h-[80vh] max-lg:w-[95%] max-lg:max-w-[400px] ' : 'aspect-[110/62] w-[80%] max-lg:aspect-[unset] max-lg:h-[40%] max-lg:min-h-[350px] max-lg:w-[90%] '}` +
8
8
  //1024px
9
- 'max-lg:aspect-[unset] max-lg:h-[40%] max-lg:min-h-[350px] max-lg:w-[90%]'}>
9
+ ''}>
10
10
  <button type={'button'} className={'absolute right-[-40px] top-[-50px] text-[35px] text-white ' +
11
11
  //1024px
12
- 'max-lg:right-0'} ref={popOffBtnRef !== null && popOffBtnRef !== void 0 ? popOffBtnRef : undefined} onClick={onClick} aria-label={'유튜브 모달 닫기'}>
12
+ 'max-lg:right-0'} ref={popOffBtnRef} onClick={onClick} aria-label={'유튜브 모달 닫기'}>
13
13
  ✕
14
14
  </button>
15
15
  <span className={'mx-auto w-full'}>
@@ -1,14 +1,15 @@
1
1
  'use client';
2
2
 
3
- import React, { RefObject } from 'react';
3
+ import { RefObject } from 'react';
4
4
  //상단 유튜브 클릭 시 모달
5
5
  const YoutubeModal = (props: {
6
6
  onClick: () => void;
7
7
  isYoutubeOn: boolean;
8
8
  youtubeId: string;
9
- popOffBtnRef: React.RefObject<HTMLButtonElement> | null;
9
+ popOffBtnRef: RefObject<HTMLButtonElement>;
10
+ isShorts?: boolean;
10
11
  }) => {
11
- const { onClick, isYoutubeOn, youtubeId, popOffBtnRef } = props;
12
+ const { onClick, isYoutubeOn, youtubeId, popOffBtnRef, isShorts } = props;
12
13
 
13
14
  return (
14
15
  <div
@@ -19,9 +20,10 @@ const YoutubeModal = (props: {
19
20
  >
20
21
  <div
21
22
  className={
22
- 'absolute left-[50%] top-[50%] aspect-[110/62] w-[80%] max-w-[1100px] translate-x-[-50%] translate-y-[-50%] ' +
23
+ 'absolute left-[50%] top-[50%] max-w-[1100px] translate-x-[-50%] translate-y-[-50%] ' +
24
+ `${isShorts ? 'aspect-[6/11] h-[80vh] max-lg:w-[95%] max-lg:max-w-[400px] ' : 'aspect-[110/62] w-[80%] max-lg:aspect-[unset] max-lg:h-[40%] max-lg:min-h-[350px] max-lg:w-[90%] '}` +
23
25
  //1024px
24
- 'max-lg:aspect-[unset] max-lg:h-[40%] max-lg:min-h-[350px] max-lg:w-[90%]'
26
+ ''
25
27
  }
26
28
  >
27
29
  <button
@@ -31,7 +33,7 @@ const YoutubeModal = (props: {
31
33
  //1024px
32
34
  'max-lg:right-0'
33
35
  }
34
- ref={popOffBtnRef ?? undefined}
36
+ ref={popOffBtnRef}
35
37
  onClick={onClick}
36
38
  aria-label={'유튜브 모달 닫기'}
37
39
  >
@@ -1810,6 +1810,10 @@ video {
1810
1810
  aspect-ratio: 110/62;
1811
1811
  }
1812
1812
 
1813
+ .aspect-\[6\/11\] {
1814
+ aspect-ratio: 6/11;
1815
+ }
1816
+
1813
1817
  .aspect-square {
1814
1818
  aspect-ratio: 1 / 1;
1815
1819
  }
@@ -2218,6 +2222,10 @@ video {
2218
2222
  height: 80px;
2219
2223
  }
2220
2224
 
2225
+ .h-\[80vh\] {
2226
+ height: 80vh;
2227
+ }
2228
+
2221
2229
  .h-\[82px\] {
2222
2230
  height: 82px;
2223
2231
  }
@@ -9640,6 +9648,10 @@ body {
9640
9648
  width: 100%;
9641
9649
  }
9642
9650
 
9651
+ .max-lg\:max-w-\[400px\] {
9652
+ max-width: 400px;
9653
+ }
9654
+
9643
9655
  .max-lg\:max-w-\[550px\] {
9644
9656
  max-width: 550px;
9645
9657
  }