@daeryun/dr_components 0.1.13 → 0.1.14

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.
@@ -0,0 +1,113 @@
1
+ import React from 'react';
2
+ import Image from 'next/image';
3
+ const CenterComponent = (props) => {
4
+ const { themeColor, centerList, onClick, hiddenTitle, currentCenterTitle } = props;
5
+ const currentCenter = props.centerList.filter(item => item.code_desc === currentCenterTitle);
6
+ const CenterCon = (props) => {
7
+ const { item } = props;
8
+ return (<>
9
+ <button onClick={() => {
10
+ const newCenters = centerList.map(i => (Object.assign(Object.assign({}, i), { isSelect: i.code === item.code })));
11
+ onClick(newCenters);
12
+ }} style={{ direction: 'ltr', backgroundColor: item.isSelect ? themeColor : themeColor + '00' }} className={'relative block h-fit w-full bg-amber-200 py-[15px] text-left ' +
13
+ `${item.isSelect
14
+ ? 'rounded-[15px] text-[#fff] max-2sm:rounded-[10px] '
15
+ : 'hover:bg-[#b99c6e1a] '}`} onMouseOver={e => {
16
+ if (!item.isSelect)
17
+ e.currentTarget.style.backgroundColor = themeColor + '15';
18
+ }} onMouseOut={e => {
19
+ if (!item.isSelect)
20
+ e.currentTarget.style.backgroundColor = themeColor + '00';
21
+ }}>
22
+ <span className={'flex h-full w-full items-center justify-between gap-[10px] px-[20px] ' +
23
+ //520px
24
+ 'max-2sm:px-[10px]'}>
25
+ <p className={'grow break-keep text-[22px] font-[600] tracking-[-1px] ' +
26
+ //1280px
27
+ 'max-xl:text-[20px] ' +
28
+ //900px
29
+ 'max-md2:text-[18px] ' +
30
+ //520px
31
+ 'max-2sm:text-[13px]'}>
32
+ {item.code_name}
33
+ </p>
34
+ <Image src={'/images/categoryView/section9_arrow_01.webp'} alt={'arrow'} width={24} height={43} className={'mr-[10px] h-auto w-[12px] ' +
35
+ `${item.isSelect ? 'block ' : 'hidden '}` +
36
+ //1280px
37
+ 'max-xl:w-[9px] ' +
38
+ //520px
39
+ 'max-2sm:w-[6px]'}/>
40
+ <Image src={'/images/categoryView/section9_arrow_02.webp'} alt={'arrow'} width={24} height={43} className={'mr-[10px] h-auto w-[12px] ' +
41
+ `${item.isSelect ? 'hidden ' : 'block '}` +
42
+ //1280px
43
+ 'max-xl:w-[9px] ' +
44
+ //520px
45
+ 'max-2sm:w-[6px]'}/>
46
+ </span>
47
+ </button>
48
+ <div className={'mx-auto h-[1px] w-[calc(100%-30px)] bg-[#DDDDDD] last:hidden ' +
49
+ //520px
50
+ 'max-2sm:w-[calc(100%-20px)]'}></div>
51
+ </>);
52
+ };
53
+ return (<>
54
+ {/*센터*/}
55
+ <style>
56
+ {/*스크롤 커스텀*/}
57
+ {`#center_scroll_custom::-webkit-scrollbar {
58
+ width: 8px;
59
+ border-radius: 5px;
60
+ background-color: #CECECE;
61
+ }
62
+
63
+ #center_scroll_custom::-webkit-scrollbar-thumb {
64
+ background-color: #646464;
65
+ border-radius: 5px;
66
+ }
67
+
68
+ @media (max-width: 520px) {
69
+ #center_scroll_custom::-webkit-scrollbar{width: 6px;}
70
+ }`}
71
+ </style>
72
+ <div className={'flex h-[535px] w-[35%] max-w-[300px] shrink-0 flex-col gap-[110px] ' +
73
+ //1920px
74
+ 'max-full:h-[600px] ' +
75
+ //1600px
76
+ 'max-4xl:h-[480px] max-4xl:gap-[30px] ' +
77
+ //1280px
78
+ 'max-4xl:gap-[52px] max-xl:h-[600px] ' +
79
+ //900px
80
+ 'max-md2:h-[680px] max-md2:w-[calc(50%-10px)] max-md2:gap-[55px] ' +
81
+ //520px
82
+ 'max-2sm:h-[550px] '}>
83
+ <div className={`${hiddenTitle && 'xl:hidden'}`}>
84
+ <p className={'text-[40px] font-[800] tracking-[-2px] ' +
85
+ //900px
86
+ 'max-md2:text-[36px] ' +
87
+ //520px
88
+ 'max-2sm:text-[27px]'}>
89
+ 모든 분야{' '}
90
+ <span className={'block text-[30px] tracking-[-1.2px] ' +
91
+ //900px
92
+ 'max-md2:text-[27px] max-md2:tracking-[-1px] ' +
93
+ //520px
94
+ 'max-2sm:text-[20px]'}>
95
+ 한 눈에 보기
96
+ </span>
97
+ </p>
98
+ </div>
99
+ {/*센터목록*/}
100
+ <span className={'block flex-1 overflow-y-scroll pl-[20px] ' +
101
+ //520px
102
+ 'max-2sm:pl-[10px]'} style={{
103
+ direction: 'rtl'
104
+ }} id={'center_scroll_custom'}>
105
+ {currentCenter.map(item => (<CenterCon key={item.code} item={item}/>))}
106
+ {props.centerList
107
+ .filter(item => item.code_desc !== currentCenterTitle)
108
+ .map(item => (<CenterCon key={item.code} item={item}/>))}
109
+ </span>
110
+ </div>
111
+ </>);
112
+ };
113
+ export default CenterComponent;
@@ -0,0 +1,189 @@
1
+ import React from 'react';
2
+ import { ICenter } from './ICategoryViewTypes';
3
+ import Image from 'next/image';
4
+
5
+ const CenterComponent = (props: {
6
+ themeColor: string;
7
+ centerList: ICenter[];
8
+ onClick: (list: ICenter[]) => void;
9
+ hiddenTitle: boolean | undefined;
10
+ currentCenterTitle: string;
11
+ }) => {
12
+ const { themeColor, centerList, onClick, hiddenTitle, currentCenterTitle } = props;
13
+ const currentCenter = props.centerList.filter(item => item.code_desc === currentCenterTitle);
14
+
15
+ const CenterCon = (props: { item: ICenter }) => {
16
+ const { item } = props;
17
+ return (
18
+ <>
19
+ <button
20
+ onClick={() => {
21
+ const newCenters = centerList.map(i => ({
22
+ ...i,
23
+ isSelect: i.code === item.code
24
+ }));
25
+ onClick(newCenters);
26
+ }}
27
+ style={{ direction: 'ltr', backgroundColor: item.isSelect ? themeColor : themeColor + '00' }}
28
+ className={
29
+ 'relative block h-fit w-full bg-amber-200 py-[15px] text-left ' +
30
+ `${
31
+ item.isSelect
32
+ ? 'rounded-[15px] text-[#fff] max-2sm:rounded-[10px] '
33
+ : 'hover:bg-[#b99c6e1a] '
34
+ }`
35
+ }
36
+ onMouseOver={e => {
37
+ if (!item.isSelect) e.currentTarget.style.backgroundColor = themeColor + '15';
38
+ }}
39
+ onMouseOut={e => {
40
+ if (!item.isSelect) e.currentTarget.style.backgroundColor = themeColor + '00';
41
+ }}
42
+ >
43
+ <span
44
+ className={
45
+ 'flex h-full w-full items-center justify-between gap-[10px] px-[20px] ' +
46
+ //520px
47
+ 'max-2sm:px-[10px]'
48
+ }
49
+ >
50
+ <p
51
+ className={
52
+ 'grow break-keep text-[22px] font-[600] tracking-[-1px] ' +
53
+ //1280px
54
+ 'max-xl:text-[20px] ' +
55
+ //900px
56
+ 'max-md2:text-[18px] ' +
57
+ //520px
58
+ 'max-2sm:text-[13px]'
59
+ }
60
+ >
61
+ {item.code_name}
62
+ </p>
63
+ <Image
64
+ src={'/images/categoryView/section9_arrow_01.webp'}
65
+ alt={'arrow'}
66
+ width={24}
67
+ height={43}
68
+ className={
69
+ 'mr-[10px] h-auto w-[12px] ' +
70
+ `${item.isSelect ? 'block ' : 'hidden '}` +
71
+ //1280px
72
+ 'max-xl:w-[9px] ' +
73
+ //520px
74
+ 'max-2sm:w-[6px]'
75
+ }
76
+ />
77
+ <Image
78
+ src={'/images/categoryView/section9_arrow_02.webp'}
79
+ alt={'arrow'}
80
+ width={24}
81
+ height={43}
82
+ className={
83
+ 'mr-[10px] h-auto w-[12px] ' +
84
+ `${item.isSelect ? 'hidden ' : 'block '}` +
85
+ //1280px
86
+ 'max-xl:w-[9px] ' +
87
+ //520px
88
+ 'max-2sm:w-[6px]'
89
+ }
90
+ />
91
+ </span>
92
+ </button>
93
+ <div
94
+ className={
95
+ 'mx-auto h-[1px] w-[calc(100%-30px)] bg-[#DDDDDD] last:hidden ' +
96
+ //520px
97
+ 'max-2sm:w-[calc(100%-20px)]'
98
+ }
99
+ ></div>
100
+ </>
101
+ );
102
+ };
103
+
104
+ return (
105
+ <>
106
+ {/*센터*/}
107
+ <style>
108
+ {/*스크롤 커스텀*/}
109
+ {`#center_scroll_custom::-webkit-scrollbar {
110
+ width: 8px;
111
+ border-radius: 5px;
112
+ background-color: #CECECE;
113
+ }
114
+
115
+ #center_scroll_custom::-webkit-scrollbar-thumb {
116
+ background-color: #646464;
117
+ border-radius: 5px;
118
+ }
119
+
120
+ @media (max-width: 520px) {
121
+ #center_scroll_custom::-webkit-scrollbar{width: 6px;}
122
+ }`}
123
+ </style>
124
+ <div
125
+ className={
126
+ 'flex h-[535px] w-[35%] max-w-[300px] shrink-0 flex-col gap-[110px] ' +
127
+ //1920px
128
+ 'max-full:h-[600px] ' +
129
+ //1600px
130
+ 'max-4xl:h-[480px] max-4xl:gap-[30px] ' +
131
+ //1280px
132
+ 'max-4xl:gap-[52px] max-xl:h-[600px] ' +
133
+ //900px
134
+ 'max-md2:h-[680px] max-md2:w-[calc(50%-10px)] max-md2:gap-[55px] ' +
135
+ //520px
136
+ 'max-2sm:h-[550px] '
137
+ }
138
+ >
139
+ <div className={`${hiddenTitle && 'xl:hidden'}`}>
140
+ <p
141
+ className={
142
+ 'text-[40px] font-[800] tracking-[-2px] ' +
143
+ //900px
144
+ 'max-md2:text-[36px] ' +
145
+ //520px
146
+ 'max-2sm:text-[27px]'
147
+ }
148
+ >
149
+ 모든 분야{' '}
150
+ <span
151
+ className={
152
+ 'block text-[30px] tracking-[-1.2px] ' +
153
+ //900px
154
+ 'max-md2:text-[27px] max-md2:tracking-[-1px] ' +
155
+ //520px
156
+ 'max-2sm:text-[20px]'
157
+ }
158
+ >
159
+ 한 눈에 보기
160
+ </span>
161
+ </p>
162
+ </div>
163
+ {/*센터목록*/}
164
+ <span
165
+ className={
166
+ 'block flex-1 overflow-y-scroll pl-[20px] ' +
167
+ //520px
168
+ 'max-2sm:pl-[10px]'
169
+ }
170
+ style={{
171
+ direction: 'rtl'
172
+ }}
173
+ id={'center_scroll_custom'}
174
+ >
175
+ {currentCenter.map(item => (
176
+ <CenterCon key={item.code} item={item} />
177
+ ))}
178
+ {props.centerList
179
+ .filter(item => item.code_desc !== currentCenterTitle)
180
+ .map(item => (
181
+ <CenterCon key={item.code} item={item} />
182
+ ))}
183
+ </span>
184
+ </div>
185
+ </>
186
+ );
187
+ };
188
+
189
+ export default CenterComponent;
@@ -0,0 +1,12 @@
1
+ export interface ICenter {
2
+ code: string;
3
+ code_name: string | null;
4
+ code_desc: string | null;
5
+ isSelect?: boolean;
6
+ }
7
+ export interface ICategory {
8
+ idx: number;
9
+ center_code: string;
10
+ title: string | null;
11
+ pathname: string;
12
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ export interface ICenter {
2
+ code: string;
3
+ code_name: string | null; //한글이름
4
+ code_desc: string | null; //영어이름
5
+ isSelect?: boolean;
6
+ }
7
+ export interface ICategory {
8
+ idx: number;
9
+ center_code: string;
10
+ title: string | null;
11
+ pathname: string;
12
+ }