@daeryun/dr_components 0.7.1 → 0.7.21

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.
Files changed (30) hide show
  1. package/dist/asset/images/seo/seoAddLink/link_arrow.webp +0 -0
  2. package/dist/asset/images/seo/seoAddLink/link_on.webp +0 -0
  3. package/dist/asset/images/seo/seoAddLink/logo_youtube.webp +0 -0
  4. package/dist/asset/images/seo/seoAddLink/ribon.svg +3 -0
  5. package/dist/asset/images/seo/seoAddLink/youtubeSmall_ico.svg +4 -0
  6. package/dist/asset/images/seo/seoYoutube/youtube_ico.svg +7 -0
  7. package/dist/asset/images/seo/seoYoutube/youtube_txt.svg +3 -0
  8. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  9. package/dist/components/Footer/index.jsx +46 -41
  10. package/dist/components/Footer/index.tsx +48 -48
  11. package/dist/components/Seo/SeoAdditionalLink.d.ts +7 -0
  12. package/dist/components/Seo/SeoAdditionalLink.jsx +101 -0
  13. package/dist/components/Seo/SeoAdditionalLink.stories.d.ts +19 -0
  14. package/dist/components/Seo/SeoAdditionalLink.stories.jsx +34 -0
  15. package/dist/components/Seo/SeoAdditionalLink.stories.tsx +41 -0
  16. package/dist/components/Seo/SeoAdditionalLink.tsx +168 -0
  17. package/dist/components/Seo/SeoYoutube.d.ts +6 -0
  18. package/dist/components/Seo/SeoYoutube.jsx +69 -0
  19. package/dist/components/Seo/SeoYoutube.stories.d.ts +12 -0
  20. package/dist/components/Seo/SeoYoutube.stories.jsx +27 -0
  21. package/dist/components/Seo/SeoYoutube.stories.tsx +34 -0
  22. package/dist/components/Seo/SeoYoutube.tsx +103 -0
  23. package/dist/components/YoutubeModal/YoutubeModal.d.ts +8 -0
  24. package/dist/components/YoutubeModal/YoutubeModal.jsx +20 -0
  25. package/dist/components/YoutubeModal/YoutubeModal.tsx +57 -0
  26. package/dist/components/common/types/seo/index.d.ts +9 -0
  27. package/dist/components/common/types/seo/index.ts +10 -0
  28. package/dist/styles/globals.css +179 -0
  29. package/dist/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +1 -1
