@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.
- package/dist/components/Header/HeaderWrapperNew.d.ts +8 -0
- package/dist/components/Header/HeaderWrapperNew.jsx +30 -0
- package/dist/components/Header/HeaderWrapperNew.tsx +34 -0
- package/dist/components/Header/MobileHeader.d.ts +2 -1
- package/dist/components/Header/MobileHeader.jsx +7 -3
- package/dist/components/Header/MobileHeader.tsx +15 -4
- package/dist/components/Header/PcHeader.d.ts +4 -2
- package/dist/components/Header/PcHeader.jsx +8 -4
- package/dist/components/Header/PcHeader.tsx +15 -4
- package/dist/components/page/Notice/NoticeList.d.ts +6 -29
- package/dist/components/page/Notice/NoticeList.jsx +91 -64
- package/dist/components/page/Notice/NoticeList.stories.d.ts +0 -2
- package/dist/components/page/Notice/NoticeList.stories.jsx +67 -177
- package/dist/components/page/Notice/NoticeList.stories.tsx +77 -182
- package/dist/components/page/Notice/NoticeList.tsx +131 -125
- package/dist/styles/globals.css +0 -12
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
interface WrapperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
ref?: React.Ref<HTMLDivElement> | null;
|
|
6
|
+
}
|
|
7
|
+
declare const HeaderWrapperNew: React.FC<WrapperProps>;
|
|
8
|
+
export default HeaderWrapperNew;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from 'react';
|
|
13
|
+
const HeaderWrapperNew = (_a) => {
|
|
14
|
+
var { children, className = '', ref = null } = _a, others = __rest(_a, ["children", "className", "ref"]);
|
|
15
|
+
return (<div className={' mx-auto w-full max-w-[1920px] ' +
|
|
16
|
+
//PC ( ~ 1500px )
|
|
17
|
+
'px-[140px] ' +
|
|
18
|
+
//1500px
|
|
19
|
+
'max-3xl:px-[80px] ' +
|
|
20
|
+
//1024px - dev Tablets
|
|
21
|
+
'max-lg:px-[60px] ' +
|
|
22
|
+
//900px - design Tablets
|
|
23
|
+
'max-md2:px-[40px] ' +
|
|
24
|
+
//520px - dev Mobile ( 320px - design Mobile )
|
|
25
|
+
'max-2sm:px-[20px] ' +
|
|
26
|
+
className} ref={ref} {...others}>
|
|
27
|
+
{children}
|
|
28
|
+
</div>);
|
|
29
|
+
};
|
|
30
|
+
export default HeaderWrapperNew;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface WrapperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string; // 스타일 추가
|
|
6
|
+
ref?: React.Ref<HTMLDivElement> | null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const HeaderWrapperNew: React.FC<WrapperProps> = ({ children, className = '', ref = null, ...others }) => {
|
|
10
|
+
return (
|
|
11
|
+
<div
|
|
12
|
+
className={
|
|
13
|
+
' mx-auto w-full max-w-[1920px] ' +
|
|
14
|
+
//PC ( ~ 1500px )
|
|
15
|
+
'px-[140px] ' +
|
|
16
|
+
//1500px
|
|
17
|
+
'max-3xl:px-[80px] ' +
|
|
18
|
+
//1024px - dev Tablets
|
|
19
|
+
'max-lg:px-[60px] ' +
|
|
20
|
+
//900px - design Tablets
|
|
21
|
+
'max-md2:px-[40px] ' +
|
|
22
|
+
//520px - dev Mobile ( 320px - design Mobile )
|
|
23
|
+
'max-2sm:px-[20px] ' +
|
|
24
|
+
className
|
|
25
|
+
}
|
|
26
|
+
ref={ref}
|
|
27
|
+
{...others}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default HeaderWrapperNew;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const MobileHeader: ({ isTextWhite, isBgOpacityZero, isBgBorder, isBgShadow, isMain, isNotSubPage, handleMenuToggle, centerName }: {
|
|
2
|
+
declare const MobileHeader: ({ isTextWhite, isBgOpacityZero, isBgBorder, isBgShadow, isMain, isNotSubPage, handleMenuToggle, centerName, isNewWrapper }: {
|
|
3
3
|
isNotSubPage?: boolean;
|
|
4
4
|
isTextWhite: boolean;
|
|
5
5
|
isMain: boolean;
|
|
@@ -8,5 +8,6 @@ declare const MobileHeader: ({ isTextWhite, isBgOpacityZero, isBgBorder, isBgSha
|
|
|
8
8
|
isBgOpacityZero: boolean;
|
|
9
9
|
handleMenuToggle: (url?: string | undefined) => void;
|
|
10
10
|
centerName: string;
|
|
11
|
+
isNewWrapper: boolean;
|
|
11
12
|
}) => React.JSX.Element;
|
|
12
13
|
export default MobileHeader;
|
|
@@ -17,13 +17,17 @@ import SearchWhite from '../../asset/images/header/search_white.webp';
|
|
|
17
17
|
import SearchBlack from '../../asset/images/header/search_black.webp';
|
|
18
18
|
import MenuWhite from '../../asset/images/header/h_menu.webp';
|
|
19
19
|
import MenuBlack from '../../asset/images/header/h_menu_b.webp';
|
|
20
|
-
|
|
20
|
+
import HeaderWrapperNew from './HeaderWrapperNew';
|
|
21
|
+
const MobileHeader = ({ isTextWhite, isBgOpacityZero, isBgBorder, isBgShadow, isMain, isNotSubPage, handleMenuToggle, centerName, isNewWrapper }) => {
|
|
21
22
|
const router = useRouter();
|
|
23
|
+
const Wrapper = (props) => {
|
|
24
|
+
return isNewWrapper ? (<HeaderWrapperNew className={props.className}>{props.children}</HeaderWrapperNew>) : (<HeaderWrapper className={props.className}>{props.children}</HeaderWrapper>);
|
|
25
|
+
};
|
|
22
26
|
return (<header className={'relative h-[70px] w-full border-b-[1px] border-solid bg-white transition-colors duration-300 sm:hidden ' +
|
|
23
27
|
(isBgOpacityZero ? ' bg-opacity-0 ' : '') +
|
|
24
28
|
(isBgBorder ? ' border-b-[2px] border-solid border-[#e5e7eb] bg-opacity-100 ' : '') +
|
|
25
29
|
(isBgShadow ? ' border-[#f2f2f2] bg-opacity-90 ' : 'border-transparent ')}>
|
|
26
|
-
<
|
|
30
|
+
<Wrapper className={'flex h-full w-full items-center justify-between'}>
|
|
27
31
|
<Link href={`/`} className={'shrink-0'}>
|
|
28
32
|
<Image src={`${process.env.NEXT_PUBLIC_S3_URL}/logo/new/${centerName}${isTextWhite ? '_w' : ''}.webp`} alt="법무법인(유한)대륜" width={216} priority height={33} className={'h-[25px] w-auto '}/>
|
|
29
33
|
</Link>
|
|
@@ -46,7 +50,7 @@ const MobileHeader = ({ isTextWhite, isBgOpacityZero, isBgBorder, isBgShadow, is
|
|
|
46
50
|
<Image id={'menu'} src={isTextWhite ? MenuWhite : MenuBlack} alt="전체메뉴 열기" width={38} height={20} className={'h-full w-full object-contain'}/>
|
|
47
51
|
</button>)}
|
|
48
52
|
</span>
|
|
49
|
-
</
|
|
53
|
+
</Wrapper>
|
|
50
54
|
</header>);
|
|
51
55
|
};
|
|
52
56
|
export default MobileHeader;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import Link from 'next/link';
|
|
4
4
|
import Image from 'next/image';
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { ReactNode } from 'react';
|
|
6
6
|
import { useRouter } from 'next/navigation';
|
|
7
7
|
import HeaderWrapper from './HeaderWrapper';
|
|
8
8
|
|
|
@@ -10,6 +10,7 @@ import SearchWhite from '../../asset/images/header/search_white.webp';
|
|
|
10
10
|
import SearchBlack from '../../asset/images/header/search_black.webp';
|
|
11
11
|
import MenuWhite from '../../asset/images/header/h_menu.webp';
|
|
12
12
|
import MenuBlack from '../../asset/images/header/h_menu_b.webp';
|
|
13
|
+
import HeaderWrapperNew from './HeaderWrapperNew';
|
|
13
14
|
|
|
14
15
|
const MobileHeader = ({
|
|
15
16
|
isTextWhite,
|
|
@@ -19,7 +20,8 @@ const MobileHeader = ({
|
|
|
19
20
|
isMain,
|
|
20
21
|
isNotSubPage,
|
|
21
22
|
handleMenuToggle,
|
|
22
|
-
centerName
|
|
23
|
+
centerName,
|
|
24
|
+
isNewWrapper
|
|
23
25
|
}: {
|
|
24
26
|
isNotSubPage?: boolean;
|
|
25
27
|
isTextWhite: boolean;
|
|
@@ -29,9 +31,18 @@ const MobileHeader = ({
|
|
|
29
31
|
isBgOpacityZero: boolean;
|
|
30
32
|
handleMenuToggle: (url?: string | undefined) => void;
|
|
31
33
|
centerName: string;
|
|
34
|
+
isNewWrapper: boolean;
|
|
32
35
|
}) => {
|
|
33
36
|
const router = useRouter();
|
|
34
37
|
|
|
38
|
+
const Wrapper = (props: { children: ReactNode; className?: string }) => {
|
|
39
|
+
return isNewWrapper ? (
|
|
40
|
+
<HeaderWrapperNew className={props.className}>{props.children}</HeaderWrapperNew>
|
|
41
|
+
) : (
|
|
42
|
+
<HeaderWrapper className={props.className}>{props.children}</HeaderWrapper>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
35
46
|
return (
|
|
36
47
|
<header
|
|
37
48
|
className={
|
|
@@ -41,7 +52,7 @@ const MobileHeader = ({
|
|
|
41
52
|
(isBgShadow ? ' border-[#f2f2f2] bg-opacity-90 ' : 'border-transparent ')
|
|
42
53
|
}
|
|
43
54
|
>
|
|
44
|
-
<
|
|
55
|
+
<Wrapper className={'flex h-full w-full items-center justify-between'}>
|
|
45
56
|
<Link href={`/`} className={'shrink-0'}>
|
|
46
57
|
<Image
|
|
47
58
|
src={`${process.env.NEXT_PUBLIC_S3_URL}/logo/new/${centerName}${isTextWhite ? '_w' : ''}.webp`}
|
|
@@ -96,7 +107,7 @@ const MobileHeader = ({
|
|
|
96
107
|
</button>
|
|
97
108
|
)}
|
|
98
109
|
</span>
|
|
99
|
-
</
|
|
110
|
+
</Wrapper>
|
|
100
111
|
</header>
|
|
101
112
|
);
|
|
102
113
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IRoute } from '../common';
|
|
2
|
-
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare const PcHeader: ({ isNotSubPage, pcRoutes, isTextWhite, isBgOpacityZero, isBgGray, isBgWhite, handleMenuToggle, centerName, isUnderBorder, isWhiteSpacePreWrap, isNewWrapper }: {
|
|
3
4
|
isNotSubPage?: boolean;
|
|
4
5
|
pcRoutes: IRoute[];
|
|
5
6
|
isTextWhite: boolean;
|
|
@@ -10,5 +11,6 @@ declare const PcHeader: ({ isNotSubPage, pcRoutes, isTextWhite, isBgOpacityZero,
|
|
|
10
11
|
centerName: string;
|
|
11
12
|
isUnderBorder?: boolean;
|
|
12
13
|
isWhiteSpacePreWrap?: boolean;
|
|
13
|
-
|
|
14
|
+
isNewWrapper?: boolean;
|
|
15
|
+
}) => React.JSX.Element;
|
|
14
16
|
export default PcHeader;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
import { usePathname, useRouter } from 'next/navigation';
|
|
12
|
-
import { useEffect, useRef, useState } from 'react';
|
|
12
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
13
13
|
import HeaderWrapper from './HeaderWrapper';
|
|
14
14
|
import Link from 'next/link';
|
|
15
15
|
import Image from 'next/image';
|
|
@@ -18,7 +18,8 @@ import SearchBlack from '../../asset/images/header/search_black.webp';
|
|
|
18
18
|
import MenuWhite from '../../asset/images/header/h_menu.webp';
|
|
19
19
|
import MenuBlack from '../../asset/images/header/h_menu_b.webp';
|
|
20
20
|
import IconNewLink from '../../asset/images/header/head_link.svg';
|
|
21
|
-
|
|
21
|
+
import HeaderWrapperNew from './HeaderWrapperNew';
|
|
22
|
+
const PcHeader = ({ isNotSubPage, pcRoutes, isTextWhite, isBgOpacityZero, isBgGray, isBgWhite, handleMenuToggle, centerName, isUnderBorder, isWhiteSpacePreWrap, isNewWrapper }) => {
|
|
22
23
|
const router = useRouter();
|
|
23
24
|
const pathname = usePathname();
|
|
24
25
|
const [isHover, setIsHover] = useState(false);
|
|
@@ -44,6 +45,9 @@ const PcHeader = ({ isNotSubPage, pcRoutes, isTextWhite, isBgOpacityZero, isBgGr
|
|
|
44
45
|
return () => clearTimeout(heightSet);
|
|
45
46
|
}
|
|
46
47
|
}, [isHover]);
|
|
48
|
+
const Wrapper = (props) => {
|
|
49
|
+
return isNewWrapper ? (<HeaderWrapperNew className={props.className}>{props.children}</HeaderWrapperNew>) : (<HeaderWrapper className={props.className}>{props.children}</HeaderWrapper>);
|
|
50
|
+
};
|
|
47
51
|
return (<header ref={headerRef} className={'relative w-full transition-colors duration-300 max-sm:hidden '} onMouseEnter={() => {
|
|
48
52
|
if (isNotSubPage)
|
|
49
53
|
return;
|
|
@@ -62,7 +66,7 @@ const PcHeader = ({ isNotSubPage, pcRoutes, isTextWhite, isBgOpacityZero, isBgGr
|
|
|
62
66
|
{/*하단배경 (세부 nav)*/}
|
|
63
67
|
<div className={'z-1 absolute bottom-0 left-0 h-[calc(100%-80px)] w-full transition-colors duration-300 ' +
|
|
64
68
|
`${isHover ? 'bg-[#545454] bg-opacity-90 ' : ''}`}/>
|
|
65
|
-
<
|
|
69
|
+
<Wrapper className={'flex min-h-[80px] items-start justify-between pt-[22px] ' +
|
|
66
70
|
//1024px
|
|
67
71
|
'max-lg:items-center max-lg:pt-0 '}>
|
|
68
72
|
<Link href={`/`} className={'relative h-[38px] w-[230px] shrink-0 max-xl:h-[32px]'}>
|
|
@@ -119,7 +123,7 @@ const PcHeader = ({ isNotSubPage, pcRoutes, isTextWhite, isBgOpacityZero, isBgGr
|
|
|
119
123
|
<Image id={'menu'} src={isTextWhite || isHover ? MenuWhite : MenuBlack} alt="전체메뉴 열기" width={38} height={20} className={'h-full w-full object-contain'}/>
|
|
120
124
|
</button>)}
|
|
121
125
|
</span>
|
|
122
|
-
</
|
|
126
|
+
</Wrapper>
|
|
123
127
|
</header>);
|
|
124
128
|
};
|
|
125
129
|
export default PcHeader;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { IRoute } from '../common';
|
|
4
4
|
import { usePathname, useRouter } from 'next/navigation';
|
|
5
|
-
import { useEffect, useRef, useState } from 'react';
|
|
5
|
+
import React, { ReactNode, useEffect, useRef, useState } from 'react';
|
|
6
6
|
import HeaderWrapper from './HeaderWrapper';
|
|
7
7
|
import Link from 'next/link';
|
|
8
8
|
import Image from 'next/image';
|
|
@@ -12,6 +12,7 @@ import SearchBlack from '../../asset/images/header/search_black.webp';
|
|
|
12
12
|
import MenuWhite from '../../asset/images/header/h_menu.webp';
|
|
13
13
|
import MenuBlack from '../../asset/images/header/h_menu_b.webp';
|
|
14
14
|
import IconNewLink from '../../asset/images/header/head_link.svg';
|
|
15
|
+
import HeaderWrapperNew from './HeaderWrapperNew';
|
|
15
16
|
|
|
16
17
|
const PcHeader = ({
|
|
17
18
|
isNotSubPage,
|
|
@@ -23,7 +24,8 @@ const PcHeader = ({
|
|
|
23
24
|
handleMenuToggle,
|
|
24
25
|
centerName,
|
|
25
26
|
isUnderBorder,
|
|
26
|
-
isWhiteSpacePreWrap
|
|
27
|
+
isWhiteSpacePreWrap,
|
|
28
|
+
isNewWrapper
|
|
27
29
|
}: {
|
|
28
30
|
isNotSubPage?: boolean;
|
|
29
31
|
pcRoutes: IRoute[];
|
|
@@ -35,6 +37,7 @@ const PcHeader = ({
|
|
|
35
37
|
centerName: string;
|
|
36
38
|
isUnderBorder?: boolean;
|
|
37
39
|
isWhiteSpacePreWrap?: boolean;
|
|
40
|
+
isNewWrapper?: boolean;
|
|
38
41
|
}) => {
|
|
39
42
|
const router = useRouter();
|
|
40
43
|
const pathname = usePathname();
|
|
@@ -64,6 +67,14 @@ const PcHeader = ({
|
|
|
64
67
|
}
|
|
65
68
|
}, [isHover]);
|
|
66
69
|
|
|
70
|
+
const Wrapper = (props: { children: ReactNode; className?: string }) => {
|
|
71
|
+
return isNewWrapper ? (
|
|
72
|
+
<HeaderWrapperNew className={props.className}>{props.children}</HeaderWrapperNew>
|
|
73
|
+
) : (
|
|
74
|
+
<HeaderWrapper className={props.className}>{props.children}</HeaderWrapper>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
67
78
|
return (
|
|
68
79
|
<header
|
|
69
80
|
ref={headerRef}
|
|
@@ -94,7 +105,7 @@ const PcHeader = ({
|
|
|
94
105
|
`${isHover ? 'bg-[#545454] bg-opacity-90 ' : ''}`
|
|
95
106
|
}
|
|
96
107
|
/>
|
|
97
|
-
<
|
|
108
|
+
<Wrapper
|
|
98
109
|
className={
|
|
99
110
|
'flex min-h-[80px] items-start justify-between pt-[22px] ' +
|
|
100
111
|
//1024px
|
|
@@ -230,7 +241,7 @@ const PcHeader = ({
|
|
|
230
241
|
</button>
|
|
231
242
|
)}
|
|
232
243
|
</span>
|
|
233
|
-
</
|
|
244
|
+
</Wrapper>
|
|
234
245
|
</header>
|
|
235
246
|
);
|
|
236
247
|
};
|
|
@@ -14,37 +14,14 @@ interface INoticeTypes {
|
|
|
14
14
|
top_count?: number;
|
|
15
15
|
timestamp?: string;
|
|
16
16
|
}
|
|
17
|
-
interface
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
interface IPaginationProps {
|
|
23
|
-
onPaginationChange: (pageNum: number) => void;
|
|
24
|
-
currentPage: number;
|
|
25
|
-
totalCount: number;
|
|
17
|
+
interface NoticeCategory {
|
|
18
|
+
code: string;
|
|
19
|
+
code_name: string | null;
|
|
20
|
+
[key: string]: any;
|
|
26
21
|
}
|
|
27
22
|
interface NoticeListProps {
|
|
28
|
-
SearchBarProps: ISearchBarProps;
|
|
29
|
-
PaginationProps: IPaginationProps;
|
|
30
|
-
noticeName: {
|
|
31
|
-
code: string;
|
|
32
|
-
code_name: string | null;
|
|
33
|
-
[key: string]: any;
|
|
34
|
-
}[];
|
|
35
23
|
noticeList: INoticeTypes[];
|
|
36
|
-
|
|
37
|
-
isUseHeaderComponent?: boolean;
|
|
38
|
-
nameFilter: {
|
|
39
|
-
code_name: string;
|
|
40
|
-
code: string;
|
|
41
|
-
};
|
|
42
|
-
search: string;
|
|
43
|
-
indexOfFirstPost: number;
|
|
44
|
-
indexOfLastPost: number;
|
|
45
|
-
postPerPage: number;
|
|
46
|
-
currentPage: number;
|
|
47
|
-
router: any;
|
|
24
|
+
noticeName: NoticeCategory[];
|
|
48
25
|
}
|
|
49
|
-
declare const NoticeList: ({
|
|
26
|
+
declare const NoticeList: ({ noticeList, noticeName }: NoticeListProps) => React.JSX.Element;
|
|
50
27
|
export default NoticeList;
|
|
@@ -1,12 +1,78 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import { useRouter } from 'next/router';
|
|
3
4
|
import Link from 'next/link';
|
|
4
|
-
import
|
|
5
|
+
import SearchBar from '../../SearchBar/SearchBar';
|
|
6
|
+
import PaginationComponent from '../../page/MyCase/_component/_pagination/PaginationComponent';
|
|
5
7
|
import PageTitleBox from '../../PageTitleBox/PageTitleBox';
|
|
6
8
|
import { ImgTypes } from '../../PageTitleBox/ImgTypes';
|
|
7
9
|
import PageWrapper from '../../Layout/PageWrapper';
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
+
const NoticeList = ({ noticeList, noticeName }) => {
|
|
11
|
+
const router = useRouter();
|
|
12
|
+
// 내부 상태 관리
|
|
13
|
+
const [search, setSearch] = useState('');
|
|
14
|
+
const [searchInput, setSearchInput] = useState('');
|
|
15
|
+
const [nameFilter, setNameFilter] = useState({
|
|
16
|
+
code_name: '전체',
|
|
17
|
+
code: ''
|
|
18
|
+
});
|
|
19
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
20
|
+
const [filteredList, setFilteredList] = useState(noticeList);
|
|
21
|
+
const [total, setTotal] = useState(noticeList.length);
|
|
22
|
+
const postPerPage = 10;
|
|
23
|
+
const indexOfLastPost = currentPage * postPerPage;
|
|
24
|
+
const indexOfFirstPost = indexOfLastPost - postPerPage;
|
|
25
|
+
// 검색 및 필터링 로직
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
var _a;
|
|
28
|
+
const searchTxt = String(router.query.search || '').toLowerCase();
|
|
29
|
+
const searchFilter = String(router.query.nameFilter || '');
|
|
30
|
+
let searchResultList = [];
|
|
31
|
+
if (!searchFilter || searchFilter === '전체') {
|
|
32
|
+
searchResultList = noticeList === null || noticeList === void 0 ? void 0 : noticeList.filter((item) => { var _a, _b; return ((_a = item.title) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTxt)) || ((_b = item.summary) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTxt)); });
|
|
33
|
+
setNameFilter({ code_name: '전체', code: '' });
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
const filterNameList = noticeList.filter((item) => item.code_name === searchFilter);
|
|
37
|
+
searchResultList = filterNameList === null || filterNameList === void 0 ? void 0 : filterNameList.filter((item) => { var _a, _b; return ((_a = item.title) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTxt)) || ((_b = item.summary) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTxt)); });
|
|
38
|
+
const code = ((_a = noticeName.find((name) => name.code_name === searchFilter)) === null || _a === void 0 ? void 0 : _a.code) || '';
|
|
39
|
+
setNameFilter({ code_name: searchFilter, code });
|
|
40
|
+
}
|
|
41
|
+
setFilteredList(searchResultList);
|
|
42
|
+
setTotal(searchResultList.length);
|
|
43
|
+
setSearch(searchTxt || '');
|
|
44
|
+
setSearchInput(searchTxt || '');
|
|
45
|
+
setCurrentPage(Number(router.query.page) || 1);
|
|
46
|
+
}, [router.query.search, router.query.nameFilter, router.query.page, noticeList, noticeName]);
|
|
47
|
+
// 핸들러 함수들
|
|
48
|
+
const handleInputChange = (e) => {
|
|
49
|
+
setSearchInput(e.currentTarget.value);
|
|
50
|
+
};
|
|
51
|
+
const handleSearch = () => {
|
|
52
|
+
router.push({
|
|
53
|
+
pathname: '/notice',
|
|
54
|
+
query: searchInput
|
|
55
|
+
? { page: 1, search: searchInput, nameFilter: nameFilter.code_name }
|
|
56
|
+
: { page: 1, nameFilter: nameFilter.code_name }
|
|
57
|
+
});
|
|
58
|
+
setSearch(searchInput);
|
|
59
|
+
};
|
|
60
|
+
const handlePaginationChange = (pageNum) => {
|
|
61
|
+
router.push({
|
|
62
|
+
pathname: '/notice',
|
|
63
|
+
query: search
|
|
64
|
+
? { page: pageNum, search: search, nameFilter: nameFilter.code_name }
|
|
65
|
+
: { page: pageNum, nameFilter: nameFilter.code_name }
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
const handleCategoryClick = (categoryName) => {
|
|
69
|
+
router.push({
|
|
70
|
+
pathname: '/notice',
|
|
71
|
+
query: search
|
|
72
|
+
? { page: 1, search: search, nameFilter: categoryName }
|
|
73
|
+
: { page: 1, nameFilter: categoryName }
|
|
74
|
+
});
|
|
75
|
+
};
|
|
10
76
|
return (<>
|
|
11
77
|
<PageTitleBox titleTxt={'공지사항'} subTxt={<>
|
|
12
78
|
법무법인(유한) 대륜의
|
|
@@ -14,46 +80,22 @@ const NoticeList = ({ SearchBarProps, PaginationProps, noticeName, noticeList, c
|
|
|
14
80
|
다양한 새소식을 전달합니다
|
|
15
81
|
</>} imgType={ImgTypes.NOTICE} isUseHeaderComponent/>
|
|
16
82
|
<PageWrapper>
|
|
17
|
-
<SearchBar label={'검색어를 입력해주세요.'} onChange={
|
|
83
|
+
<SearchBar label={'검색어를 입력해주세요.'} onChange={handleInputChange} onClick={handleSearch} search={searchInput} placeholder={'검색어를 입력해주세요.'} isKeyPress={true} marginTop={[70, 50, 50]}/>
|
|
18
84
|
<div className={'mb-10 flex w-full cursor-pointer border-[1px] border-solid border-[#DBDBDB] text-center '}>
|
|
19
85
|
<div tabIndex={0} className={`${nameFilter.code_name === '전체'
|
|
20
86
|
? 'bg-[#285FA7] text-[#fff]'
|
|
21
|
-
: "after:absolute after:right-[-1px] after:z-[-1] after:h-[45%] after:w-[1px] after:bg-[#DBDBDB] after:content-['']"} relative w-[20%] py-3 text-[13px] 2xs:text-[16px] xs:py-4 sm:text-[22px]`} onClick={() => {
|
|
22
|
-
router.push({
|
|
23
|
-
pathname: '/notice',
|
|
24
|
-
query: search
|
|
25
|
-
? { page: 1, search: search, nameFilter: '전체' }
|
|
26
|
-
: { page: 1, nameFilter: '전체' }
|
|
27
|
-
});
|
|
28
|
-
}} onKeyDown={(e) => {
|
|
87
|
+
: "after:absolute after:right-[-1px] after:z-[-1] after:h-[45%] after:w-[1px] after:bg-[#DBDBDB] after:content-['']"} relative w-[20%] py-3 text-[13px] 2xs:text-[16px] xs:py-4 sm:text-[22px]`} onClick={() => handleCategoryClick('전체')} onKeyDown={(e) => {
|
|
29
88
|
if (e.key === 'Enter') {
|
|
30
|
-
|
|
31
|
-
pathname: '/notice',
|
|
32
|
-
query: search
|
|
33
|
-
? { page: 1, search: search, nameFilter: '전체' }
|
|
34
|
-
: { page: 1, nameFilter: '전체' }
|
|
35
|
-
});
|
|
89
|
+
handleCategoryClick('전체');
|
|
36
90
|
}
|
|
37
91
|
}}>
|
|
38
92
|
전체
|
|
39
93
|
</div>
|
|
40
94
|
{noticeName.map((item, index) => (<div tabIndex={0} key={index} className={`${nameFilter.code_name === item.code_name
|
|
41
95
|
? 'bg-[#285FA7] text-[#fff] '
|
|
42
|
-
: "after:absolute after:right-[-1px] after:z-[-1] after:h-[45%] after:w-[1px] after:bg-[#DBDBDB] after:content-['']"} relative w-[20%] py-3 text-[13px] 2xs:text-[16px] xs:py-4 sm:text-[22px]`} onClick={() => {
|
|
43
|
-
router.push({
|
|
44
|
-
pathname: '/notice',
|
|
45
|
-
query: search
|
|
46
|
-
? { page: 1, search: search, nameFilter: item.code_name }
|
|
47
|
-
: { page: 1, nameFilter: item.code_name }
|
|
48
|
-
});
|
|
49
|
-
}} onKeyDown={(e) => {
|
|
96
|
+
: "after:absolute after:right-[-1px] after:z-[-1] after:h-[45%] after:w-[1px] after:bg-[#DBDBDB] after:content-['']"} relative w-[20%] py-3 text-[13px] 2xs:text-[16px] xs:py-4 sm:text-[22px]`} onClick={() => handleCategoryClick(item.code_name)} onKeyDown={(e) => {
|
|
50
97
|
if (e.key === 'Enter') {
|
|
51
|
-
|
|
52
|
-
pathname: '/notice',
|
|
53
|
-
query: search
|
|
54
|
-
? { page: 1, search: search, nameFilter: item.code_name }
|
|
55
|
-
: { page: 1, nameFilter: item.code_name }
|
|
56
|
-
});
|
|
98
|
+
handleCategoryClick(item.code_name);
|
|
57
99
|
}
|
|
58
100
|
}}>
|
|
59
101
|
{item.code_name}
|
|
@@ -64,7 +106,6 @@ const NoticeList = ({ SearchBarProps, PaginationProps, noticeName, noticeList, c
|
|
|
64
106
|
<colgroup className={''}>
|
|
65
107
|
<col className={'sm:w-[10%]'}/>
|
|
66
108
|
<col width="55" className={'w-[75%] max-xs:w-[70%]'}/>
|
|
67
|
-
{/* <col className={'w-[15%] max-xs:w-[20%]'} /> */}
|
|
68
109
|
</colgroup>
|
|
69
110
|
|
|
70
111
|
<thead>
|
|
@@ -75,40 +116,28 @@ const NoticeList = ({ SearchBarProps, PaginationProps, noticeName, noticeList, c
|
|
|
75
116
|
<th scope="col" className={'border-b-[1px] border-solid border-[#d2d2d2] py-[15px] text-[16px] font-[800] max-sm:text-xs'}>
|
|
76
117
|
제목
|
|
77
118
|
</th>
|
|
78
|
-
{/* <th
|
|
79
|
-
scope="col"
|
|
80
|
-
className={
|
|
81
|
-
'py-[15px] border-b-[1px] border-[#d2d2d2] border-solid text-[16px] font-[800] max-sm:text-xs'
|
|
82
|
-
}
|
|
83
|
-
>
|
|
84
|
-
작성일
|
|
85
|
-
</th> */}
|
|
86
119
|
</tr>
|
|
87
120
|
</thead>
|
|
88
121
|
|
|
89
122
|
<tbody>
|
|
90
|
-
{
|
|
91
|
-
|
|
92
|
-
|
|
123
|
+
{filteredList.length > 0 &&
|
|
124
|
+
filteredList.slice(indexOfFirstPost, indexOfLastPost).length > 0 ? (filteredList
|
|
125
|
+
.slice(indexOfFirstPost, indexOfLastPost)
|
|
126
|
+
.map((item, index) => (<tr key={item.id} className={''}>
|
|
127
|
+
<td className={'border-b-[1px] border-solid border-[#d2d2d2] py-[15px] text-center sm:text-[16px]'}>
|
|
128
|
+
{filteredList.length -
|
|
93
129
|
(index + 1 + currentPage * postPerPage) +
|
|
94
130
|
postPerPage +
|
|
95
131
|
1}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
className={
|
|
106
|
-
'text-center py-[15px] border-b-[1px] border-[#d2d2d2] border-solid sm:text-[16px] tracking-[-1px]'
|
|
107
|
-
}
|
|
108
|
-
>
|
|
109
|
-
{item.timestamp}
|
|
110
|
-
</td> */}
|
|
111
|
-
</tr>))) : noticeList.length < 1 ? (<tr>
|
|
132
|
+
</td>
|
|
133
|
+
<td className={'border-b-[1px] border-solid border-[#d2d2d2] py-[15px] sm:text-[16px]'}>
|
|
134
|
+
<Link href={'/notice/' + item.id}>
|
|
135
|
+
<div>
|
|
136
|
+
<div className={'truncate'}>{item.title}</div>
|
|
137
|
+
</div>
|
|
138
|
+
</Link>
|
|
139
|
+
</td>
|
|
140
|
+
</tr>))) : filteredList.length < 1 ? (<tr>
|
|
112
141
|
<td colSpan={2} className={'border-b-[1px] border-[#d2d2d2] py-[15px] ' +
|
|
113
142
|
'order-solid text-[16px] font-[400]'}>
|
|
114
143
|
<div className={'text-center'}>
|
|
@@ -124,9 +153,7 @@ const NoticeList = ({ SearchBarProps, PaginationProps, noticeName, noticeList, c
|
|
|
124
153
|
</tr>)}
|
|
125
154
|
</tbody>
|
|
126
155
|
</table>
|
|
127
|
-
|
|
128
|
-
<Pagination currentPage={PaginationProps.currentPage} onPageChange={PaginationProps.onPaginationChange} totalPages={Math.ceil(PaginationProps.totalCount / 9)}/>
|
|
129
|
-
</div>) : (<></>)}
|
|
156
|
+
<PaginationComponent pageSize={postPerPage} total={total} onChange={handlePaginationChange} current={currentPage}/>
|
|
130
157
|
</div>
|
|
131
158
|
</PageWrapper>
|
|
132
159
|
</>);
|