@daeryun/dr_components 0.6.84 → 0.6.86
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.
- package/dist/components/categoryView/CategoryView.jsx +7 -5
- package/dist/components/categoryView/CategoryView.stories.d.ts +16 -0
- package/dist/components/categoryView/CategoryView.stories.jsx +4772 -0
- package/dist/components/categoryView/CategoryView.stories.tsx +4779 -0
- package/dist/components/categoryView/CategoryView.tsx +10 -5
- package/dist/components/categoryView/CenterComponent.jsx +1 -4
- package/dist/components/categoryView/CenterComponent.tsx +1 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -34,16 +34,21 @@ const CategoryView = (props: {
|
|
|
34
34
|
const fetchCenterList = async () => {
|
|
35
35
|
try {
|
|
36
36
|
const response = await axios.get('/api/center/list?type=category');
|
|
37
|
-
// const centerArr = response.data.list;
|
|
38
37
|
//회계감리, 메인 페이지, 상담전담 삭제
|
|
39
|
-
const
|
|
38
|
+
const filtered = response.data.list.filter(
|
|
40
39
|
(i: ICenter) => i.code !== 'CT0000' && i.code !== 'CT0023' && i.code !== 'CT0028'
|
|
41
40
|
);
|
|
42
|
-
const
|
|
41
|
+
const primary = filtered.find((i: ICenter) => i.code_desc === props.currentCenterTitle);
|
|
42
|
+
const others = filtered.filter((i: ICenter) => i.code_desc !== props.currentCenterTitle);
|
|
43
|
+
|
|
44
|
+
const finalList = primary ? [primary, ...others] : filtered;
|
|
45
|
+
|
|
46
|
+
setCenterList(finalList);
|
|
47
|
+
|
|
48
|
+
const selectedCenter = finalList.find((i: ICenter) => i.code_desc === props.currentCenterTitle);
|
|
43
49
|
if (selectedCenter) {
|
|
44
50
|
setSelectedCenter(selectedCenter);
|
|
45
51
|
}
|
|
46
|
-
setCenterList(centerArr);
|
|
47
52
|
} catch (error) {
|
|
48
53
|
console.error('Error fetching center list', error);
|
|
49
54
|
}
|
|
@@ -89,7 +94,7 @@ const CategoryView = (props: {
|
|
|
89
94
|
setCurrentPage(1);
|
|
90
95
|
}
|
|
91
96
|
}
|
|
92
|
-
}, [
|
|
97
|
+
}, [selectedCenter, categoryList]);
|
|
93
98
|
|
|
94
99
|
useEffect(() => {
|
|
95
100
|
setShowCategory(filterCategory.slice((currentPage - 1) * itemsPerPage, currentPage * itemsPerPage));
|
|
@@ -107,10 +107,7 @@ const CenterComponent = (props) => {
|
|
|
107
107
|
'max-2sm:pl-[10px]'} style={{
|
|
108
108
|
direction: 'rtl'
|
|
109
109
|
}} id={'center_scroll_custom'}>
|
|
110
|
-
{
|
|
111
|
-
{props.centerList
|
|
112
|
-
.filter(item => item.code_desc !== currentCenterTitle)
|
|
113
|
-
.map(item => (<CenterCon key={item.code} item={item}/>))}
|
|
110
|
+
{props.centerList.map(item => (<CenterCon key={item.code} item={item}/>))}
|
|
114
111
|
</span>
|
|
115
112
|
</div>
|
|
116
113
|
</>);
|
|
@@ -178,14 +178,9 @@ const CenterComponent = (props: {
|
|
|
178
178
|
}}
|
|
179
179
|
id={'center_scroll_custom'}
|
|
180
180
|
>
|
|
181
|
-
{
|
|
181
|
+
{props.centerList.map(item => (
|
|
182
182
|
<CenterCon key={item.code} item={item} />
|
|
183
183
|
))}
|
|
184
|
-
{props.centerList
|
|
185
|
-
.filter(item => item.code_desc !== currentCenterTitle)
|
|
186
|
-
.map(item => (
|
|
187
|
-
<CenterCon key={item.code} item={item} />
|
|
188
|
-
))}
|
|
189
184
|
</span>
|
|
190
185
|
</div>
|
|
191
186
|
</>
|