@daeryun/dr_components 0.1.10 → 0.1.12

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,10 @@
1
+ import React from 'react';
2
+ declare const AreaImage: (props: {
3
+ area: {
4
+ name: string;
5
+ desc: string;
6
+ url: string;
7
+ src: string;
8
+ };
9
+ }) => React.JSX.Element;
10
+ export default AreaImage;
@@ -0,0 +1,39 @@
1
+ import React, { useState } from 'react';
2
+ import Link from 'next/link';
3
+ import Image from 'next/image';
4
+ const AreaImage = (props) => {
5
+ const { area } = props;
6
+ const [isHover, setIsHover] = useState(false);
7
+ return area.name === '' ? (<div className={`relative aspect-square text-white max-md:h-full max-md:w-full`}></div>) : (<Link href={area.src != '' ? `/map/${area.src}` : ''} aria-label={'오시는길 ' + area.name + '사무소'} className={(area.src != '' ? 'cursor-pointer' : 'pointer-events-none cursor-default ') + ' group'} onMouseOver={() => {
8
+ setIsHover(true);
9
+ }} onMouseOut={() => {
10
+ setIsHover(false);
11
+ }} onFocus={() => {
12
+ setIsHover(true);
13
+ }} onBlur={() => {
14
+ setIsHover(false);
15
+ }}>
16
+ <div aria-label={area.name} className={`relative flex aspect-square items-center justify-center text-white max-md:h-full max-md:w-full`}>
17
+ <Image src={`https://d1tgonli21s4df.cloudfront.net/main_new/${area.url}`} alt={''} draggable={'false'} fill style={{ objectFit: 'cover' }} sizes={'100%'}/>
18
+
19
+ {isHover ? (<div className={'absolute h-full w-full bg-black bg-opacity-50 p-[13px] opacity-100 max-3xl:p-[10px] max-xxl:p-[10px] max-xl:p-[7px] max-lg:p-[6px] '} aria-label={area.name}>
20
+ <div className={'flex h-full w-full items-center justify-center border border-solid border-white'}>
21
+ <Image src={`https://d1tgonli21s4df.cloudfront.net/comp/main/section10/icon_img_map_pick.webp`} alt={'hover icon'} className={'h-auto w-[28px] translate-y-[50px] ' +
22
+ 'max-xl:w-[22px] max-xl:translate-y-[35px] ' +
23
+ 'max-lg:w-[20px] max-lg:translate-y-7 ' +
24
+ 'max-md:w-[15px] max-md:translate-y-[25px] '} draggable={'false'} width={43} height={43}/>
25
+ </div>
26
+ </div>) : null}
27
+
28
+ <p className={`absolute text-center group-hover:-translate-y-[25%]`} aria-label={area.name}>
29
+ <span aria-label={area.name} className={'text-[28px] font-semibold max-3xl:text-[24px] max-xl:text-[20px] max-lg:text-[18px] max-md2:text-[16px] max-md:text-[14px] '}>
30
+ {area.name}
31
+ </span>
32
+ <span aria-label={area.desc} className={'block text-[17px] font-medium max-3xl:text-[16px] max-xl:text-[14px] max-lg:text-[12px] max-md:text-[10px] '}>
33
+ {area.desc}
34
+ </span>
35
+ </p>
36
+ </div>
37
+ </Link>);
38
+ };
39
+ export default AreaImage;
@@ -0,0 +1,94 @@
1
+ import React, { useState } from 'react';
2
+ import Link from 'next/link';
3
+ import Image from 'next/image';
4
+
5
+ const AreaImage = (props: { area: { name: string; desc: string; url: string; src: string } }) => {
6
+ const { area } = props;
7
+ const [isHover, setIsHover] = useState<boolean>(false);
8
+
9
+ return area.name === '' ? (
10
+ <div className={`relative aspect-square text-white max-md:h-full max-md:w-full`}></div>
11
+ ) : (
12
+ <Link
13
+ href={area.src != '' ? `/map/${area.src}` : ''}
14
+ aria-label={'오시는길 ' + area.name + '사무소'}
15
+ className={(area.src != '' ? 'cursor-pointer' : 'pointer-events-none cursor-default ') + ' group'}
16
+ onMouseOver={() => {
17
+ setIsHover(true);
18
+ }}
19
+ onMouseOut={() => {
20
+ setIsHover(false);
21
+ }}
22
+ onFocus={() => {
23
+ setIsHover(true);
24
+ }}
25
+ onBlur={() => {
26
+ setIsHover(false);
27
+ }}
28
+ >
29
+ <div
30
+ aria-label={area.name}
31
+ className={`relative flex aspect-square items-center justify-center text-white max-md:h-full max-md:w-full`}
32
+ >
33
+ <Image
34
+ src={`https://d1tgonli21s4df.cloudfront.net/main_new/${area.url}`}
35
+ alt={''}
36
+ draggable={'false'}
37
+ fill
38
+ style={{ objectFit: 'cover' }}
39
+ sizes={'100%'}
40
+ />
41
+
42
+ {isHover ? (
43
+ <div
44
+ className={
45
+ 'absolute h-full w-full bg-black bg-opacity-50 p-[13px] opacity-100 max-3xl:p-[10px] max-xxl:p-[10px] max-xl:p-[7px] max-lg:p-[6px] '
46
+ }
47
+ aria-label={area.name}
48
+ >
49
+ <div
50
+ className={
51
+ 'flex h-full w-full items-center justify-center border border-solid border-white'
52
+ }
53
+ >
54
+ <Image
55
+ src={`https://d1tgonli21s4df.cloudfront.net/comp/main/section10/icon_img_map_pick.webp`}
56
+ alt={'hover icon'}
57
+ className={
58
+ 'h-auto w-[28px] translate-y-[50px] ' +
59
+ 'max-xl:w-[22px] max-xl:translate-y-[35px] ' +
60
+ 'max-lg:w-[20px] max-lg:translate-y-7 ' +
61
+ 'max-md:w-[15px] max-md:translate-y-[25px] '
62
+ }
63
+ draggable={'false'}
64
+ width={43}
65
+ height={43}
66
+ />
67
+ </div>
68
+ </div>
69
+ ) : null}
70
+
71
+ <p className={`absolute text-center group-hover:-translate-y-[25%]`} aria-label={area.name}>
72
+ <span
73
+ aria-label={area.name}
74
+ className={
75
+ 'text-[28px] font-semibold max-3xl:text-[24px] max-xl:text-[20px] max-lg:text-[18px] max-md2:text-[16px] max-md:text-[14px] '
76
+ }
77
+ >
78
+ {area.name}
79
+ </span>
80
+ <span
81
+ aria-label={area.desc}
82
+ className={
83
+ 'block text-[17px] font-medium max-3xl:text-[16px] max-xl:text-[14px] max-lg:text-[12px] max-md:text-[10px] '
84
+ }
85
+ >
86
+ {area.desc}
87
+ </span>
88
+ </p>
89
+ </div>
90
+ </Link>
91
+ );
92
+ };
93
+
94
+ export default AreaImage;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import 'swiper/css';
3
+ import 'swiper/css/grid';
4
+ import 'swiper/css/pagination';
5
+ import 'swiper/swiper-bundle.css';
6
+ declare const MapFix: (props: {
7
+ selectRegion: string;
8
+ mapFixOpen: boolean;
9
+ onClose: () => void;
10
+ }) => React.JSX.Element;
11
+ export default MapFix;
@@ -0,0 +1,108 @@
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import Image from 'next/image';
3
+ import { newNapAreaMobile } from '../common';
4
+ import AreaImage from './AreaImage';
5
+ import SwiperCore from 'swiper';
6
+ import Swiper from 'swiper';
7
+ import 'swiper/css';
8
+ import 'swiper/css/grid';
9
+ import 'swiper/css/pagination';
10
+ import 'swiper/swiper-bundle.css';
11
+ import { SwiperSlide } from 'swiper/react';
12
+ import Link from 'next/link';
13
+ import { useRouter } from 'next/router';
14
+ import { Pagination } from 'swiper/modules';
15
+ SwiperCore.use([Pagination]);
16
+ const MapFix = (props) => {
17
+ const { selectRegion, mapFixOpen, onClose } = props;
18
+ const router = useRouter();
19
+ const [mapAreas, setMapAreas] = useState([]);
20
+ const [isShow, setIsShow] = useState(true);
21
+ const swiper = useRef(null);
22
+ const divRef = useRef(null);
23
+ useEffect(() => {
24
+ var _a;
25
+ if (mapFixOpen) {
26
+ swiper.current = new Swiper('#swiper-container-map', {
27
+ modules: [Pagination],
28
+ slidesPerView: 1,
29
+ pagination: {
30
+ el: '#map-pagination',
31
+ clickable: true,
32
+ bulletClass: 'map-fix-swiper-pagination-inactive',
33
+ bulletActiveClass: 'map-fix-swiper-pagination-active'
34
+ }
35
+ });
36
+ (_a = swiper.current) === null || _a === void 0 ? void 0 : _a.update();
37
+ return () => {
38
+ var _a;
39
+ if (swiper.current && ((_a = swiper.current) === null || _a === void 0 ? void 0 : _a.destroy)) {
40
+ swiper.current.destroy();
41
+ }
42
+ };
43
+ }
44
+ }, [selectRegion, mapAreas, mapFixOpen]);
45
+ useEffect(() => {
46
+ const handleClickOutside = (event) => {
47
+ const map = document.getElementById('map');
48
+ const banner = document.getElementById('bottom-banner');
49
+ if (divRef.current &&
50
+ !divRef.current.contains(event.target) &&
51
+ !(map && map.contains(event.target)) &&
52
+ !(banner && banner.contains(event.target))) {
53
+ onClose();
54
+ }
55
+ };
56
+ document.addEventListener('mousedown', handleClickOutside);
57
+ return () => {
58
+ document.removeEventListener('mousedown', handleClickOutside);
59
+ };
60
+ }, [divRef]);
61
+ useEffect(() => {
62
+ const data = newNapAreaMobile[selectRegion];
63
+ setMapAreas(data);
64
+ }, [selectRegion]);
65
+ useEffect(() => {
66
+ onClose();
67
+ if (router.pathname === '/') {
68
+ setIsShow(true);
69
+ }
70
+ else {
71
+ setIsShow(false);
72
+ }
73
+ }, [router.pathname]);
74
+ return isShow ? (<div ref={divRef} className={'overflow-hidden rounded-t-[10px] bg-[#fff] shadow-[0px_-3px_6px_#00000029] transition-[transform,height] duration-700 ease-linear md:hidden ' +
75
+ (mapFixOpen ? ' h-[400px] translate-y-0 ' : ' z-0 h-[0px] translate-y-[500px] ')}>
76
+ <div className={'relative flex h-full w-full flex-col justify-between px-[30px] pb-10 pt-[30px] md:hidden '}>
77
+ <span>
78
+ <Image src={'/images/header/menu_x.webp'} width={54} height={54} alt={'지도 레이어 팝업 닫기'} className={'absolute right-5 top-5 h-[15px] w-[15px] cursor-pointer'} draggable={false} onClick={() => {
79
+ onClose();
80
+ }}/>
81
+ <div>
82
+ <p className={'mb-[20px] text-center text-[20px] font-[700] leading-none'}>{selectRegion}</p>
83
+
84
+ <div id={'swiper-container-map'} className={'mx-auto h-[200px] w-full max-w-[300px] overflow-hidden'}>
85
+ <span className={'swiper-wrapper h-full w-full'}>
86
+ {mapAreas && mapAreas.length > 0 ? ([...Array(Math.ceil(mapAreas.length / 6))].map((_, wrapperIndex) => {
87
+ return (<SwiperSlide className={'mb-[5px] mr-[5px] !grid !grid-cols-3 !gap-[5px]'} key={wrapperIndex}>
88
+ {[...Array(6)].map((_, areaIndex) => {
89
+ const index = wrapperIndex * 6 + areaIndex;
90
+ return mapAreas[index] ? (<AreaImage area={mapAreas[index]} key={areaIndex}/>) : (<></>);
91
+ })}
92
+ </SwiperSlide>);
93
+ })) : (<></>)}
94
+ </span>
95
+ </div>
96
+ </div>
97
+ <span className={'mx-auto mt-1 flex h-[20px] !w-[46px] items-center justify-center gap-[3px]'} id={'map-pagination'}></span>
98
+ </span>
99
+ <Link className={'mx-auto flex h-[50px] w-[183px] items-center justify-between rounded-[40px] border border-solid border-black px-[20px] text-[16px] font-bold leading-none tracking-[-0.32px]'} href={'/map'} onClick={() => {
100
+ onClose();
101
+ }}>
102
+ VIEW MORE{' '}
103
+ <Image width={52} height={39} draggable={'false'} alt={''} src={'https://daeryun-homepage.s3.ap-northeast-2.amazonaws.com/main_new/icon_arrow_black.webp'} className={'h-auto w-[20px]'}/>
104
+ </Link>
105
+ </div>
106
+ </div>) : (<></>);
107
+ };
108
+ export default MapFix;
@@ -0,0 +1,173 @@
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import Image from 'next/image';
3
+ import { newNapAreaMobile } from '../common';
4
+ import AreaImage from './AreaImage';
5
+
6
+ import SwiperCore from 'swiper';
7
+ import Swiper from 'swiper';
8
+
9
+ import 'swiper/css';
10
+ import 'swiper/css/grid';
11
+ import 'swiper/css/pagination';
12
+ import 'swiper/swiper-bundle.css';
13
+ import { SwiperSlide } from 'swiper/react';
14
+ import Link from 'next/link';
15
+ import { useRouter } from 'next/router';
16
+ import { Pagination } from 'swiper/modules';
17
+
18
+ SwiperCore.use([Pagination]);
19
+
20
+ const MapFix = (props: { selectRegion: string; mapFixOpen: boolean; onClose: () => void }) => {
21
+ const { selectRegion, mapFixOpen, onClose } = props;
22
+ const router = useRouter();
23
+
24
+ const [mapAreas, setMapAreas] = useState<{ name: string; desc: string; url: string; src: string }[]>([]);
25
+ const [isShow, setIsShow] = useState<boolean>(true);
26
+
27
+ const swiper = useRef<Swiper | null>(null);
28
+ const divRef = useRef<HTMLDivElement>(null);
29
+
30
+ useEffect(() => {
31
+ if (mapFixOpen) {
32
+ swiper.current = new Swiper('#swiper-container-map', {
33
+ modules: [Pagination],
34
+ slidesPerView: 1,
35
+ pagination: {
36
+ el: '#map-pagination',
37
+ clickable: true,
38
+ bulletClass: 'map-fix-swiper-pagination-inactive',
39
+ bulletActiveClass: 'map-fix-swiper-pagination-active'
40
+ }
41
+ });
42
+ swiper.current?.update();
43
+
44
+ return () => {
45
+ if (swiper.current && swiper.current?.destroy) {
46
+ swiper.current.destroy();
47
+ }
48
+ };
49
+ }
50
+ }, [selectRegion, mapAreas, mapFixOpen]);
51
+
52
+ useEffect(() => {
53
+ const handleClickOutside = (event: MouseEvent) => {
54
+ const map = document.getElementById('map');
55
+ const banner = document.getElementById('bottom-banner');
56
+ if (
57
+ divRef.current &&
58
+ !divRef.current.contains(event.target as Node) &&
59
+ !(map && map.contains(event.target as Node)) &&
60
+ !(banner && banner.contains(event.target as Node))
61
+ ) {
62
+ onClose();
63
+ }
64
+ };
65
+
66
+ document.addEventListener('mousedown', handleClickOutside);
67
+
68
+ return () => {
69
+ document.removeEventListener('mousedown', handleClickOutside);
70
+ };
71
+ }, [divRef]);
72
+
73
+ useEffect(() => {
74
+ const data = newNapAreaMobile[selectRegion];
75
+ setMapAreas(data);
76
+ }, [selectRegion]);
77
+
78
+ useEffect(() => {
79
+ onClose();
80
+ if (router.pathname === '/') {
81
+ setIsShow(true);
82
+ } else {
83
+ setIsShow(false);
84
+ }
85
+ }, [router.pathname]);
86
+
87
+ return isShow ? (
88
+ <div
89
+ ref={divRef}
90
+ className={
91
+ 'overflow-hidden rounded-t-[10px] bg-[#fff] shadow-[0px_-3px_6px_#00000029] transition-[transform,height] duration-700 ease-linear md:hidden ' +
92
+ (mapFixOpen ? ' h-[400px] translate-y-0 ' : ' z-0 h-[0px] translate-y-[500px] ')
93
+ }
94
+ >
95
+ <div
96
+ className={'relative flex h-full w-full flex-col justify-between px-[30px] pb-10 pt-[30px] md:hidden '}
97
+ >
98
+ <span>
99
+ <Image
100
+ src={'/images/header/menu_x.webp'}
101
+ width={54}
102
+ height={54}
103
+ alt={'지도 레이어 팝업 닫기'}
104
+ className={'absolute right-5 top-5 h-[15px] w-[15px] cursor-pointer'}
105
+ draggable={false}
106
+ onClick={() => {
107
+ onClose();
108
+ }}
109
+ />
110
+ <div>
111
+ <p className={'mb-[20px] text-center text-[20px] font-[700] leading-none'}>{selectRegion}</p>
112
+
113
+ <div
114
+ id={'swiper-container-map'}
115
+ className={'mx-auto h-[200px] w-full max-w-[300px] overflow-hidden'}
116
+ >
117
+ <span className={'swiper-wrapper h-full w-full'}>
118
+ {mapAreas && mapAreas.length > 0 ? (
119
+ [...Array(Math.ceil(mapAreas.length / 6))].map((_, wrapperIndex) => {
120
+ return (
121
+ <SwiperSlide
122
+ className={'mb-[5px] mr-[5px] !grid !grid-cols-3 !gap-[5px]'}
123
+ key={wrapperIndex}
124
+ >
125
+ {[...Array(6)].map((_, areaIndex) => {
126
+ const index = wrapperIndex * 6 + areaIndex;
127
+ return mapAreas[index] ? (
128
+ <AreaImage area={mapAreas[index]} key={areaIndex} />
129
+ ) : (
130
+ <></>
131
+ );
132
+ })}
133
+ </SwiperSlide>
134
+ );
135
+ })
136
+ ) : (
137
+ <></>
138
+ )}
139
+ </span>
140
+ </div>
141
+ </div>
142
+ <span
143
+ className={'mx-auto mt-1 flex h-[20px] !w-[46px] items-center justify-center gap-[3px]'}
144
+ id={'map-pagination'}
145
+ ></span>
146
+ </span>
147
+ <Link
148
+ className={
149
+ 'mx-auto flex h-[50px] w-[183px] items-center justify-between rounded-[40px] border border-solid border-black px-[20px] text-[16px] font-bold leading-none tracking-[-0.32px]'
150
+ }
151
+ href={'/map'}
152
+ onClick={() => {
153
+ onClose();
154
+ }}
155
+ >
156
+ VIEW MORE{' '}
157
+ <Image
158
+ width={52}
159
+ height={39}
160
+ draggable={'false'}
161
+ alt={''}
162
+ src={'https://daeryun-homepage.s3.ap-northeast-2.amazonaws.com/main_new/icon_arrow_black.webp'}
163
+ className={'h-auto w-[20px]'}
164
+ />
165
+ </Link>
166
+ </div>
167
+ </div>
168
+ ) : (
169
+ <></>
170
+ );
171
+ };
172
+
173
+ export default MapFix;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface IMapArea {
3
2
  [region: string]: Array<{
4
3
  name: string;
@@ -7,18 +6,7 @@ export interface IMapArea {
7
6
  src: string;
8
7
  }>;
9
8
  }
10
- export declare const mapArea: IMapArea;
11
- export declare const mobileMapArea: IMapArea;
12
- export declare const MapPoints: {
13
- name: string;
14
- province: string;
15
- position: React.CSSProperties;
16
- }[];
17
- export declare const MobileMapPoints: {
18
- name: string;
19
- province: string;
20
- position: React.CSSProperties;
21
- }[];
9
+ export declare const newNapAreaMobile: IMapArea;
22
10
  export declare const centerListExample: ({
23
11
  code: string;
24
12
  code_name: string;