@daeryun/dr_components 0.3.34 → 0.3.36

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.
@@ -71,7 +71,7 @@ const MyCaseDetailPageContainer = ({ jwt }) => {
71
71
  />
72
72
  )} */}
73
73
  {selected === '계약정보' && <ContactInfo />}
74
- {selected === '사건문의' && (<CaseInquiry myCaseQuestion={myCaseQuestion === null || myCaseQuestion === void 0 ? void 0 : myCaseQuestion.list} id={id} refetch={myCaseQuestionRefetch} pageSize={pageSize} totalLength={(_a = myCaseQuestion === null || myCaseQuestion === void 0 ? void 0 : myCaseQuestion.totalLength) !== null && _a !== void 0 ? _a : 0} pageNumber={pageNumber} onChange={() => { }}/>)}
74
+ {selected === '사건문의' && (<CaseInquiry myCaseQuestion={myCaseQuestion === null || myCaseQuestion === void 0 ? void 0 : myCaseQuestion.list} isLoading={myCaseQuestionLoading} id={id} refetch={myCaseQuestionRefetch} pageSize={pageSize} totalLength={(_a = myCaseQuestion === null || myCaseQuestion === void 0 ? void 0 : myCaseQuestion.totalLength) !== null && _a !== void 0 ? _a : 0} pageNumber={pageNumber} onChange={() => { }}/>)}
75
75
  </HeaderLayout>
76
76
  </div>
77
77
  </div>
