@daeryun/dr_components 0.6.83 → 0.6.85

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.
@@ -33,7 +33,6 @@ const CategoryView = (props) => {
33
33
  const centerArr = response.data.list.filter((i) => i.code !== 'CT0000' && i.code !== 'CT0023' && i.code !== 'CT0028');
34
34
  const selectedCenter = centerArr.find((i) => i.code_desc === props.currentCenterTitle);
35
35
  if (selectedCenter) {
36
- selectedCenter.isSelect = true;
37
36
  setSelectedCenter(selectedCenter);
38
37
  }
39
38
  setCenterList(centerArr);
@@ -71,7 +70,7 @@ const CategoryView = (props) => {
71
70
  }, []);
72
71
  useEffect(() => {
73
72
  if (centerList.length > 0 && categoryList.length > 0) {
74
- const selected = centerList.find(i => i.isSelect);
73
+ const selected = centerList.find(i => i === selectedCenter);
75
74
  if (selected) {
76
75
  setSelectedCenter(selected);
77
76
  const selectedCategory = categoryList.filter(i => i.center_code === selected.code);
@@ -80,7 +79,7 @@ const CategoryView = (props) => {
80
79
  setCurrentPage(1);
81
80
  }
82
81
  }
83
- }, [centerList, categoryList]);
82
+ }, [selectedCenter, categoryList]);
84
83
  useEffect(() => {
85
84
  setShowCategory(filterCategory.slice((currentPage - 1) * itemsPerPage, currentPage * itemsPerPage));
86
85
  setMaxPageNum(Math.ceil(filterCategory.length / itemsPerPage));
@@ -91,9 +90,7 @@ const CategoryView = (props) => {
91
90
  //900px
92
91
  'max-md2:gap-[10px] max-md2:px-[10px] max-md2:py-[20px] max-md2:shadow-none '}>
93
92
  {/*센터*/}
94
- <CenterComponent themeColor={props.themeColor} centerList={centerList} onClick={(list) => {
95
- setCenterList(list);
96
- }} hiddenTitle={props.hiddenTitle} currentCenterTitle={props.currentCenterTitle}/>
93
+ <CenterComponent themeColor={props.themeColor} selectedCenter={selectedCenter} centerList={centerList} onClick={setSelectedCenter} hiddenTitle={props.hiddenTitle} currentCenterTitle={props.currentCenterTitle}/>
97
94
 
98
95
  {/*분야*/}
99
96
  <CategoryComponent showCategory={showCategory} onClickPage={(num) => {
@@ -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;