@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
|
@@ -28,14 +28,16 @@ const CategoryView = (props) => {
|
|
|
28
28
|
const fetchCenterList = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
29
|
try {
|
|
30
30
|
const response = yield axios.get('/api/center/list?type=category');
|
|
31
|
-
// const centerArr = response.data.list;
|
|
32
31
|
//회계감리, 메인 페이지, 상담전담 삭제
|
|
33
|
-
const
|
|
34
|
-
const
|
|
32
|
+
const filtered = response.data.list.filter((i) => i.code !== 'CT0000' && i.code !== 'CT0023' && i.code !== 'CT0028');
|
|
33
|
+
const primary = filtered.find((i) => i.code_desc === props.currentCenterTitle);
|
|
34
|
+
const others = filtered.filter((i) => i.code_desc !== props.currentCenterTitle);
|
|
35
|
+
const finalList = primary ? [primary, ...others] : filtered;
|
|
36
|
+
setCenterList(finalList);
|
|
37
|
+
const selectedCenter = finalList.find((i) => i.code_desc === props.currentCenterTitle);
|
|
35
38
|
if (selectedCenter) {
|
|
36
39
|
setSelectedCenter(selectedCenter);
|
|
37
40
|
}
|
|
38
|
-
setCenterList(centerArr);
|
|
39
41
|
}
|
|
40
42
|
catch (error) {
|
|
41
43
|
console.error('Error fetching center list', error);
|
|
@@ -79,7 +81,7 @@ const CategoryView = (props) => {
|
|
|
79
81
|
setCurrentPage(1);
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
|
-
}, [
|
|
84
|
+
}, [selectedCenter, categoryList]);
|
|
83
85
|
useEffect(() => {
|
|
84
86
|
setShowCategory(filterCategory.slice((currentPage - 1) * itemsPerPage, currentPage * itemsPerPage));
|
|
85
87
|
setMaxPageNum(Math.ceil(filterCategory.length / itemsPerPage));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import '../../styles/globals.css';
|
|
3
|
+
declare const CategoryView: {
|
|
4
|
+
component: (props: {
|
|
5
|
+
initCenterList?: import("./ICategoryViewTypes").ICenter[];
|
|
6
|
+
initShowCategoryList?: import("./ICategoryViewTypes").ICategory[];
|
|
7
|
+
themeColor: string;
|
|
8
|
+
currentCenterTitle: string;
|
|
9
|
+
hiddenTitle?: boolean;
|
|
10
|
+
allMainCenterTargetBlank?: boolean;
|
|
11
|
+
}) => import("react").JSX.Element;
|
|
12
|
+
title: string;
|
|
13
|
+
};
|
|
14
|
+
export default CategoryView;
|
|
15
|
+
type Story = StoryObj<typeof CategoryView>;
|
|
16
|
+
export declare const Default: Story;
|