@@ -137,6 +137,7 @@ const MyCaseDetailPageContainer = ({ jwt }: { jwt?: string }) => {
137
137
  {selected === '사건문의' && (
138
138
  <CaseInquiry
139
139
  myCaseQuestion={myCaseQuestion?.list as unknown as Question[]}
140
+ isLoading={myCaseQuestionLoading}
140
141
  id={id as string}
141
142
  refetch={myCaseQuestionRefetch}
142
143
  pageSize={pageSize}
@@ -1,6 +1,7 @@
1
1
  import { Question } from '../../../_type/type';
2
- declare const CaseInquiry: ({ myCaseQuestion, id, refetch, pageSize, totalLength, pageNumber, onChange }: {
2
+ declare const CaseInquiry: ({ myCaseQuestion, isLoading, id, refetch, pageSize, totalLength, pageNumber, onChange }: {
3
3
  myCaseQuestion: Question[];
4
+ isLoading: boolean;
4
5
  id: string;
5
6
  refetch: () => void;
6
7
  pageSize: number;
@@ -9,6 +9,7 @@ import inkPen from '../../../../../../asset/images/myCase/icon/ink_pen.webp';
9
9
  import client from '../../../../../../asset/images/myCase/icon/client.webp';
10
10
  import daeryun from '../../../../../../asset/images/myCase/icon/daeryun.webp';
11
11
  import arrowB from '../../../../../../asset/images/myCase/arrow_b.webp';
12
+ import Loading from '../../../_component/_loading/Loading';
12
13
  const AnswerBox = ({ item, isOpen, openId, setOpenId }) => {
13
14
  const ref = useRef(null);
14
15
  return (<div ref={ref} className={`transition-height duration-300 ${(item === null || item === void 0 ? void 0 : item.answer) ? 'cursor-pointer' : ''} overflow-hidden`} onClick={() => {
@@ -62,27 +63,29 @@ const AnswerBox = ({ item, isOpen, openId, setOpenId }) => {
62
63
  </div>
63
64
  </div>);
64
65
  };
65
- const CaseInquiry = ({ myCaseQuestion, id, refetch, pageSize, totalLength, pageNumber, onChange }) => {
66
+ const CaseInquiry = ({ myCaseQuestion, isLoading, id, refetch, pageSize, totalLength, pageNumber, onChange }) => {
66
67
  const [openId, setOpenId] = useState('0');
67
68
  const [isOpen, setIsOpen] = useState(false);
68
69
  return (<CaseLayout isMobilePadding={false} outerClassName="mt-[35px] sm-top:mt-[24px] lg:mt-[40px] " innerClassName={'pt-[32px] px-[20px] pb-[80px] 2sm:px-[40px] sm-top:pt-[56px] sm-top:px-[50px] sm-top:pb-[60px] lg:pt-[70px] lg:pb-[80px] lg:px-[60px]'}>
69
- <div className="sm-top:gap-[12px] flex flex-col gap-[8px] lg:gap-[24px]">
70
- {(myCaseQuestion === null || myCaseQuestion === void 0 ? void 0 : myCaseQuestion.length) > 0 ? (myCaseQuestion === null || myCaseQuestion === void 0 ? void 0 : myCaseQuestion.map((item, index) => (<AnswerBox key={index} item={item} isOpen={openId === item.idx.toString()} openId={openId} setOpenId={setOpenId}/>))) : (<EmptyTable tap="caseInquiry" subTap={0} isMinHeight={false}/>)}
71
- </div>
72
- <div className={` flex items-center justify-end ${(myCaseQuestion === null || myCaseQuestion === void 0 ? void 0 : myCaseQuestion.length) > 0
73
- ? 'sm-top:mt-[80px] mt-[40px] lg:mt-[60px] '
74
- : 'sm-top:mt-[95px] mt-[69px] lg:mt-[112px]'}`}>
75
- <button onClick={() => setIsOpen(prev => !prev)} className=" bg-mycaseMainColor sm-top:h-[60px] sm-top:w-[188px] sm-top:gap-[23px] sm-top:rounded-[36px] flex h-[48px] w-[132px] items-center justify-center gap-[14px] rounded-[24px] text-white lg:h-[72px] lg:w-[220px] lg:gap-[21px]">
76
- <Image src={inkPen} alt="ink_pen" width={28.5} height={28.5} className="sm-top:h-[23.75px] sm-top:w-[23.75px] h-[19px] w-[19px] lg:h-[28.5px] lg:w-[28.5px]"/>
77
- <p className="body_large2_mo sm-top:body_large2_tb lg:body_large2" style={{ color: 'white' }}>
78
- 문의하기
79
- </p>
80
- </button>
81
- </div>
82
- <CaseInquiryAddModal isOpen={isOpen} onClose={() => setIsOpen(false)} id={id} refetch={refetch}/>
83
- <Suspense>
84
- <PaginationComponent pageSize={pageSize} total={totalLength} onChange={onChange} current={pageNumber}/>
85
- </Suspense>
70
+ {isLoading ? (<Loading />) : (<>
71
+ <div className="sm-top:gap-[12px] flex flex-col gap-[8px] lg:gap-[24px]">
72
+ {(myCaseQuestion === null || myCaseQuestion === void 0 ? void 0 : myCaseQuestion.length) > 0 ? (myCaseQuestion === null || myCaseQuestion === void 0 ? void 0 : myCaseQuestion.map((item, index) => (<AnswerBox key={index} item={item} isOpen={openId === item.idx.toString()} openId={openId} setOpenId={setOpenId}/>))) : (<EmptyTable tap="caseInquiry" subTap={0} isMinHeight={false}/>)}
73
+ </div>
74
+ <div className={` flex items-center justify-end ${(myCaseQuestion === null || myCaseQuestion === void 0 ? void 0 : myCaseQuestion.length) > 0
75
+ ? 'sm-top:mt-[80px] mt-[40px] lg:mt-[60px] '
76
+ : 'sm-top:mt-[95px] mt-[69px] lg:mt-[112px]'}`}>
77
+ <button onClick={() => setIsOpen(prev => !prev)} className=" bg-mycaseMainColor sm-top:h-[60px] sm-top:w-[188px] sm-top:gap-[23px] sm-top:rounded-[36px] flex h-[48px] w-[132px] items-center justify-center gap-[14px] rounded-[24px] text-white lg:h-[72px] lg:w-[220px] lg:gap-[21px]">
78
+ <Image src={inkPen} alt="ink_pen" width={28.5} height={28.5} className="sm-top:h-[23.75px] sm-top:w-[23.75px] h-[19px] w-[19px] lg:h-[28.5px] lg:w-[28.5px]"/>
79
+ <p className="body_large2_mo sm-top:body_large2_tb lg:body_large2" style={{ color: 'white' }}>
80
+ 문의하기
81
+ </p>
82
+ </button>
83
+ </div>
84
+ <CaseInquiryAddModal isOpen={isOpen} onClose={() => setIsOpen(false)} id={id} refetch={refetch}/>
85
+ <Suspense>
86
+ <PaginationComponent pageSize={pageSize} total={totalLength} onChange={onChange} current={pageNumber}/>
87
+ </Suspense>
88
+ </>)}
86
89
  </CaseLayout>);
87
90
  };
88
91
  export default CaseInquiry;
@@ -10,6 +10,7 @@ import inkPen from '../../../../../../asset/images/myCase/icon/ink_pen.webp';
10
10
  import client from '../../../../../../asset/images/myCase/icon/client.webp';
11
11
  import daeryun from '../../../../../../asset/images/myCase/icon/daeryun.webp';
12
12
  import arrowB from '../../../../../../asset/images/myCase/arrow_b.webp';
13
+ import Loading from '../../../_component/_loading/Loading';
13
14
  const AnswerBox = ({
14
15
  item,
15
16
  isOpen,
@@ -120,6 +121,7 @@ const AnswerBox = ({
120
121
 
121
122
  const CaseInquiry = ({
122
123
  myCaseQuestion,
124
+ isLoading,
123
125
  id,
124
126
  refetch,
125
127
  pageSize,
@@ -128,6 +130,7 @@ const CaseInquiry = ({
128
130
  onChange
129
131
  }: {
130
132
  myCaseQuestion: Question[];
133
+ isLoading: boolean;
131
134
  id: string;
132
135
  refetch: () => void;
133
136
  pageSize: number;
@@ -146,48 +149,62 @@ const CaseInquiry = ({
146
149
  'pt-[32px] px-[20px] pb-[80px] 2sm:px-[40px] sm-top:pt-[56px] sm-top:px-[50px] sm-top:pb-[60px] lg:pt-[70px] lg:pb-[80px] lg:px-[60px]'
147
150
  }
148
151
  >
149
- <div className="sm-top:gap-[12px] flex flex-col gap-[8px] lg:gap-[24px]">
150
- {myCaseQuestion?.length > 0 ? (
151
- myCaseQuestion?.map((item, index) => (
152
- <AnswerBox
153
- key={index}
154
- item={item}
155
- isOpen={openId === item.idx.toString()}
156
- openId={openId}
157
- setOpenId={setOpenId}
152
+ {isLoading ? (
153
+ <Loading />
154
+ ) : (
155
+ <>
156
+ <div className="sm-top:gap-[12px] flex flex-col gap-[8px] lg:gap-[24px]">
157
+ {myCaseQuestion?.length > 0 ? (
158
+ myCaseQuestion?.map((item, index) => (
159
+ <AnswerBox
160
+ key={index}
161
+ item={item}
162
+ isOpen={openId === item.idx.toString()}
163
+ openId={openId}
164
+ setOpenId={setOpenId}
165
+ />
166
+ ))
167
+ ) : (
168
+ <EmptyTable tap="caseInquiry" subTap={0} isMinHeight={false} />
169
+ )}
170
+ </div>
171
+ <div
172
+ className={` flex items-center justify-end ${
173
+ myCaseQuestion?.length > 0
174
+ ? 'sm-top:mt-[80px] mt-[40px] lg:mt-[60px] '
175
+ : 'sm-top:mt-[95px] mt-[69px] lg:mt-[112px]'
176
+ }`}
177
+ >
178
+ <button
179
+ onClick={() => setIsOpen(prev => !prev)}
180
+ className=" bg-mycaseMainColor sm-top:h-[60px] sm-top:w-[188px] sm-top:gap-[23px] sm-top:rounded-[36px] flex h-[48px] w-[132px] items-center justify-center gap-[14px] rounded-[24px] text-white lg:h-[72px] lg:w-[220px] lg:gap-[21px]"
181
+ >
182
+ <Image
183
+ src={inkPen}
184
+ alt="ink_pen"
185
+ width={28.5}
186
+ height={28.5}
187
+ className="sm-top:h-[23.75px] sm-top:w-[23.75px] h-[19px] w-[19px] lg:h-[28.5px] lg:w-[28.5px]"
188
+ />
189
+ <p
190
+ className="body_large2_mo sm-top:body_large2_tb lg:body_large2"
191
+ style={{ color: 'white' }}
192
+ >
193
+ 문의하기
194
+ </p>
195
+ </button>
196
+ </div>
197
+ <CaseInquiryAddModal isOpen={isOpen} onClose={() => setIsOpen(false)} id={id} refetch={refetch} />
198
+ <Suspense>
199
+ <PaginationComponent
200
+ pageSize={pageSize}
201
+ total={totalLength}
202
+ onChange={onChange}
203
+ current={pageNumber}
158
204
  />
159
- ))
160
- ) : (
161
- <EmptyTable tap="caseInquiry" subTap={0} isMinHeight={false} />
162
- )}
163
- </div>
164
- <div
165
- className={` flex items-center justify-end ${
166
- myCaseQuestion?.length > 0
167
- ? 'sm-top:mt-[80px] mt-[40px] lg:mt-[60px] '
168
- : 'sm-top:mt-[95px] mt-[69px] lg:mt-[112px]'
169
- }`}
170
- >
171
- <button
172
- onClick={() => setIsOpen(prev => !prev)}
173
- className=" bg-mycaseMainColor sm-top:h-[60px] sm-top:w-[188px] sm-top:gap-[23px] sm-top:rounded-[36px] flex h-[48px] w-[132px] items-center justify-center gap-[14px] rounded-[24px] text-white lg:h-[72px] lg:w-[220px] lg:gap-[21px]"
174
- >
175
- <Image
176
- src={inkPen}
177
- alt="ink_pen"
178
- width={28.5}
179
- height={28.5}
180
- className="sm-top:h-[23.75px] sm-top:w-[23.75px] h-[19px] w-[19px] lg:h-[28.5px] lg:w-[28.5px]"
181
- />
182
- <p className="body_large2_mo sm-top:body_large2_tb lg:body_large2" style={{ color: 'white' }}>
183
- 문의하기
184
- </p>
185
- </button>
186
- </div>
187
- <CaseInquiryAddModal isOpen={isOpen} onClose={() => setIsOpen(false)} id={id} refetch={refetch} />
188
- <Suspense>
189
- <PaginationComponent pageSize={pageSize} total={totalLength} onChange={onChange} current={pageNumber} />
190
- </Suspense>
205
+ </Suspense>
206
+ </>
207
+ )}
191
208
  </CaseLayout>
192
209
  );
193
210
  };
@@ -21,15 +21,13 @@ const CaseContainer = ({ jwt }) => {
21
21
  const tapState = tap ? tap : 'ongoing';
22
22
  // const subTapState = subTap ? (subTap as string) : tap ? (tap as string) : 'ongoing';
23
23
  const [pageSize, setPageSize] = useState(4);
24
- const [caseList, setCaseList] = useState([]);
25
- const [totalLength, setTotalLength] = useState(0);
26
24
  // const [isLoading, setIsLoading] = useState(true);
27
25
  const pageNumber = page ? Number(page) : 1;
28
26
  const handleOnChange = (pageNum) => {
29
- router.push(`/mycase?page=${pageNum}&tap=${tap}&subTap=${subTap}`);
27
+ router.push(`/mycase?page=1&tap=${tap}&subTap=${subTap}`);
30
28
  };
31
29
  const handleOnTap = (tap) => {
32
- router.push(`/mycase?page=${page}&tap=${tapState}&subTap=${tapState === 'ongoing' ? 'ongoing' : 'closed'}`);
30
+ router.push(`/mycase?page=${page}&tap=${tap}&subTap=${tap === 'ongoing' ? 'ongoing' : 'closed'}`);
33
31
  };
34
32
  // const handleOnSubTap = (subTap: string) => {
35
33
  // router.push(`/mycase?page=1&tap=${tapState}&subTap=${subTap}`);
@@ -53,8 +51,8 @@ const CaseContainer = ({ jwt }) => {
53
51
  <CaseLayout outerClassName="mt-[230px] sm-top:mt-[310px] lg:mt-[294px] " innerClassName={'py-[40px] sm-top:py-[52px] lg:py-[60px]'} isMobilePadding={false}>
54
52
  <div className={''}>
55
53
  <div className="sm-top:px-[50px] flex flex-row items-center px-[20px] 2sm:px-[40px] lg:px-[60px]">
56
- <CaseTap title="진행중인 사건" type="ongoing" tap={tapState} setTap={handleOnTap}/>
57
- <CaseTap title="종결된 사건" type="closed" tap={tapState} setTap={handleOnTap}/>
54
+ <CaseTap title="진행중인 사건" type="ongoing" tap={tapState} setTap={() => handleOnTap('ongoing')}/>
55
+ <CaseTap title="종결된 사건" type="closed" tap={tapState} setTap={() => handleOnTap('closed')}/>
58
56
  </div>
59
57
  {/* <div className={'py-[22px] sm-top:px-[50px] sm-top:py-[16px] lg:my-[20px] lg:px-[60px]'}>
60
58
  {tapState === 'ongoing' ? (
@@ -47,16 +47,14 @@ const CaseContainer = ({ jwt }: { jwt?: string }) => {
47
47
  // const subTapState = subTap ? (subTap as string) : tap ? (tap as string) : 'ongoing';
48
48
  const [pageSize, setPageSize] = useState(4);
49
49
 
50
- const [caseList, setCaseList] = useState<Case[]>([]);
51
- const [totalLength, setTotalLength] = useState(0);
52
50
  // const [isLoading, setIsLoading] = useState(true);
53
51
  const pageNumber = page ? Number(page) : 1;
54
52
 
55
53
  const handleOnChange = (pageNum: number) => {
56
- router.push(`/mycase?page=${pageNum}&tap=${tap}&subTap=${subTap}`);
54
+ router.push(`/mycase?page=1&tap=${tap}&subTap=${subTap}`);
57
55
  };
58
56
  const handleOnTap = (tap: string) => {
59
- router.push(`/mycase?page=${page}&tap=${tapState}&subTap=${tapState === 'ongoing' ? 'ongoing' : 'closed'}`);
57
+ router.push(`/mycase?page=${page}&tap=${tap}&subTap=${tap === 'ongoing' ? 'ongoing' : 'closed'}`);
60
58
  };
61
59
  // const handleOnSubTap = (subTap: string) => {
62
60
  // router.push(`/mycase?page=1&tap=${tapState}&subTap=${subTap}`);
@@ -88,8 +86,18 @@ const CaseContainer = ({ jwt }: { jwt?: string }) => {
88
86
  >
89
87
  <div className={''}>
90
88
  <div className="sm-top:px-[50px] flex flex-row items-center px-[20px] 2sm:px-[40px] lg:px-[60px]">
91
- <CaseTap title="진행중인 사건" type="ongoing" tap={tapState} setTap={handleOnTap} />
92
- <CaseTap title="종결된 사건" type="closed" tap={tapState} setTap={handleOnTap} />
89
+ <CaseTap
90
+ title="진행중인 사건"
91
+ type="ongoing"
92
+ tap={tapState}
93
+ setTap={() => handleOnTap('ongoing')}
94
+ />
95
+ <CaseTap
96
+ title="종결된 사건"
97
+ type="closed"
98
+ tap={tapState}
99
+ setTap={() => handleOnTap('closed')}
100
+ />
93
101
  </div>
94
102
  {/* <div className={'py-[22px] sm-top:px-[50px] sm-top:py-[16px] lg:my-[20px] lg:px-[60px]'}>
95
103
  {tapState === 'ongoing' ? (
@@ -65,7 +65,16 @@ const titleList = {
65
65
  const EmptyTable = ({ tap, subTap, isMinHeight = true }) => {
66
66
  console.log('tap:', tap);
67
67
  console.log('subTap:', subTap);
68
- const { title, subTitle, img, width, height, marginTop } = titleList[tap][subTap];
68
+ const selectedTitleList = titleList[tap];
69
+ const selectedSubTap = selectedTitleList ? selectedTitleList[subTap] : null;
70
+ const { title, subTitle, img, width, height, marginTop } = selectedSubTap || {
71
+ title: '',
72
+ subTitle: '',
73
+ img: '',
74
+ width: '',
75
+ height: '',
76
+ marginTop: ''
77
+ };
69
78
  return (<div className={`sm-top:gap-[20px] flex gap-[14px] ${isMinHeight ? 'min-h-[350px]' : ''} w-full flex-col items-center lg:gap-[40px] ${marginTop}`}>
70
79
  <Image src={img} alt="case_icon" width={60} height={60} className={`${width} ${height}`}/>
71
80
  <div className="flex flex-col items-center justify-center ">
@@ -68,8 +68,16 @@ const titleList = {
68
68
  const EmptyTable = ({ tap, subTap, isMinHeight = true }: { tap: string; subTap: number; isMinHeight?: boolean }) => {
69
69
  console.log('tap:', tap);
70
70
  console.log('subTap:', subTap);
71
- const { title, subTitle, img, width, height, marginTop } =
72
- titleList[tap as keyof typeof titleList][subTap as keyof (typeof titleList)[keyof typeof titleList]];
71
+ const selectedTitleList = titleList[tap as keyof typeof titleList];
72
+ const selectedSubTap = selectedTitleList ? selectedTitleList[subTap as keyof typeof selectedTitleList] : null;
73
+ const { title, subTitle, img, width, height, marginTop } = selectedSubTap || {
74
+ title: '',
75
+ subTitle: '',
76
+ img: '',
77
+ width: '',
78
+ height: '',
79
+ marginTop: ''
80
+ };
73
81
  return (
74
82
  <div
75
83
  className={`sm-top:gap-[20px] flex gap-[14px] ${