@daeryun/dr_components 0.4.42 → 0.4.44

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.
@@ -1,21 +1,5 @@
1
1
  import React from 'react';
2
2
  import { IListPagesType, IListTypes } from './integrateType';
3
- export interface LawyerData {
4
- id: string;
5
- name: string;
6
- image: string;
7
- code: string;
8
- array_to_string: string;
9
- careers_summary?: string;
10
- ability: string;
11
- mark: string;
12
- tel: string | null;
13
- l_sort_center: string[] | null;
14
- exist_l_sort_center: string[] | null;
15
- l_position: string | null;
16
- email: string | null;
17
- group_career: string | null;
18
- }
19
3
  declare const Lawyer: (props: {
20
4
  tab: string;
21
5
  onMoreViewText: (str: string) => void;
@@ -28,25 +28,7 @@ const Lawyer = (props) => {
28
28
 
29
29
  <div className={'mx-auto my-16 grid w-full grid-cols-2 gap-y-5 max-md:gap-y-2 md:grid-cols-3 xl:grid-cols-4'}>
30
30
  {(tab === '전체' ? list.lawyerList.slice(0, 8) : list.lawyerList).map((item, index) => {
31
- var _a;
32
- const newItem = {
33
- id: item.id,
34
- name: item.name,
35
- image: (_a = item.nukki) !== null && _a !== void 0 ? _a : '',
36
- code: item.code,
37
- group_career: item.group_career,
38
- array_to_string: item.careers,
39
- careers_summary: item.careers_summary,
40
- ability: item.ability,
41
- mark: item.mark,
42
- tel: item.tel,
43
- l_position: item.position,
44
- email: item.email,
45
- l_sort_center: item.l_sort_center,
46
- exist_l_sort_center: item.exist_l_sort_center,
47
- thumbnail: item.image
48
- };
49
- return (<LawyerContainer key={item.id} center_code={props.center_code} item={newItem} lawyerImagePath={lawyerImagePath} specialtyArr={item.l_sort_center ? item.l_sort_center : []} firstAddRef={index === 0 || (index > 12 && index === list.lawyerList.length - 12)
31
+ return (<LawyerContainer key={item.id} center_code={props.center_code} item={item} lawyerImagePath={lawyerImagePath} firstAddRef={index === 0 || (index > 12 && index === list.lawyerList.length - 12)
50
32
  ? firstAddRef
51
33
  : null}/>);
52
34
  })}
@@ -62,7 +44,7 @@ const Lawyer = (props) => {
62
44
  export default Lawyer;
63
45
  const LawyerContainer = (props) => {
64
46
  var _a;
65
- const { item, lawyerImagePath, selectedFilter = '', specialtyArr = [], onClickTel, isPro = false, firstAddRef = null } = props;
47
+ const { item, lawyerImagePath, selectedFilter = '', onClickTel, isPro = false, firstAddRef = null } = props;
66
48
  const router = useRouter();
67
49
  const MailClick = () => {
68
50
  gtag.event({
@@ -79,12 +61,12 @@ const LawyerContainer = (props) => {
79
61
  pathname: '/lawyer/' + item.id
80
62
  }} tabIndex={-1}>
81
63
  <div className={'relative flex items-center justify-center bg-[#F8F8F8]'}>
82
- <Image loading={'lazy'} src={lawyerImagePath + '/' + item.image} alt={item.array_to_string &&
83
- item.array_to_string.indexOf(selectedFilter) > -1 &&
64
+ <Image loading={'lazy'} src={lawyerImagePath + '/' + item.nukki} alt={item.careers &&
65
+ item.careers.indexOf(selectedFilter) > -1 &&
84
66
  selectedFilter !== '전체'
85
67
  ? `${selectedFilter}전문변호사 ${item.name} ${item.code}`
86
- : `${item.name} ${item.code}`} title={item.array_to_string &&
87
- item.array_to_string.indexOf(selectedFilter) > -1 &&
68
+ : `${item.name} ${item.code}`} title={item.careers &&
69
+ item.careers.indexOf(selectedFilter) > -1 &&
88
70
  selectedFilter !== '전체'
89
71
  ? `${selectedFilter}전문변호사 ${item.name} ${item.code}`
90
72
  : `${item.name} ${item.code}`} width={210} height={280} className={'mt-6 h-auto w-[90%]'} quality={100}/>
@@ -108,8 +90,8 @@ const LawyerContainer = (props) => {
108
90
  {item.code}
109
91
  </p>
110
92
 
111
- {item.l_position ? (<p className={' bg-[#F7FBFF] py-1 text-[14px] font-[600] tracking-[-1px] text-[#454545] lg:text-[18px]'}>
112
- {item.l_position}
93
+ {item.position ? (<p className={' bg-[#F7FBFF] py-1 text-[14px] font-[600] tracking-[-1px] text-[#454545] lg:text-[18px]'}>
94
+ {item.position}
113
95
  </p>) : (<div className={'h-[35px] max-lg:hidden'}></div>)}
114
96
  </span>
115
97
  </Link>
@@ -141,9 +123,13 @@ const LawyerContainer = (props) => {
141
123
  <Image src={'/images/lawyer/email_icon.webp'} alt={'이메일'} width={64} height={64} className={'w-[32px] max-lg:w-[28px] max-xs:w-[25px]'}/>
142
124
  </Link>) : (<></>)}
143
125
  </span>
144
- {specialtyArr.length > 1 ? (<div className={'relative mt-2 border-t border-solid border-[#D0D0D0]'}>
126
+ {item.careers && item.careers != '' ? (<div className={'relative mt-2 border-t border-solid border-[#D0D0D0]'}>
145
127
  <p className={'mt-3 line-clamp-1 text-ellipsis text-[14px] font-medium text-[#6e6e6e] lg:text-[18px]'}>
146
- {specialtyArr.join('·')} 전문
128
+ {item.careers
129
+ .replaceAll(',', '')
130
+ .replace('일반소송', '민사')
131
+ .replace('중재', '손해배상')}
132
+ 전문
147
133
  </p>
148
134
  </div>) : (<></>)}
149
135
  </div>
@@ -1,7 +1,7 @@
1
1
  import React, { RefObject, useEffect, useRef, useState } from 'react';
2
2
  import { NoResult } from './NoResult';
3
3
  import { Title } from './Title';
4
- import { IListPagesType, IListTypes } from './integrateType';
4
+ import { ILawyerTypes, IListPagesType, IListTypes } from './integrateType';
5
5
  import { ViewMore } from './ViewMore';
6
6
 
7
7
  import * as gtag from '../../../lib/gtag';
@@ -12,23 +12,6 @@ import Image from 'next/image';
12
12
  import style from './index.module.css';
13
13
  import Mark from '../../Mark/Mark';
14
14
 
15
- export interface LawyerData {
16
- id: string;
17
- name: string;
18
- image: string;
19
- code: string;
20
- array_to_string: string;
21
- careers_summary?: string;
22
- ability: string;
23
- mark: string;
24
- tel: string | null;
25
- l_sort_center: string[] | null;
26
- exist_l_sort_center: string[] | null;
27
- l_position: string | null;
28
- email: string | null;
29
- group_career: string | null;
30
- }
31
-
32
15
  const Lawyer = (props: {
33
16
  tab: string;
34
17
  onMoreViewText: (str: string) => void;
@@ -83,31 +66,12 @@ const Lawyer = (props: {
83
66
  >
84
67
  {(tab === '전체' ? list.lawyerList.slice(0, 8) : list.lawyerList).map(
85
68
  (item, index: number) => {
86
- const newItem: ILawyerProData = {
87
- id: item.id,
88
- name: item.name,
89
- image: item.nukki ?? '',
90
- code: item.code,
91
- group_career: item.group_career,
92
- array_to_string: item.careers,
93
- careers_summary: item.careers_summary,
94
- ability: item.ability,
95
- mark: item.mark,
96
- tel: item.tel,
97
- l_position: item.position,
98
- email: item.email,
99
- l_sort_center: item.l_sort_center,
100
- exist_l_sort_center: item.exist_l_sort_center,
101
- thumbnail: item.image
102
- };
103
-
104
69
  return (
105
70
  <LawyerContainer
106
71
  key={item.id}
107
72
  center_code={props.center_code}
108
- item={newItem}
73
+ item={item}
109
74
  lawyerImagePath={lawyerImagePath}
110
- specialtyArr={item.l_sort_center ? item.l_sort_center : []}
111
75
  firstAddRef={
112
76
  index === 0 || (index > 12 && index === list.lawyerList.length - 12)
113
77
  ? firstAddRef
@@ -142,7 +106,7 @@ const Lawyer = (props: {
142
106
 
143
107
  export default Lawyer;
144
108
 
145
- interface ILawyerProData extends LawyerData {
109
+ interface ILawyerProData extends ILawyerTypes {
146
110
  thumbnail?: string;
147
111
  }
148
112
 
@@ -151,20 +115,11 @@ const LawyerContainer = (props: {
151
115
  lawyerImagePath: string;
152
116
  center_code: string;
153
117
  selectedFilter?: string; // 이미지 alt 용
154
- specialtyArr?: string[]; // 업무 분야
155
118
  onClickTel?: () => void; // 전화번호 클릭 이벤트
156
119
  isPro?: boolean; // true 일 시 특수분야 전문가
157
120
  firstAddRef?: RefObject<HTMLAnchorElement> | null; //통합검색용 접근성
158
121
  }) => {
159
- const {
160
- item,
161
- lawyerImagePath,
162
- selectedFilter = '',
163
- specialtyArr = [],
164
- onClickTel,
165
- isPro = false,
166
- firstAddRef = null
167
- } = props;
122
+ const { item, lawyerImagePath, selectedFilter = '', onClickTel, isPro = false, firstAddRef = null } = props;
168
123
  const router = useRouter();
169
124
 
170
125
  const MailClick = () => {
@@ -189,17 +144,17 @@ const LawyerContainer = (props: {
189
144
  <div className={'relative flex items-center justify-center bg-[#F8F8F8]'}>
190
145
  <Image
191
146
  loading={'lazy'}
192
- src={lawyerImagePath + '/' + item.image}
147
+ src={lawyerImagePath + '/' + item.nukki}
193
148
  alt={
194
- item.array_to_string &&
195
- item.array_to_string.indexOf(selectedFilter) > -1 &&
149
+ item.careers &&
150
+ item.careers.indexOf(selectedFilter) > -1 &&
196
151
  selectedFilter !== '전체'
197
152
  ? `${selectedFilter}전문변호사 ${item.name} ${item.code}`
198
153
  : `${item.name} ${item.code}`
199
154
  }
200
155
  title={
201
- item.array_to_string &&
202
- item.array_to_string.indexOf(selectedFilter) > -1 &&
156
+ item.careers &&
157
+ item.careers.indexOf(selectedFilter) > -1 &&
203
158
  selectedFilter !== '전체'
204
159
  ? `${selectedFilter}전문변호사 ${item.name} ${item.code}`
205
160
  : `${item.name} ${item.code}`
@@ -253,13 +208,13 @@ const LawyerContainer = (props: {
253
208
  {item.code}
254
209
  </p>
255
210
 
256
- {item.l_position ? (
211
+ {item.position ? (
257
212
  <p
258
213
  className={
259
214
  ' bg-[#F7FBFF] py-1 text-[14px] font-[600] tracking-[-1px] text-[#454545] lg:text-[18px]'
260
215
  }
261
216
  >
262
- {item.l_position}
217
+ {item.position}
263
218
  </p>
264
219
  ) : (
265
220
  <div className={'h-[35px] max-lg:hidden'}></div>
@@ -330,14 +285,18 @@ const LawyerContainer = (props: {
330
285
  <></>
331
286
  )}
332
287
  </span>
333
- {specialtyArr.length > 1 ? (
288
+ {item.careers && item.careers != '' ? (
334
289
  <div className={'relative mt-2 border-t border-solid border-[#D0D0D0]'}>
335
290
  <p
336
291
  className={
337
292
  'mt-3 line-clamp-1 text-ellipsis text-[14px] font-medium text-[#6e6e6e] lg:text-[18px]'
338
293
  }
339
294
  >
340
- {specialtyArr.join('·')} 전문
295
+ {item.careers
296
+ .replaceAll(',', '')
297
+ .replace('일반소송', '민사')
298
+ .replace('중재', '손해배상')}
299
+ 전문
341
300
  </p>
342
301
  </div>
343
302
  ) : (
@@ -1,6 +1,17 @@
1
1
  'use client';
2
- import React, { Suspense } from 'react';
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import React, { Suspense, useEffect } from 'react';
12
+ import { usePathname } from 'next/navigation';
3
13
  import LoginContainer from './LoginComp/LoginContainer';
14
+ import { fetchUserData } from './_api/fetchUserData';
4
15
  const Login = ({ layoutClassName = ' relative h-[100vh] max-h-[1200px] min-h-[1000px] w-full overflow-hidden bg-white font-[SUIT] ' +
5
16
  ' max-3xl:max-h-[1080px] max-3xl:min-h-[1000px] ' +
6
17
  ' max-lg:min-h-[930px] ' +
@@ -8,6 +19,20 @@ const Login = ({ layoutClassName = ' relative h-[100vh] max-h-[1200px] min-h-[10
8
19
  ' mb-[192px] mt-[128px] ' +
9
20
  ' max-lg:mt-[112px] ' +
10
21
  ' max-sm:mt-[100px] ', state }) => {
22
+ const pathName = usePathname();
23
+ const userCheck = () => __awaiter(void 0, void 0, void 0, function* () {
24
+ const result = yield fetchUserData();
25
+ return result.isLogin;
26
+ });
27
+ useEffect(() => {
28
+ const checkUser = () => __awaiter(void 0, void 0, void 0, function* () {
29
+ const result = yield userCheck();
30
+ if (result) {
31
+ window.location.href = '/';
32
+ }
33
+ });
34
+ checkUser();
35
+ }, [pathName]);
11
36
  return (<Suspense>
12
37
  <LoginContainer layoutClassName={layoutClassName} state={state}/>
13
38
  </Suspense>);
@@ -7,6 +7,8 @@ import PageWrapper from '../../Layout/PageWrapper';
7
7
  import { setCookie } from '../../../lib';
8
8
  import LoginBreadCrumb from './LoginComp/LoginBreadCrumb';
9
9
  import LoginContainer from './LoginComp/LoginContainer';
10
+ import { ILoginInfo } from './_types/login';
11
+ import { fetchUserData } from './_api/fetchUserData';
10
12
 
11
13
  interface props {
12
14
  layoutClassName?: string; // 높이 및 마진값 조절
@@ -22,6 +24,22 @@ const Login = ({
22
24
  ' max-sm:mt-[100px] ',
23
25
  state
24
26
  }: props) => {
27
+ const pathName = usePathname();
28
+ const userCheck = async (): Promise<boolean> => {
29
+ const result: ILoginInfo = await fetchUserData();
30
+ return result.isLogin;
31
+ };
32
+
33
+ useEffect(() => {
34
+ const checkUser = async () => {
35
+ const result = await userCheck();
36
+ if (result) {
37
+ window.location.href = '/';
38
+ }
39
+ };
40
+
41
+ checkUser();
42
+ }, [pathName]);
25
43
  return (
26
44
  <Suspense>
27
45
  <LoginContainer layoutClassName={layoutClassName} state={state} />
@@ -1,7 +1,32 @@
1
1
  'use client';
2
- import React, { Suspense } from 'react';
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import React, { Suspense, useEffect } from 'react';
3
12
  import SignContainer from './LoginComp/SignContainer';
13
+ import { usePathname } from 'next/navigation';
14
+ import { fetchUserData } from './_api/fetchUserData';
4
15
  const Sign = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px] max-lg:py-[112px] max-sm:mt-[28px] max-sm:py-[100px]`, setUser }) => {
16
+ const pathName = usePathname();
17
+ const userCheck = () => __awaiter(void 0, void 0, void 0, function* () {
18
+ const result = yield fetchUserData();
19
+ return result.isLogin;
20
+ });
21
+ useEffect(() => {
22
+ const checkUser = () => __awaiter(void 0, void 0, void 0, function* () {
23
+ const result = yield userCheck();
24
+ if (result) {
25
+ window.location.href = '/';
26
+ }
27
+ });
28
+ checkUser();
29
+ }, [pathName]);
5
30
  return (<Suspense>
6
31
  <SignContainer layoutClassName={layoutClassName} setUser={setUser}/>
7
32
  </Suspense>);
@@ -1,8 +1,9 @@
1
1
  'use client';
2
- import React, { Suspense } from 'react';
3
- import { RecoilState } from 'recoil';
2
+ import React, { Suspense, useEffect } from 'react';
4
3
  import SignContainer from './LoginComp/SignContainer';
5
4
  import { ILoginInfo } from './_types/login';
5
+ import { usePathname, useRouter } from 'next/navigation';
6
+ import { fetchUserData } from './_api/fetchUserData';
6
7
 
7
8
  type props = {
8
9
  layoutClassName?: string;
@@ -13,6 +14,23 @@ const Sign = ({
13
14
  layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px] max-lg:py-[112px] max-sm:mt-[28px] max-sm:py-[100px]`,
14
15
  setUser
15
16
  }: props) => {
17
+ const pathName = usePathname();
18
+ const userCheck = async (): Promise<boolean> => {
19
+ const result: ILoginInfo = await fetchUserData();
20
+ return result.isLogin;
21
+ };
22
+
23
+ useEffect(() => {
24
+ const checkUser = async () => {
25
+ const result = await userCheck();
26
+ if (result) {
27
+ window.location.href = '/';
28
+ }
29
+ };
30
+
31
+ checkUser();
32
+ }, [pathName]);
33
+
16
34
  return (
17
35
  <Suspense>
18
36
  <SignContainer layoutClassName={layoutClassName} setUser={setUser} />