@@ -0,0 +1,101 @@
1
+ 'use client';
2
+ import Link from 'next/link';
3
+ import React from 'react';
4
+ import * as gtag from '../../lib/gtag';
5
+ import Image from 'next/image';
6
+ import IconRibon from '../../asset/images/seo/seoAddLink/ribon.svg';
7
+ import IconLinkOn from '../../asset/images/seo/seoAddLink/link_on.webp';
8
+ import IconLinkArrow from '../../asset/images/seo/seoAddLink/link_arrow.webp';
9
+ import IconYoutube from '../../asset/images/seo/seoAddLink/logo_youtube.webp';
10
+ import IconYoutubeSmall from '../../asset/images/seo/seoAddLink/youtubeSmall_ico.svg';
11
+ const SeoAdditionalLink = ({ type, linkList }) => {
12
+ const referClick = () => {
13
+ gtag.event({
14
+ action: 'contents_refer',
15
+ category: 'contents',
16
+ label: '컨텐츠 내 참고 컨텐츠 클릭',
17
+ value: '1'
18
+ });
19
+ };
20
+ const newsClick = () => {
21
+ gtag.event({
22
+ action: 'contents_news',
23
+ category: 'contents',
24
+ label: '컨텐츠 내 관련 기사 클릭',
25
+ value: '1'
26
+ });
27
+ };
28
+ return (<>
29
+ <div className={'flex items-center gap-[14px] border-[1px] border-solid border-[#D0D0D0] pr-[30px] ' +
30
+ //640px
31
+ 'max-sm:gap-[14px] ' +
32
+ //520px
33
+ 'max-2sm:gap-[10px] '}>
34
+ {type == 'shorts' ? (
35
+ // 쇼츠일때는 유튜브 로고
36
+ <span className={'relative flex h-[47px] w-[130px] shrink-0 items-center ' +
37
+ //1500px
38
+ 'max-3xl:h-[42px] max-3xl:w-[120px] ' +
39
+ //640px
40
+ 'max-sm:h-[38px] max-sm:w-[110px] ' +
41
+ //520px
42
+ 'max-2sm:h-[33px] max-2sm:w-[100px] '} style={{ paddingLeft: '15px' }}>
43
+ <Image src={IconYoutube} alt="" className={'h-6 w-[105px]'} width={210} height={48}/>
44
+ </span>) : (<span className={'relative flex h-[47px] w-[130px] shrink-0 items-center ' +
45
+ //1500px
46
+ 'max-3xl:h-[42px] max-3xl:w-[120px] ' +
47
+ //640px
48
+ 'max-sm:h-[38px] max-sm:w-[110px] ' +
49
+ //520px
50
+ 'max-2sm:h-[33px] max-2sm:w-[100px] '}>
51
+ <IconRibon className="absolute left-0 top-0 -z-10 h-full w-auto "/>
52
+ <p className={'pl-[15px] text-[24px] font-bold leading-none tracking-[-0.96px] text-white ' +
53
+ //1500px
54
+ 'max-3xl:text-[22px] ' +
55
+ //640px
56
+ 'max-sm:text-[18px] ' +
57
+ //520px
58
+ 'max-2sm:pl-[10px] max-2sm:text-[16px] '}>
59
+ {type}
60
+ </p>
61
+ </span>)}
62
+ <ul className={'flex flex-col gap-[20px] py-[24px] text-[20px] font-normal tracking-[-0.7px] ' +
63
+ // 쇼츠타입 추가
64
+ `${type == 'shorts' ? 'flex min-h-[98px] items-center justify-center ' : 'text-[#0D74CE] '}` +
65
+ //1500px
66
+ 'max-3xl:text-[18px] ' +
67
+ //640px
68
+ 'max-sm:gap-[12px] max-sm:py-[20px] max-sm:text-[16px] '}>
69
+ {linkList
70
+ .filter(l => l.title.length > 0)
71
+ .map(linkData => (<li key={linkData.title + linkData.idx}>
72
+ <Link href={linkData.link} target={type == 'shorts' ? '_blank' : '_self'} className={'relative flex w-fit items-center gap-[16px] font-[600] ' +
73
+ //640px
74
+ 'max-sm:gap-[8px] '} onClick={() => {
75
+ if (type === '참고')
76
+ referClick();
77
+ else
78
+ newsClick();
79
+ }}>
80
+ <Image src={IconLinkArrow} alt={''} width={8} height={14} className={'relative h-[14px] w-[8px] object-contain ' +
81
+ //640px
82
+ 'max-sm:w-[6px] '}/>
83
+ <p className={'line-clamp-1 flex items-center leading-[1.25] max-md:line-clamp-none'}>
84
+ {linkData.title}
85
+ </p>
86
+ {type == 'shorts' ? (<IconYoutubeSmall className={'inline aspect-square w-[24px] shrink-0 ' +
87
+ //1500px
88
+ 'max-3xl:w-[20px] ' +
89
+ //640px
90
+ 'max-sm:w-[16px] '}/>) : (<Image src={IconLinkOn} alt={''} width={16} height={16} className={'inline aspect-square w-[16px] shrink-0 ' +
91
+ //1500px
92
+ 'max-3xl:w-[14px] ' +
93
+ //640px
94
+ 'max-sm:w-[12px] '}/>)}
95
+ </Link>
96
+ </li>))}
97
+ </ul>
98
+ </div>
99
+ </>);
100
+ };
101
+ export default SeoAdditionalLink;
@@ -0,0 +1,19 @@
1
+ import SeoAdditionalLink from './SeoAdditionalLink';
2
+ import type { StoryObj } from '@storybook/react';
3
+ import '../../styles/globals.css';
4
+ declare const SeoAdd: {
5
+ component: ({ type, linkList }: {
6
+ type: string;
7
+ linkList: import("../common/types/seo").IAddLinkTypes[];
8
+ }) => import("react").JSX.Element;
9
+ title: string;
10
+ argTypes: {
11
+ type: {
12
+ control: string;
13
+ options: string[];
14
+ };
15
+ };
16
+ };
17
+ export default SeoAdd;
18
+ type Story = StoryObj<typeof SeoAdditionalLink>;
19
+ export declare const Default: Story;
@@ -0,0 +1,34 @@
1
+ import SeoAdditionalLink from './SeoAdditionalLink';
2
+ import '../../styles/globals.css';
3
+ const SeoAdd = {
4
+ component: SeoAdditionalLink,
5
+ title: 'SeoAdditionalLink',
6
+ argTypes: {
7
+ type: {
8
+ control: 'select',
9
+ options: ['shorts', 'news', 'reference']
10
+ }
11
+ }
12
+ };
13
+ export default SeoAdd;
14
+ export const Default = {
15
+ render: args => {
16
+ return (<div className={'font-[SUIT]'}>
17
+ <SeoAdditionalLink {...args}/>
18
+ </div>);
19
+ },
20
+ args: {
21
+ type: 'news',
22
+ linkList: [
23
+ {
24
+ type_idx: 0,
25
+ tag_idx: 0,
26
+ type: 'news',
27
+ seo_type: 'success',
28
+ title: '백신 특허소송, 국내 제약사 손 들어준 특허법원',
29
+ link: 'https://www.daeryunlaw.com/trend/6940',
30
+ idx: 0
31
+ }
32
+ ]
33
+ }
34
+ };
@@ -0,0 +1,41 @@
1
+ import SeoAdditionalLink from './SeoAdditionalLink';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import '../../styles/globals.css';
4
+
5
+ const SeoAdd = {
6
+ component: SeoAdditionalLink,
7
+ title: 'SeoAdditionalLink',
8
+ argTypes: {
9
+ type: {
10
+ control: 'select',
11
+ options: ['shorts', 'news', 'reference']
12
+ }
13
+ }
14
+ } satisfies Meta<typeof SeoAdditionalLink>;
15
+
16
+ export default SeoAdd;
17
+ type Story = StoryObj<typeof SeoAdditionalLink>;
18
+
19
+ export const Default: Story = {
20
+ render: args => {
21
+ return (
22
+ <div className={'font-[SUIT]'}>
23
+ <SeoAdditionalLink {...args} />
24
+ </div>
25
+ );
26
+ },
27
+ args: {
28
+ type: 'news',
29
+ linkList: [
30
+ {
31
+ type_idx: 0,
32
+ tag_idx: 0,
33
+ type: 'news',
34
+ seo_type: 'success',
35
+ title: '백신 특허소송, 국내 제약사 손 들어준 특허법원',
36
+ link: 'https://www.daeryunlaw.com/trend/6940',
37
+ idx: 0
38
+ }
39
+ ]
40
+ }
41
+ };
@@ -0,0 +1,168 @@
1
+ 'use client';
2
+
3
+ import Link from 'next/link';
4
+ import React from 'react';
5
+ import * as gtag from '../../lib/gtag';
6
+ import Image from 'next/image';
7
+ import { IAddLinkTypes } from '../common/types/seo';
8
+ import IconRibon from '../../asset/images/seo/seoAddLink/ribon.svg';
9
+ import IconLinkOn from '../../asset/images/seo/seoAddLink/link_on.webp';
10
+ import IconLinkArrow from '../../asset/images/seo/seoAddLink/link_arrow.webp';
11
+ import IconYoutube from '../../asset/images/seo/seoAddLink/logo_youtube.webp';
12
+ import IconYoutubeSmall from '../../asset/images/seo/seoAddLink/youtubeSmall_ico.svg';
13
+
14
+ const SeoAdditionalLink = ({ type, linkList }: { type: string; linkList: IAddLinkTypes[] }) => {
15
+ const referClick = () => {
16
+ gtag.event({
17
+ action: 'contents_refer',
18
+ category: 'contents',
19
+ label: '컨텐츠 내 참고 컨텐츠 클릭',
20
+ value: '1'
21
+ });
22
+ };
23
+
24
+ const newsClick = () => {
25
+ gtag.event({
26
+ action: 'contents_news',
27
+ category: 'contents',
28
+ label: '컨텐츠 내 관련 기사 클릭',
29
+ value: '1'
30
+ });
31
+ };
32
+
33
+ return (
34
+ <>
35
+ <div
36
+ className={
37
+ 'flex items-center gap-[14px] border-[1px] border-solid border-[#D0D0D0] pr-[30px] ' +
38
+ //640px
39
+ 'max-sm:gap-[14px] ' +
40
+ //520px
41
+ 'max-2sm:gap-[10px] '
42
+ }
43
+ >
44
+ {type == 'shorts' ? (
45
+ // 쇼츠일때는 유튜브 로고
46
+ <span
47
+ className={
48
+ 'relative flex h-[47px] w-[130px] shrink-0 items-center ' +
49
+ //1500px
50
+ 'max-3xl:h-[42px] max-3xl:w-[120px] ' +
51
+ //640px
52
+ 'max-sm:h-[38px] max-sm:w-[110px] ' +
53
+ //520px
54
+ 'max-2sm:h-[33px] max-2sm:w-[100px] '
55
+ }
56
+ style={{ paddingLeft: '15px' }}
57
+ >
58
+ <Image src={IconYoutube} alt="" className={'h-6 w-[105px]'} width={210} height={48} />
59
+ </span>
60
+ ) : (
61
+ <span
62
+ className={
63
+ 'relative flex h-[47px] w-[130px] shrink-0 items-center ' +
64
+ //1500px
65
+ 'max-3xl:h-[42px] max-3xl:w-[120px] ' +
66
+ //640px
67
+ 'max-sm:h-[38px] max-sm:w-[110px] ' +
68
+ //520px
69
+ 'max-2sm:h-[33px] max-2sm:w-[100px] '
70
+ }
71
+ >
72
+ <IconRibon className="absolute left-0 top-0 -z-10 h-full w-auto " />
73
+ <p
74
+ className={
75
+ 'pl-[15px] text-[24px] font-bold leading-none tracking-[-0.96px] text-white ' +
76
+ //1500px
77
+ 'max-3xl:text-[22px] ' +
78
+ //640px
79
+ 'max-sm:text-[18px] ' +
80
+ //520px
81
+ 'max-2sm:pl-[10px] max-2sm:text-[16px] '
82
+ }
83
+ >
84
+ {type}
85
+ </p>
86
+ </span>
87
+ )}
88
+ <ul
89
+ className={
90
+ 'flex flex-col gap-[20px] py-[24px] text-[20px] font-normal tracking-[-0.7px] ' +
91
+ // 쇼츠타입 추가
92
+ `${type == 'shorts' ? 'flex min-h-[98px] items-center justify-center ' : 'text-[#0D74CE] '}` +
93
+ //1500px
94
+ 'max-3xl:text-[18px] ' +
95
+ //640px
96
+ 'max-sm:gap-[12px] max-sm:py-[20px] max-sm:text-[16px] '
97
+ }
98
+ >
99
+ {linkList
100
+ .filter(l => l.title.length > 0)
101
+ .map(linkData => (
102
+ <li key={linkData.title + linkData.idx}>
103
+ <Link
104
+ href={linkData.link}
105
+ target={type == 'shorts' ? '_blank' : '_self'}
106
+ className={
107
+ 'relative flex w-fit items-center gap-[16px] font-[600] ' +
108
+ //640px
109
+ 'max-sm:gap-[8px] '
110
+ }
111
+ onClick={() => {
112
+ if (type === '참고') referClick();
113
+ else newsClick();
114
+ }}
115
+ >
116
+ <Image
117
+ src={IconLinkArrow}
118
+ alt={''}
119
+ width={8}
120
+ height={14}
121
+ className={
122
+ 'relative h-[14px] w-[8px] object-contain ' +
123
+ //640px
124
+ 'max-sm:w-[6px] '
125
+ }
126
+ />
127
+ <p
128
+ className={
129
+ 'line-clamp-1 flex items-center leading-[1.25] max-md:line-clamp-none'
130
+ }
131
+ >
132
+ {linkData.title}
133
+ </p>
134
+ {type == 'shorts' ? (
135
+ <IconYoutubeSmall
136
+ className={
137
+ 'inline aspect-square w-[24px] shrink-0 ' +
138
+ //1500px
139
+ 'max-3xl:w-[20px] ' +
140
+ //640px
141
+ 'max-sm:w-[16px] '
142
+ }
143
+ />
144
+ ) : (
145
+ <Image
146
+ src={IconLinkOn}
147
+ alt={''}
148
+ width={16}
149
+ height={16}
150
+ className={
151
+ 'inline aspect-square w-[16px] shrink-0 ' +
152
+ //1500px
153
+ 'max-3xl:w-[14px] ' +
154
+ //640px
155
+ 'max-sm:w-[12px] '
156
+ }
157
+ />
158
+ )}
159
+ </Link>
160
+ </li>
161
+ ))}
162
+ </ul>
163
+ </div>
164
+ </>
165
+ );
166
+ };
167
+
168
+ export default SeoAdditionalLink;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { IAddLinkTypes } from '../common/types/seo';
3
+ declare const SeoYoutube: ({ linkList }: {
4
+ linkList: IAddLinkTypes[];
5
+ }) => React.JSX.Element;
6
+ export default SeoYoutube;
@@ -0,0 +1,69 @@
1
+ 'use client';
2
+ import Image from 'next/image';
3
+ import React, { useEffect, useRef, useState } from 'react';
4
+ import YoutubeModal from '../YoutubeModal/YoutubeModal';
5
+ import LogoYoutube from '../../asset/images/seo/seoAddLink/logo_youtube.webp';
6
+ import IconYoutube from '../../asset/images/seo/seoYoutube/youtube_ico.svg';
7
+ import IconYoutubeTxt from '../../asset/images/seo/seoYoutube/youtube_txt.svg';
8
+ const SeoYoutube = ({ linkList }) => {
9
+ //유튜브 관련
10
+ const [isYoutubeOn, setIsYoutubeOn] = useState(false);
11
+ const [youtubeId, setYoutubeId] = useState('');
12
+ const popOffBtnRef = useRef(null);
13
+ const extractYouTubeID = (url) => {
14
+ var _a;
15
+ const regex = /(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/;
16
+ const match = url.match(regex);
17
+ return (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : '';
18
+ };
19
+ const handleClickUpYoutube = () => {
20
+ setIsYoutubeOn(!isYoutubeOn);
21
+ setYoutubeId('');
22
+ };
23
+ const handleButtonClick = (id, num) => {
24
+ setYoutubeId(id);
25
+ setIsYoutubeOn(true); // 켜진 상태로 변경
26
+ };
27
+ useEffect(() => {
28
+ var _a;
29
+ (_a = popOffBtnRef.current) === null || _a === void 0 ? void 0 : _a.focus();
30
+ }, [isYoutubeOn]);
31
+ return (<>
32
+ <section className={'mt-8 flex justify-between gap-[36px] border-b border-solid border-[#DBDBDB] pb-[60px] tracking-[-1.92px] ' +
33
+ //1500px
34
+ 'max-3xl:gap-[24px] ' +
35
+ //640px
36
+ 'max-md2:flex-col max-md2:pb-6'}>
37
+ {/*pc 로고뷰*/}
38
+ <div className={'flex w-fit min-w-[264px] flex-col gap-y-9 max-md2:hidden'}>
39
+ <div className={'flex flex-col gap-5'}>
40
+ <IconYoutube className={'h-[67px] w-[99px]'}/>
41
+ <IconYoutubeTxt className={'h-[35px] w-[117px]'}/>
42
+ </div>
43
+ <p className={'text-2xl font-semibold leading-[34px] text-[#545454] '}>
44
+ 해당 업무사례와 관련된
45
+ <br />
46
+ 영상 콘텐츠도 함께 확인하세요.
47
+ </p>
48
+ </div>
49
+ {/*모바일 로고뷰*/}
50
+ <div className={'hidden max-md2:block'}>
51
+ <Image src={LogoYoutube} alt="" className={'h-[29px] w-[96px] object-contain'}/>
52
+ </div>
53
+ <ol className={'h-fit w-full max-w-[657px] gap-y-4 max-md2:max-w-full'}>
54
+ {linkList
55
+ .filter(l => l.title.length > 0)
56
+ .map((linkData, index) => (<li key={linkData.title + linkData.idx} className={'flex w-full flex-col gap-4 max-md2:gap-[10px]'} onClick={() => { var _a; return handleButtonClick((_a = extractYouTubeID(linkData.link)) !== null && _a !== void 0 ? _a : '', index); }}>
57
+ <div className="aspect-video w-full">
58
+ <iframe className="pointer-events-none h-full w-full" src={`https://www.youtube.com/embed/${extractYouTubeID(linkData.link)}?autoplay=0&mute=1&controls=0`} title="YouTube preview" frameBorder="0" allow=""></iframe>
59
+ </div>
60
+ <p className={'line-clamp-1 text-2xl font-semibold leading-9 text-[#545454] max-md2:text-[18px] max-md2:leading-6'}>
61
+ {linkData.title}
62
+ </p>
63
+ </li>))}
64
+ </ol>
65
+ <YoutubeModal onClick={handleClickUpYoutube} isYoutubeOn={isYoutubeOn} youtubeId={youtubeId} popOffBtnRef={popOffBtnRef}/>
66
+ </section>
67
+ </>);
68
+ };
69
+ export default SeoYoutube;
@@ -0,0 +1,12 @@
1
+ import SeoYoutube from './SeoYoutube';
2
+ import type { StoryObj } from '@storybook/react';
3
+ import '../../styles/globals.css';
4
+ declare const SeoYoutubeComponent: {
5
+ component: ({ linkList }: {
6
+ linkList: import("../common/types/seo").IAddLinkTypes[];
7
+ }) => import("react").JSX.Element;
8
+ title: string;
9
+ };
10
+ export default SeoYoutubeComponent;
11
+ type Story = StoryObj<typeof SeoYoutube>;
12
+ export declare const Default: Story;
@@ -0,0 +1,27 @@
1
+ import SeoYoutube from './SeoYoutube';
2
+ import '../../styles/globals.css';
3
+ const SeoYoutubeComponent = {
4
+ component: SeoYoutube,
5
+ title: 'SeoYoutube'
6
+ };
7
+ export default SeoYoutubeComponent;
8
+ export const Default = {
9
+ render: args => {
10
+ return (<div className={'font-[SUIT]'}>
11
+ <SeoYoutube {...args}/>
12
+ </div>);
13
+ },
14
+ args: {
15
+ linkList: [
16
+ {
17
+ type_idx: 0,
18
+ tag_idx: 0,
19
+ type: 'youtube',
20
+ seo_type: 'success',
21
+ title: '🚨실제 의뢰인 녹화본🚨 보이스피싱 피의자 경찰 조사 #경찰조사이렇게하는거다',
22
+ link: 'https://www.youtube.com/watch?v=EVW4ruKm4HA',
23
+ idx: 0
24
+ }
25
+ ]
26
+ }
27
+ };
@@ -0,0 +1,34 @@
1
+ import SeoYoutube from './SeoYoutube';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import '../../styles/globals.css';
4
+
5
+ const SeoYoutubeComponent = {
6
+ component: SeoYoutube,
7
+ title: 'SeoYoutube'
8
+ } satisfies Meta<typeof SeoYoutube>;
9
+
10
+ export default SeoYoutubeComponent;
11
+ type Story = StoryObj<typeof SeoYoutube>;
12
+
13
+ export const Default: Story = {
14
+ render: args => {
15
+ return (
16
+ <div className={'font-[SUIT]'}>
17
+ <SeoYoutube {...args} />
18
+ </div>
19
+ );
20
+ },
21
+ args: {
22
+ linkList: [
23
+ {
24
+ type_idx: 0,
25
+ tag_idx: 0,
26
+ type: 'youtube',
27
+ seo_type: 'success',
28
+ title: '🚨실제 의뢰인 녹화본🚨 보이스피싱 피의자 경찰 조사 #경찰조사이렇게하는거다',
29
+ link: 'https://www.youtube.com/watch?v=EVW4ruKm4HA',
30
+ idx: 0
31
+ }
32
+ ]
33
+ }
34
+ };
@@ -0,0 +1,103 @@
1
+ 'use client';
2
+
3
+ import Image from 'next/image';
4
+ import React, { useEffect, useRef, useState } from 'react';
5
+ import YoutubeModal from '../YoutubeModal/YoutubeModal';
6
+ import { IAddLinkTypes } from '../common/types/seo';
7
+
8
+ import LogoYoutube from '../../asset/images/seo/seoAddLink/logo_youtube.webp';
9
+ import IconYoutube from '../../asset/images/seo/seoYoutube/youtube_ico.svg';
10
+ import IconYoutubeTxt from '../../asset/images/seo/seoYoutube/youtube_txt.svg';
11
+
12
+ const SeoYoutube = ({ linkList }: { linkList: IAddLinkTypes[] }) => {
13
+ //유튜브 관련
14
+ const [isYoutubeOn, setIsYoutubeOn] = useState<boolean>(false);
15
+ const [youtubeId, setYoutubeId] = useState<string>('');
16
+ const popOffBtnRef = useRef<HTMLButtonElement>(null);
17
+
18
+ const extractYouTubeID = (url: string): string => {
19
+ const regex = /(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/;
20
+ const match = url.match(regex);
21
+ return match?.[1] ?? '';
22
+ };
23
+
24
+ const handleClickUpYoutube = () => {
25
+ setIsYoutubeOn(!isYoutubeOn);
26
+ setYoutubeId('');
27
+ };
28
+
29
+ const handleButtonClick = (id: string, num: number) => {
30
+ setYoutubeId(id);
31
+ setIsYoutubeOn(true); // 켜진 상태로 변경
32
+ };
33
+
34
+ useEffect(() => {
35
+ popOffBtnRef.current?.focus();
36
+ }, [isYoutubeOn]);
37
+
38
+ return (
39
+ <>
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'} />
64
+ </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
+ }
87
+ >
88
+ {linkData.title}
89
+ </p>
90
+ </li>
91
+ ))}
92
+ </ol>
93
+ <YoutubeModal
94
+ onClick={handleClickUpYoutube}
95
+ isYoutubeOn={isYoutubeOn}
96
+ youtubeId={youtubeId}
97
+ popOffBtnRef={popOffBtnRef}
98
+ />
99
+ </section>
100
+ </>
101
+ );
102
+ };
103
+ export default SeoYoutube;
@@ -0,0 +1,8 @@
1
+ import { RefObject } from 'react';
2
+ declare const YoutubeModal: (props: {
3
+ onClick: () => void;
4
+ isYoutubeOn: boolean;
5
+ youtubeId: string;
6
+ popOffBtnRef: RefObject<HTMLButtonElement>;
7
+ }) => import("react").JSX.Element;
8
+ export default YoutubeModal;
@@ -0,0 +1,20 @@
1
+ 'use client';
2
+ //상단 유튜브 클릭 시 모달
3
+ const YoutubeModal = (props) => {
4
+ const { onClick, isYoutubeOn, youtubeId, popOffBtnRef } = props;
5
+ return (<div className={'fixed left-0 top-0 z-[9999] h-full w-full bg-black bg-opacity-50 ' + `${isYoutubeOn ? '' : 'hidden'}`}>
6
+ <div className={'absolute left-[50%] top-[50%] aspect-[110/62] w-[80%] max-w-[1100px] translate-x-[-50%] translate-y-[-50%] ' +
7
+ //1024px
8
+ 'max-lg:aspect-[unset] max-lg:h-[40%] max-lg:min-h-[350px] max-lg:w-[90%]'}>
9
+ <button type={'button'} className={'absolute right-[-40px] top-[-50px] text-[35px] text-white ' +
10
+ //1024px
11
+ 'max-lg:right-0'} ref={popOffBtnRef} onClick={onClick} aria-label={'유튜브 모달 닫기'}>
12
+ ✕
13
+ </button>
14
+ <span className={'mx-auto w-full'}>
15
+ <iframe title={'youtube'} width="1100" height="619" src={`https://www.youtube.com/embed/${youtubeId}`} frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowFullScreen className={'h-full w-full '}></iframe>
16
+ </span>
17
+ </div>
18
+ </div>);
19
+ };
20
+ export default YoutubeModal;