@daeryun/dr_components 1.1.39 → 1.1.40

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,4 +1,5 @@
1
1
  import NoticeList from './NoticeList';
2
+ // Mock router for Storybook
2
3
  const mockRouter = {
3
4
  push: (url) => {
4
5
  console.log('Router push:', url);
@@ -6,122 +7,58 @@ const mockRouter = {
6
7
  },
7
8
  pathname: '/notice',
8
9
  query: {},
9
- asPath: '/notice'
10
+ asPath: '/notice',
11
+ route: '/notice',
12
+ basePath: '',
13
+ events: {
14
+ on: () => { },
15
+ off: () => { },
16
+ emit: () => { }
17
+ },
18
+ isFallback: false,
19
+ isLocaleDomain: false,
20
+ isReady: true,
21
+ defaultLocale: 'ko',
22
+ domainLocales: [],
23
+ isPreview: false
10
24
  };
25
+ // Mock useRouter hook
26
+ const mockUseRouter = () => mockRouter;
27
+ // Mock the useRouter hook globally before any imports
28
+ const originalUseRouter = require('next/router').useRouter;
29
+ require('next/router').useRouter = mockUseRouter;
11
30
  const meta = {
12
31
  title: 'NoticeList',
13
32
  component: NoticeList,
14
33
  argTypes: {
15
- SearchBarProps: {
16
- description: '검색바 관련 props'
17
- },
18
- PaginationProps: {
19
- description: '페이지네이션 관련 props'
20
- },
21
- noticeName: {
22
- description: '공지사항 카테고리 목록'
23
- },
24
34
  noticeList: {
25
- description: '공지사항 목록 데이터'
26
- },
27
- nameFilter: {
28
- description: '현재 선택된 필터'
29
- },
30
- search: {
31
- description: '현재 검색어'
35
+ description: '공지사항 목록 데이터',
36
+ control: { type: 'object' }
32
37
  },
33
- indexOfFirstPost: {
34
- description: '현재 페이지의 첫 번째 게시물 인덱스'
35
- },
36
- indexOfLastPost: {
37
- description: '현재 페이지의 마지막 게시물 인덱스'
38
- },
39
- postPerPage: {
40
- description: '페이지당 게시물 수'
41
- },
42
- currentPage: {
43
- description: '현재 페이지 번호'
38
+ noticeName: {
39
+ description: '공지사항 카테고리 목록',
40
+ control: { type: 'object' }
44
41
  }
45
42
  }
46
43
  };
47
44
  export default meta;
48
45
  // Mock 데이터
49
- const mockNoticeName = [
46
+ const mockNoticeCategories = [
50
47
  {
51
48
  code: 'N0001',
52
- code_name: '사무소안내',
53
- code_desc: null,
54
- created_at: '2024-03-04T16:42:25.730Z',
55
- creator: 'jeonghansol',
56
- en_name: null,
57
- etc: null,
58
- etc2: null,
59
- g_sorting: null,
60
- gubun: null,
61
- i_sorting: null,
62
- kr_name: null,
63
- modified_at: null,
64
- modifier: null,
65
- parent_code: 'notice',
66
- sorting: 1,
67
- use_bool: true
49
+ code_name: '사무소안내'
68
50
  },
69
51
  {
70
52
  code: 'N0002',
71
- code_name: '인사/동정',
72
- code_desc: null,
73
- created_at: '2024-03-04T16:42:25.730Z',
74
- creator: 'jeonghansol',
75
- en_name: null,
76
- etc: null,
77
- etc2: null,
78
- g_sorting: null,
79
- gubun: null,
80
- i_sorting: null,
81
- kr_name: null,
82
- modified_at: null,
83
- modifier: null,
84
- parent_code: 'notice',
85
- sorting: 2,
86
- use_bool: true
53
+ code_name: '인사/동정'
87
54
  },
88
55
  {
89
56
  code: 'N0003',
90
- code_name: '업무협약',
91
- code_desc: null,
92
- created_at: '2024-03-04T16:42:25.730Z',
93
- creator: 'jeonghansol',
94
- en_name: null,
95
- etc: null,
96
- etc2: null,
97
- g_sorting: null,
98
- gubun: null,
99
- i_sorting: null,
100
- kr_name: null,
101
- modified_at: null,
102
- modifier: null,
103
- parent_code: 'notice',
104
- sorting: 3,
105
- use_bool: true
57
+ code_name: '업무협약'
106
58
  },
107
59
  {
108
60
  code: 'N0004',
109
- code_name: '기타소식',
110
- code_desc: null,
111
- created_at: '2024-03-04T16:42:25.730Z',
112
- creator: 'jeonghansol',
113
- en_name: null,
114
- etc: null,
115
- etc2: null,
116
- g_sorting: null,
117
- gubun: null,
118
- i_sorting: null,
119
- kr_name: null,
120
- modified_at: null,
121
- modifier: null,
122
- parent_code: 'notice',
123
- sorting: 4,
124
- use_bool: true
61
+ code_name: '기타소식'
125
62
  }
126
63
  ];
127
64
  const mockNoticeList = [
@@ -159,101 +96,54 @@ const mockNoticeList = [
159
96
  summary: '경찰 경력 이동근 책임총괄변호사 영입…울산지방경찰청 경위울산남부경찰서 경위경찰교육원하나은행한국어린이집총연합회 사내변호사',
160
97
  code_name: '인사/동정',
161
98
  top_count: 0
99
+ },
100
+ {
101
+ id: 5686,
102
+ title: '법무법인 대륜 김영수변호사 대한변호사협회 형사전문변호사 등록',
103
+ summary: '대한변호사협회 등록 형사전문변호사는 재…션을 제공하고, 원하시는 결과를 받을 수 있도록 최선을 다할 것을 약속드리겠습니다.',
104
+ code_name: '인사/동정',
105
+ top_count: 0
106
+ },
107
+ {
108
+ id: 5685,
109
+ title: '법무법인 대륜 박민수변호사 대한변호사협회 형사전문변호사 등록',
110
+ summary: '대한변호사협회 등록 형사전문변호사는 재…션을 제공하고, 원하시는 결과를 받을 수 있도록 최선을 다할 것을 약속드리겠습니다.',
111
+ code_name: '인사/동정',
112
+ top_count: 0
113
+ },
114
+ {
115
+ id: 5684,
116
+ title: '법무법인 대륜 이정호변호사 대한변호사협회 형사전문변호사 등록',
117
+ summary: '대한변호사협회 등록 형사전문변호사는 재…션을 제공하고, 원하시는 결과를 받을 수 있도록 최선을 다할 것을 약속드리겠습니다.',
118
+ code_name: '인사/동정',
119
+ top_count: 0
120
+ },
121
+ {
122
+ id: 5683,
123
+ title: '법무법인 대륜 최성호변호사 대한변호사협회 형사전문변호사 등록',
124
+ summary: '대한변호사협회 등록 형사전문변호사는 재…션을 제공하고, 원하시는 결과를 받을 수 있도록 최선을 다할 것을 약속드리겠습니다.',
125
+ code_name: '인사/동정',
126
+ top_count: 0
127
+ },
128
+ {
129
+ id: 5682,
130
+ title: '법무법인 대륜 정민수변호사 대한변호사협회 형사전문변호사 등록',
131
+ summary: '대한변호사협회 등록 형사전문변호사는 재…션을 제공하고, 원하시는 결과를 받을 수 있도록 최선을 다할 것을 약속드리겠습니다.',
132
+ code_name: '인사/동정',
133
+ top_count: 0
162
134
  }
163
135
  ];
164
136
  // 기본 스토리
165
137
  export const Default = {
166
138
  args: {
167
- SearchBarProps: {
168
- searchInput: '',
169
- handleSearch: () => console.log('검색 실행'),
170
- handleInputChange: e => console.log('입력 변경:', e.currentTarget.value)
171
- },
172
- PaginationProps: {
173
- onPaginationChange: pageNum => console.log('페이지 변경:', pageNum),
174
- totalCount: mockNoticeList.length,
175
- currentPage: 1
176
- },
177
- noticeName: mockNoticeName,
178
139
  noticeList: mockNoticeList,
179
- nameFilter: { code_name: '전체', code: '' },
180
- search: '',
181
- indexOfFirstPost: 1,
182
- indexOfLastPost: 10,
183
- postPerPage: 10,
184
- currentPage: 1,
185
- router: mockRouter
186
- }
187
- };
188
- // 검색어가 있는 상태
189
- export const WithSearch = {
190
- args: {
191
- SearchBarProps: {
192
- searchInput: '법무법인',
193
- handleSearch: () => console.log('검색 실행'),
194
- handleInputChange: e => console.log('입력 변경:', e.currentTarget.value)
195
- },
196
- PaginationProps: {
197
- onPaginationChange: pageNum => console.log('페이지 변경:', pageNum),
198
- totalCount: mockNoticeList.length,
199
- currentPage: 1
200
- },
201
- noticeName: mockNoticeName,
202
- noticeList: mockNoticeList,
203
- nameFilter: { code_name: '전체', code: '' },
204
- search: '법무법인',
205
- indexOfFirstPost: 1,
206
- indexOfLastPost: 10,
207
- postPerPage: 10,
208
- currentPage: 1,
209
- router: mockRouter
210
- }
211
- };
212
- // 필터가 선택된 상태
213
- export const WithFilter = {
214
- args: {
215
- SearchBarProps: {
216
- searchInput: '',
217
- handleSearch: () => console.log('검색 실행'),
218
- handleInputChange: e => console.log('입력 변경:', e.currentTarget.value)
219
- },
220
- PaginationProps: {
221
- onPaginationChange: pageNum => console.log('페이지 변경:', pageNum),
222
- totalCount: mockNoticeList.length,
223
- currentPage: 1
224
- },
225
- noticeName: mockNoticeName,
226
- noticeList: mockNoticeList,
227
- nameFilter: { code_name: '사무소안내', code: 'N0001' },
228
- search: '',
229
- indexOfFirstPost: 1,
230
- indexOfLastPost: 10,
231
- postPerPage: 10,
232
- currentPage: 1,
233
- router: mockRouter
140
+ noticeName: mockNoticeCategories
234
141
  }
235
142
  };
236
143
  // 빈 목록 상태
237
144
  export const EmptyList = {
238
145
  args: {
239
- SearchBarProps: {
240
- searchInput: '',
241
- handleSearch: () => console.log('검색 실행'),
242
- handleInputChange: e => console.log('입력 변경:', e.currentTarget.value)
243
- },
244
- PaginationProps: {
245
- onPaginationChange: pageNum => console.log('페이지 변경:', pageNum),
246
- totalCount: 0,
247
- currentPage: 1
248
- },
249
- noticeName: mockNoticeName,
250
146
  noticeList: [],
251
- nameFilter: { code_name: '전체', code: '' },
252
- search: '',
253
- indexOfFirstPost: 1,
254
- indexOfLastPost: 10,
255
- postPerPage: 10,
256
- currentPage: 1,
257
- router: mockRouter
147
+ noticeName: mockNoticeCategories
258
148
  }
259
149
  };
@@ -1,50 +1,49 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
2
  import NoticeList from './NoticeList';
3
- import { NextRouter } from 'next/router';
3
+ import React from 'react';
4
4
 
5
- const mockRouter: Partial<NextRouter> = {
6
- push: (url: string) => {
5
+ // Mock router for Storybook
6
+ const mockRouter = {
7
+ push: (url: string | { pathname: string; query: any }) => {
7
8
  console.log('Router push:', url);
8
9
  return Promise.resolve(true);
9
10
  },
10
11
  pathname: '/notice',
11
12
  query: {},
12
- asPath: '/notice'
13
+ asPath: '/notice',
14
+ route: '/notice',
15
+ basePath: '',
16
+ events: {
17
+ on: () => {},
18
+ off: () => {},
19
+ emit: () => {}
20
+ },
21
+ isFallback: false,
22
+ isLocaleDomain: false,
23
+ isReady: true,
24
+ defaultLocale: 'ko',
25
+ domainLocales: [],
26
+ isPreview: false
13
27
  };
14
28
 
29
+ // Mock useRouter hook
30
+ const mockUseRouter = () => mockRouter;
31
+
32
+ // Mock the useRouter hook globally before any imports
33
+ const originalUseRouter = require('next/router').useRouter;
34
+ require('next/router').useRouter = mockUseRouter;
35
+
15
36
  const meta: Meta<typeof NoticeList> = {
16
37
  title: 'NoticeList',
17
38
  component: NoticeList,
18
39
  argTypes: {
19
- SearchBarProps: {
20
- description: '검색바 관련 props'
21
- },
22
- PaginationProps: {
23
- description: '페이지네이션 관련 props'
24
- },
25
- noticeName: {
26
- description: '공지사항 카테고리 목록'
27
- },
28
40
  noticeList: {
29
- description: '공지사항 목록 데이터'
30
- },
31
- nameFilter: {
32
- description: '현재 선택된 필터'
41
+ description: '공지사항 목록 데이터',
42
+ control: { type: 'object' }
33
43
  },
34
- search: {
35
- description: '현재 검색어'
36
- },
37
- indexOfFirstPost: {
38
- description: '현재 페이지의 첫 번째 게시물 인덱스'
39
- },
40
- indexOfLastPost: {
41
- description: '현재 페이지의 마지막 게시물 인덱스'
42
- },
43
- postPerPage: {
44
- description: '페이지당 게시물 수'
45
- },
46
- currentPage: {
47
- description: '현재 페이지 번호'
44
+ noticeName: {
45
+ description: '공지사항 카테고리 목록',
46
+ control: { type: 'object' }
48
47
  }
49
48
  }
50
49
  };
@@ -54,82 +53,22 @@ export default meta;
54
53
  type Story = StoryObj<typeof meta>;
55
54
 
56
55
  // Mock 데이터
57
- const mockNoticeName = [
56
+ const mockNoticeCategories = [
58
57
  {
59
58
  code: 'N0001',
60
- code_name: '사무소안내',
61
- code_desc: null,
62
- created_at: '2024-03-04T16:42:25.730Z',
63
- creator: 'jeonghansol',
64
- en_name: null,
65
- etc: null,
66
- etc2: null,
67
- g_sorting: null,
68
- gubun: null,
69
- i_sorting: null,
70
- kr_name: null,
71
- modified_at: null,
72
- modifier: null,
73
- parent_code: 'notice',
74
- sorting: 1,
75
- use_bool: true
59
+ code_name: '사무소안내'
76
60
  },
77
61
  {
78
62
  code: 'N0002',
79
- code_name: '인사/동정',
80
- code_desc: null,
81
- created_at: '2024-03-04T16:42:25.730Z',
82
- creator: 'jeonghansol',
83
- en_name: null,
84
- etc: null,
85
- etc2: null,
86
- g_sorting: null,
87
- gubun: null,
88
- i_sorting: null,
89
- kr_name: null,
90
- modified_at: null,
91
- modifier: null,
92
- parent_code: 'notice',
93
- sorting: 2,
94
- use_bool: true
63
+ code_name: '인사/동정'
95
64
  },
96
65
  {
97
66
  code: 'N0003',
98
- code_name: '업무협약',
99
- code_desc: null,
100
- created_at: '2024-03-04T16:42:25.730Z',
101
- creator: 'jeonghansol',
102
- en_name: null,
103
- etc: null,
104
- etc2: null,
105
- g_sorting: null,
106
- gubun: null,
107
- i_sorting: null,
108
- kr_name: null,
109
- modified_at: null,
110
- modifier: null,
111
- parent_code: 'notice',
112
- sorting: 3,
113
- use_bool: true
67
+ code_name: '업무협약'
114
68
  },
115
69
  {
116
70
  code: 'N0004',
117
- code_name: '기타소식',
118
- code_desc: null,
119
- created_at: '2024-03-04T16:42:25.730Z',
120
- creator: 'jeonghansol',
121
- en_name: null,
122
- etc: null,
123
- etc2: null,
124
- g_sorting: null,
125
- gubun: null,
126
- i_sorting: null,
127
- kr_name: null,
128
- modified_at: null,
129
- modifier: null,
130
- parent_code: 'notice',
131
- sorting: 4,
132
- use_bool: true
71
+ code_name: '기타소식'
133
72
  }
134
73
  ];
135
74
 
@@ -173,105 +112,61 @@ const mockNoticeList = [
173
112
  '경찰 경력 이동근 책임총괄변호사 영입…울산지방경찰청 경위울산남부경찰서 경위경찰교육원하나은행한국어린이집총연합회 사내변호사',
174
113
  code_name: '인사/동정',
175
114
  top_count: 0
115
+ },
116
+ {
117
+ id: 5686,
118
+ title: '법무법인 대륜 김영수변호사 대한변호사협회 형사전문변호사 등록',
119
+ summary:
120
+ '대한변호사협회 등록 형사전문변호사는 재…션을 제공하고, 원하시는 결과를 받을 수 있도록 최선을 다할 것을 약속드리겠습니다.',
121
+ code_name: '인사/동정',
122
+ top_count: 0
123
+ },
124
+ {
125
+ id: 5685,
126
+ title: '법무법인 대륜 박민수변호사 대한변호사협회 형사전문변호사 등록',
127
+ summary:
128
+ '대한변호사협회 등록 형사전문변호사는 재…션을 제공하고, 원하시는 결과를 받을 수 있도록 최선을 다할 것을 약속드리겠습니다.',
129
+ code_name: '인사/동정',
130
+ top_count: 0
131
+ },
132
+ {
133
+ id: 5684,
134
+ title: '법무법인 대륜 이정호변호사 대한변호사협회 형사전문변호사 등록',
135
+ summary:
136
+ '대한변호사협회 등록 형사전문변호사는 재…션을 제공하고, 원하시는 결과를 받을 수 있도록 최선을 다할 것을 약속드리겠습니다.',
137
+ code_name: '인사/동정',
138
+ top_count: 0
139
+ },
140
+ {
141
+ id: 5683,
142
+ title: '법무법인 대륜 최성호변호사 대한변호사협회 형사전문변호사 등록',
143
+ summary:
144
+ '대한변호사협회 등록 형사전문변호사는 재…션을 제공하고, 원하시는 결과를 받을 수 있도록 최선을 다할 것을 약속드리겠습니다.',
145
+ code_name: '인사/동정',
146
+ top_count: 0
147
+ },
148
+ {
149
+ id: 5682,
150
+ title: '법무법인 대륜 정민수변호사 대한변호사협회 형사전문변호사 등록',
151
+ summary:
152
+ '대한변호사협회 등록 형사전문변호사는 재…션을 제공하고, 원하시는 결과를 받을 수 있도록 최선을 다할 것을 약속드리겠습니다.',
153
+ code_name: '인사/동정',
154
+ top_count: 0
176
155
  }
177
156
  ];
178
157
 
179
158
  // 기본 스토리
180
159
  export const Default: Story = {
181
160
  args: {
182
- SearchBarProps: {
183
- searchInput: '',
184
- handleSearch: () => console.log('검색 실행'),
185
- handleInputChange: e => console.log('입력 변경:', e.currentTarget.value)
186
- },
187
- PaginationProps: {
188
- onPaginationChange: pageNum => console.log('페이지 변경:', pageNum),
189
- totalCount: mockNoticeList.length,
190
- currentPage: 1
191
- },
192
- noticeName: mockNoticeName,
193
161
  noticeList: mockNoticeList,
194
- nameFilter: { code_name: '전체', code: '' },
195
- search: '',
196
- indexOfFirstPost: 1,
197
- indexOfLastPost: 10,
198
- postPerPage: 10,
199
- currentPage: 1,
200
- router: mockRouter
201
- }
202
- };
203
-
204
- // 검색어가 있는 상태
205
- export const WithSearch: Story = {
206
- args: {
207
- SearchBarProps: {
208
- searchInput: '법무법인',
209
- handleSearch: () => console.log('검색 실행'),
210
- handleInputChange: e => console.log('입력 변경:', e.currentTarget.value)
211
- },
212
- PaginationProps: {
213
- onPaginationChange: pageNum => console.log('페이지 변경:', pageNum),
214
- totalCount: mockNoticeList.length,
215
- currentPage: 1
216
- },
217
- noticeName: mockNoticeName,
218
- noticeList: mockNoticeList,
219
- nameFilter: { code_name: '전체', code: '' },
220
- search: '법무법인',
221
- indexOfFirstPost: 1,
222
- indexOfLastPost: 10,
223
- postPerPage: 10,
224
- currentPage: 1,
225
- router: mockRouter
226
- }
227
- };
228
-
229
- // 필터가 선택된 상태
230
- export const WithFilter: Story = {
231
- args: {
232
- SearchBarProps: {
233
- searchInput: '',
234
- handleSearch: () => console.log('검색 실행'),
235
- handleInputChange: e => console.log('입력 변경:', e.currentTarget.value)
236
- },
237
- PaginationProps: {
238
- onPaginationChange: pageNum => console.log('페이지 변경:', pageNum),
239
- totalCount: mockNoticeList.length,
240
- currentPage: 1
241
- },
242
- noticeName: mockNoticeName,
243
- noticeList: mockNoticeList,
244
- nameFilter: { code_name: '사무소안내', code: 'N0001' },
245
- search: '',
246
- indexOfFirstPost: 1,
247
- indexOfLastPost: 10,
248
- postPerPage: 10,
249
- currentPage: 1,
250
- router: mockRouter
162
+ noticeName: mockNoticeCategories
251
163
  }
252
164
  };
253
165
 
254
166
  // 빈 목록 상태
255
167
  export const EmptyList: Story = {
256
168
  args: {
257
- SearchBarProps: {
258
- searchInput: '',
259
- handleSearch: () => console.log('검색 실행'),
260
- handleInputChange: e => console.log('입력 변경:', e.currentTarget.value)
261
- },
262
- PaginationProps: {
263
- onPaginationChange: pageNum => console.log('페이지 변경:', pageNum),
264
- totalCount: 0,
265
- currentPage: 1
266
- },
267
- noticeName: mockNoticeName,
268
169
  noticeList: [],
269
- nameFilter: { code_name: '전체', code: '' },
270
- search: '',
271
- indexOfFirstPost: 1,
272
- indexOfLastPost: 10,
273
- postPerPage: 10,
274
- currentPage: 1,
275
- router: mockRouter
170
+ noticeName: mockNoticeCategories
276
171
  }
277
172
  };