@daeryun/dr_components 0.8.69 → 0.8.70
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/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/Daeryuntalk/ChatConversation.jsx +54 -25
- package/dist/components/Daeryuntalk/ChatConversation.tsx +84 -42
- package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.jsx +1 -1
- package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.tsx +3 -1
- package/dist/components/Daeryuntalk/ChatHomeView.jsx +6 -4
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +10 -5
- package/dist/components/Daeryuntalk/ChatInput.jsx +9 -7
- package/dist/components/Daeryuntalk/ChatInput.tsx +15 -12
- package/dist/components/Daeryuntalk/ChatWidget.jsx +15 -16
- package/dist/components/Daeryuntalk/ChatWidget.tsx +19 -20
- package/dist/components/Daeryuntalk/HistoryView.jsx +9 -3
- package/dist/components/Daeryuntalk/HistoryView.tsx +15 -3
- package/dist/components/Daeryuntalk/HomeView.jsx +73 -92
- package/dist/components/Daeryuntalk/HomeView.tsx +83 -103
- package/dist/components/Daeryuntalk/NavigationFooter.jsx +1 -1
- package/dist/components/Daeryuntalk/NavigationFooter.tsx +1 -1
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.d.ts +1 -0
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.jsx +3 -3
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.tsx +4 -3
- package/dist/components/Daeryuntalk/ViewportHandler.d.ts +1 -1
- package/dist/components/Daeryuntalk/ViewportHandler.jsx +5 -23
- package/dist/components/Daeryuntalk/ViewportHandler.tsx +44 -30
- package/dist/components/common/integrate/index.d.ts +1 -1
- package/dist/styles/globals.css +369 -331
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -71,15 +71,17 @@ const ChatHomeView = ({ hashValue, onClose, isMobile, isHash }) => {
|
|
|
71
71
|
xs:shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]
|
|
72
72
|
`
|
|
73
73
|
: `
|
|
74
|
-
|
|
75
|
-
xs:
|
|
74
|
+
w-full rounded-[0px]
|
|
75
|
+
xs:w-[390px] xs:rounded-[30px]
|
|
76
76
|
`}
|
|
77
77
|
|
|
78
78
|
`}
|
|
79
79
|
|
|
80
80
|
`}>
|
|
81
|
-
<div className="flex h-full flex-col
|
|
82
|
-
|
|
81
|
+
<div className="flex h-full flex-col justify-between border-[1px] border-solid xs:justify-start xs:rounded-[30px]" style={{
|
|
82
|
+
boxShadow: 'box-shadow: 0px 0px 20px 0px #00000040'
|
|
83
|
+
}}>
|
|
84
|
+
<div className={`no-scrollbar ${isMobile ? '' : 'overflow-auto'} `}>{content}</div>
|
|
83
85
|
{/* 얘는 아래 64px로 고정 */}
|
|
84
86
|
<NavigationFooter activeView={activeView} onHomeClick={handleBackToHome} onHistoryClick={handleHistoryClick} historyList={historyList} isAuthenticated={isAuthenticated}/>
|
|
85
87
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Dispatch, SetStateAction, useEffect, useState } from 'react';
|
|
1
|
+
import React, { Dispatch, SetStateAction, useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
3
3
|
import ChatConversation from './ChatConversation';
|
|
4
4
|
import HistoryView from './HistoryView';
|
|
@@ -127,8 +127,8 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, onClose, isMobil
|
|
|
127
127
|
xs:shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]
|
|
128
128
|
`
|
|
129
129
|
: `
|
|
130
|
-
|
|
131
|
-
xs:
|
|
130
|
+
w-full rounded-[0px]
|
|
131
|
+
xs:w-[390px] xs:rounded-[30px]
|
|
132
132
|
`
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -137,8 +137,13 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, onClose, isMobil
|
|
|
137
137
|
|
|
138
138
|
`}
|
|
139
139
|
>
|
|
140
|
-
<div
|
|
141
|
-
|
|
140
|
+
<div
|
|
141
|
+
className="flex h-full flex-col justify-between border-[1px] border-solid xs:justify-start xs:rounded-[30px]"
|
|
142
|
+
style={{
|
|
143
|
+
boxShadow: 'box-shadow: 0px 0px 20px 0px #00000040'
|
|
144
|
+
}}
|
|
145
|
+
>
|
|
146
|
+
<div className={`no-scrollbar ${isMobile ? '' : 'overflow-auto'} `}>{content}</div>
|
|
142
147
|
{/* 얘는 아래 64px로 고정 */}
|
|
143
148
|
<NavigationFooter
|
|
144
149
|
activeView={activeView}
|
|
@@ -28,18 +28,20 @@ const ChatInput = () => {
|
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
return (<form onSubmit={handleSubmit} className="flex w-full items-center gap-2">
|
|
31
|
-
<div className="flex-1">
|
|
31
|
+
<div className="flex flex-1 justify-center gap-[10px] rounded-[10px] border-[1px] border-solid border-grayScale6 p-[4px]">
|
|
32
32
|
{/* 최초 높이 44 */}
|
|
33
33
|
{/*내용이 2줄 이상되면 입력창 높이도 키워져야합니다. 최대한 4줄까지만 보이도록 해주시고, 그 이상은 스크롤 될 수 있도록 해주시는 게 좋을 것 같습니다. max height 값을 72로 지정 부탁드립니다*/}
|
|
34
34
|
<Tiptap ref={tiptapRef}
|
|
35
35
|
// value={message}
|
|
36
|
-
onChange={setMessage} onEnterKeyPress={handleEnter} placeholder="메시지를 입력하세요..."/>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
onChange={setMessage} onEnterKeyPress={handleEnter} placeholder="메시지를 입력하세요..." contentClassName={`!outline-none !border-[0px]`}/>
|
|
37
|
+
<div className={`flex flex-col justify-end`}>
|
|
38
|
+
<button type="submit" className={`flex h-10 w-10 items-center justify-center rounded-[8px] bg-drTalkBtnActive2 text-white ${isLoading || !message.trim() ? 'cursor-not-allowed opacity-50' : ' bg-drTalkCrimson '}`} disabled={isLoading || !message.trim()}>
|
|
39
|
+
<div className="flex h-9 w-9 items-center justify-center">
|
|
40
|
+
<SendIcon width={24} height={24}/>
|
|
41
|
+
</div>
|
|
42
|
+
</button>
|
|
41
43
|
</div>
|
|
42
|
-
</
|
|
44
|
+
</div>
|
|
43
45
|
</form>);
|
|
44
46
|
};
|
|
45
47
|
export default ChatInput;
|
|
@@ -31,7 +31,7 @@ const ChatInput: React.FC = () => {
|
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<form onSubmit={handleSubmit} className="flex w-full items-center gap-2">
|
|
34
|
-
<div className="flex-1">
|
|
34
|
+
<div className="flex flex-1 justify-center gap-[10px] rounded-[10px] border-[1px] border-solid border-grayScale6 p-[4px]">
|
|
35
35
|
{/* 최초 높이 44 */}
|
|
36
36
|
{/*내용이 2줄 이상되면 입력창 높이도 키워져야합니다. 최대한 4줄까지만 보이도록 해주시고, 그 이상은 스크롤 될 수 있도록 해주시는 게 좋을 것 같습니다. max height 값을 72로 지정 부탁드립니다*/}
|
|
37
37
|
<Tiptap
|
|
@@ -40,19 +40,22 @@ const ChatInput: React.FC = () => {
|
|
|
40
40
|
onChange={setMessage}
|
|
41
41
|
onEnterKeyPress={handleEnter}
|
|
42
42
|
placeholder="메시지를 입력하세요..."
|
|
43
|
+
contentClassName={`!outline-none !border-[0px]`}
|
|
43
44
|
/>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
<div className={`flex flex-col justify-end`}>
|
|
46
|
+
<button
|
|
47
|
+
type="submit"
|
|
48
|
+
className={`flex h-10 w-10 items-center justify-center rounded-[8px] bg-drTalkBtnActive2 text-white ${
|
|
49
|
+
isLoading || !message.trim() ? 'cursor-not-allowed opacity-50' : ' bg-drTalkCrimson '
|
|
50
|
+
}`}
|
|
51
|
+
disabled={isLoading || !message.trim()}
|
|
52
|
+
>
|
|
53
|
+
<div className="flex h-9 w-9 items-center justify-center">
|
|
54
|
+
<SendIcon width={24} height={24} />
|
|
55
|
+
</div>
|
|
56
|
+
</button>
|
|
54
57
|
</div>
|
|
55
|
-
</
|
|
58
|
+
</div>
|
|
56
59
|
</form>
|
|
57
60
|
);
|
|
58
61
|
};
|
|
@@ -14,26 +14,25 @@ const ChatWidget = ({ isOpen, isMobile, onClose, hashValue, setHashValue }) => {
|
|
|
14
14
|
// 웹 모바일 ~480px
|
|
15
15
|
const webSmallWrapperCss = `
|
|
16
16
|
${isHash ? `` : `duration-300 ease-in-out`}
|
|
17
|
-
|
|
18
17
|
${isHash ? '' : isOpen ? 'translate-y-0 opacity-100' : 'translate-y-full opacity-0 pointer-events-none'}
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
fixed w-screen max-w-[100vw] z-[999998] rounded-none flex flex-col
|
|
19
|
+
bottom-0 right-0 h-[100dvh]
|
|
21
20
|
`;
|
|
22
21
|
// 해쉬 있을 경우는 여기서 중앙배치 css로
|
|
23
22
|
const webTbPCWrapperCss = `
|
|
24
|
-
|
|
23
|
+
${isHash ? '' : 'duration-300 ease-in-out'}
|
|
25
24
|
${isHash ? '' : isOpen ? 'translate-y-0 opacity-100' : 'translate-y-full opacity-0 pointer-events-none'}
|
|
26
|
-
|
|
25
|
+
${isHash
|
|
27
26
|
? `
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
`
|
|
27
|
+
xs:fixed xs:flex xs:justify-center xs:items-center xs:inset-0 xs:bg-white
|
|
28
|
+
xs:w-screen xs:h-[100dvh] xs:inset-0 xs:pt-[70px]
|
|
29
|
+
`
|
|
32
30
|
: `
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
h-[100dvh]
|
|
32
|
+
xs:bottom-[165px] xs:right-[30px] xs:max-w-[400px]
|
|
33
|
+
xs:max-h-[690px] xs:rounded-[30px]
|
|
34
|
+
lg:bottom-[110px]
|
|
35
|
+
`}
|
|
37
36
|
|
|
38
37
|
|
|
39
38
|
`;
|
|
@@ -56,16 +55,16 @@ const ChatWidget = ({ isOpen, isMobile, onClose, hashValue, setHashValue }) => {
|
|
|
56
55
|
|
|
57
56
|
<div className="relative ">
|
|
58
57
|
<div className={`
|
|
59
|
-
flex justify-end
|
|
60
58
|
${isMobile ? `${mobileWrapperCss}` : `${webSmallWrapperCss} ${webTbPCWrapperCss} `}
|
|
61
59
|
|
|
62
60
|
`}>
|
|
63
61
|
{/* 여기서 외각 스크롤 생김 */}
|
|
64
62
|
<div ref={containerRef} className={`
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
relative z-[999998]
|
|
64
|
+
flex h-full flex-col items-center justify-end
|
|
67
65
|
${isMobile ? `${innerMobileWrapperCss}` : `${innerWebSmallWrapperCss} ${innerWebTbPCWrapperCss}`}
|
|
68
66
|
`}>
|
|
67
|
+
{/* 여기서 보장해줘야하나? */}
|
|
69
68
|
<ChatHomeView hashValue={hashValue} isMobile={isMobile} isHash={isHash} onClose={onClose}/>
|
|
70
69
|
</div>
|
|
71
70
|
</div>
|
|
@@ -26,29 +26,28 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose, hash
|
|
|
26
26
|
// 웹 모바일 ~480px
|
|
27
27
|
const webSmallWrapperCss = `
|
|
28
28
|
${isHash ? `` : `duration-300 ease-in-out`}
|
|
29
|
-
|
|
30
29
|
${isHash ? '' : isOpen ? 'translate-y-0 opacity-100' : 'translate-y-full opacity-0 pointer-events-none'}
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
fixed w-screen max-w-[100vw] z-[999998] rounded-none flex flex-col
|
|
31
|
+
bottom-0 right-0 h-[100dvh]
|
|
33
32
|
`;
|
|
34
33
|
|
|
35
34
|
// 해쉬 있을 경우는 여기서 중앙배치 css로
|
|
36
35
|
const webTbPCWrapperCss = `
|
|
37
|
-
|
|
36
|
+
${isHash ? '' : 'duration-300 ease-in-out'}
|
|
38
37
|
${isHash ? '' : isOpen ? 'translate-y-0 opacity-100' : 'translate-y-full opacity-0 pointer-events-none'}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
${
|
|
39
|
+
isHash
|
|
40
|
+
? `
|
|
41
|
+
xs:fixed xs:flex xs:justify-center xs:items-center xs:inset-0 xs:bg-white
|
|
42
|
+
xs:w-screen xs:h-[100dvh] xs:inset-0 xs:pt-[70px]
|
|
43
|
+
`
|
|
44
|
+
: `
|
|
45
|
+
h-[100dvh]
|
|
46
|
+
xs:bottom-[165px] xs:right-[30px] xs:max-w-[400px]
|
|
47
|
+
xs:max-h-[690px] xs:rounded-[30px]
|
|
48
|
+
lg:bottom-[110px]
|
|
49
|
+
`
|
|
50
|
+
}
|
|
52
51
|
|
|
53
52
|
|
|
54
53
|
`;
|
|
@@ -79,7 +78,6 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose, hash
|
|
|
79
78
|
<div className="relative ">
|
|
80
79
|
<div
|
|
81
80
|
className={`
|
|
82
|
-
flex justify-end
|
|
83
81
|
${isMobile ? `${mobileWrapperCss}` : `${webSmallWrapperCss} ${webTbPCWrapperCss} `}
|
|
84
82
|
|
|
85
83
|
`}
|
|
@@ -88,11 +86,12 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose, hash
|
|
|
88
86
|
<div
|
|
89
87
|
ref={containerRef}
|
|
90
88
|
className={`
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
relative z-[999998]
|
|
90
|
+
flex h-full flex-col items-center justify-end
|
|
93
91
|
${isMobile ? `${innerMobileWrapperCss}` : `${innerWebSmallWrapperCss} ${innerWebTbPCWrapperCss}`}
|
|
94
92
|
`}
|
|
95
93
|
>
|
|
94
|
+
{/* 여기서 보장해줘야하나? */}
|
|
96
95
|
<ChatHomeView hashValue={hashValue} isMobile={isMobile} isHash={isHash} onClose={onClose} />
|
|
97
96
|
</div>
|
|
98
97
|
</div>
|
|
@@ -14,9 +14,15 @@ const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthen
|
|
|
14
14
|
checkScroll();
|
|
15
15
|
}, [historyLit]);
|
|
16
16
|
const hasHistories = historyLit.length > 0;
|
|
17
|
-
return (<div className={`
|
|
17
|
+
return (<div className={`
|
|
18
|
+
no-scrollbar relative w-full rounded-t-[30px]
|
|
19
|
+
${isMobile
|
|
20
|
+
? ` flex h-[calc(100dvh-64px)] flex-col items-center justify-start `
|
|
21
|
+
: 'flex flex-col items-center xs:h-[calc(100vh-165px-64px)] lg:h-[calc(100vh-110px-64px)] ' +
|
|
22
|
+
' xs:max-h-[626px] xs:min-h-[320px] '}
|
|
23
|
+
`}>
|
|
18
24
|
{/* 헤더 */}
|
|
19
|
-
<div className={`flex h-[56px] items-center justify-between border-b border-gray-200 p-[16px]`}>
|
|
25
|
+
<div className={`sub_title top-0 z-10 flex h-[56px] w-full items-center justify-between border-b border-gray-200 p-[16px]`}>
|
|
20
26
|
<button className="flex h-7 w-7 items-center justify-center" aria-label="이전" onClick={onBackClick}>
|
|
21
27
|
<PrevIcon width={28} height={28}/>
|
|
22
28
|
</button>
|
|
@@ -66,7 +72,7 @@ const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthen
|
|
|
66
72
|
</>)}
|
|
67
73
|
|
|
68
74
|
{/* 새 문의하기 버튼 - 항상 하단에 고정 */}
|
|
69
|
-
{isAuthenticated && (<div className="flex-shrink-0 border-t border-gray-100 bg-white p-4">
|
|
75
|
+
{isAuthenticated && (<div className="w-full flex-shrink-0 border-t border-gray-100 bg-white p-4">
|
|
70
76
|
<button className="flex w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white" onClick={onNewChatClick}>
|
|
71
77
|
새 문의하기
|
|
72
78
|
<SendIcon width={24} height={24}/>
|
|
@@ -46,9 +46,21 @@ const HistoryView: React.FC<HistoryViewProps> = ({
|
|
|
46
46
|
const hasHistories = historyLit.length > 0;
|
|
47
47
|
|
|
48
48
|
return (
|
|
49
|
-
<div
|
|
49
|
+
<div
|
|
50
|
+
className={`
|
|
51
|
+
no-scrollbar relative w-full rounded-t-[30px]
|
|
52
|
+
${
|
|
53
|
+
isMobile
|
|
54
|
+
? ` flex h-[calc(100dvh-64px)] flex-col items-center justify-start `
|
|
55
|
+
: 'flex flex-col items-center xs:h-[calc(100vh-165px-64px)] lg:h-[calc(100vh-110px-64px)] ' +
|
|
56
|
+
' xs:max-h-[626px] xs:min-h-[320px] '
|
|
57
|
+
}
|
|
58
|
+
`}
|
|
59
|
+
>
|
|
50
60
|
{/* 헤더 */}
|
|
51
|
-
<div
|
|
61
|
+
<div
|
|
62
|
+
className={`sub_title top-0 z-10 flex h-[56px] w-full items-center justify-between border-b border-gray-200 p-[16px]`}
|
|
63
|
+
>
|
|
52
64
|
<button className="flex h-7 w-7 items-center justify-center" aria-label="이전" onClick={onBackClick}>
|
|
53
65
|
<PrevIcon width={28} height={28} />
|
|
54
66
|
</button>
|
|
@@ -127,7 +139,7 @@ const HistoryView: React.FC<HistoryViewProps> = ({
|
|
|
127
139
|
|
|
128
140
|
{/* 새 문의하기 버튼 - 항상 하단에 고정 */}
|
|
129
141
|
{isAuthenticated && (
|
|
130
|
-
<div className="flex-shrink-0 border-t border-gray-100 bg-white p-4">
|
|
142
|
+
<div className="w-full flex-shrink-0 border-t border-gray-100 bg-white p-4">
|
|
131
143
|
<button
|
|
132
144
|
className="flex w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white"
|
|
133
145
|
onClick={onNewChatClick}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
3
|
import Image from 'next/image';
|
|
3
4
|
import TimeIcon from '../../asset/images/daeryuntalk/time.svg';
|
|
@@ -5,144 +6,124 @@ import DaeryunLogoIcon from '../../asset/images/daeryuntalk/daeryun-logo.svg';
|
|
|
5
6
|
import ShadowBox from './_ui/ShadowBox';
|
|
6
7
|
import SendIcon from '../../asset/images/daeryuntalk/send.svg';
|
|
7
8
|
import InfoIcon from '../../asset/images/daeryuntalk/info.svg';
|
|
8
|
-
|
|
9
|
-
import DaeryuntalkIntro from '../../asset/images/daeryuntalk/daeryuntalk-intro.png';
|
|
10
|
-
import DaeryuntalkHomeLogo from '../../asset/images/daeryuntalk/home_bg_logo.png';
|
|
9
|
+
import DaeryuntalkIntro from '../../asset/images/daeryuntalk/daeryuntalk_home_bg.png';
|
|
11
10
|
import CloseSvgIcon from '../../asset/images/daeryuntalk/close.svg';
|
|
12
11
|
import { useScrollShadow } from './_hooks/useScrollShadow';
|
|
13
12
|
import Button3 from './_ui/buttons/Button3';
|
|
14
13
|
const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClose, isHash }) => {
|
|
15
14
|
const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow();
|
|
16
|
-
const wrapperRef = useRef(null);
|
|
17
|
-
const [
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
const wrapperRef = useRef(null);
|
|
16
|
+
const [contentHeight, setContentHeight] = useState(210);
|
|
17
|
+
const currentHeightRef = useRef(210);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (isMobile)
|
|
20
|
+
return;
|
|
21
|
+
let animationFrame;
|
|
22
|
+
const animate = () => {
|
|
23
|
+
if (!wrapperRef.current)
|
|
24
|
+
return;
|
|
25
|
+
const { top } = wrapperRef.current.getBoundingClientRect();
|
|
26
|
+
const gap = top;
|
|
27
|
+
const current = currentHeightRef.current;
|
|
28
|
+
let target = current;
|
|
29
|
+
// 줄어드는 방향
|
|
30
|
+
if (gap <= 20) {
|
|
31
|
+
if (current > 140) {
|
|
32
|
+
target = 140;
|
|
33
|
+
}
|
|
34
|
+
else if (current > 80) {
|
|
35
|
+
target = 80;
|
|
36
|
+
}
|
|
27
37
|
}
|
|
28
|
-
//
|
|
38
|
+
// 늘어나는 방향
|
|
29
39
|
else {
|
|
30
|
-
if (
|
|
31
|
-
|
|
40
|
+
if (current < 140) {
|
|
41
|
+
target = 140;
|
|
32
42
|
}
|
|
33
|
-
if (
|
|
34
|
-
|
|
43
|
+
else if (current < 210) {
|
|
44
|
+
target = 210;
|
|
35
45
|
}
|
|
36
46
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
// window resize에도 반응
|
|
46
|
-
window.addEventListener('resize', updateDistance);
|
|
47
|
-
return () => {
|
|
48
|
-
resizeObserver.disconnect();
|
|
49
|
-
window.removeEventListener('resize', updateDistance);
|
|
47
|
+
if (current !== target) {
|
|
48
|
+
const diff = target - current;
|
|
49
|
+
const step = diff > 0 ? Math.min(diff, 2) : Math.max(diff, -4); // 줄일 땐 -4px씩, 늘릴 땐 +2px씩
|
|
50
|
+
const next = current + step;
|
|
51
|
+
currentHeightRef.current = next;
|
|
52
|
+
setContentHeight(next);
|
|
53
|
+
}
|
|
54
|
+
animationFrame = requestAnimationFrame(animate);
|
|
50
55
|
};
|
|
51
|
-
|
|
56
|
+
animationFrame = requestAnimationFrame(animate);
|
|
57
|
+
return () => cancelAnimationFrame(animationFrame);
|
|
58
|
+
}, [inquiryMainData]);
|
|
52
59
|
useEffect(() => {
|
|
53
60
|
checkScroll();
|
|
54
61
|
}, [inquiryMainData]);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
<header className={`
|
|
66
|
-
z-10
|
|
67
|
-
flex h-[56px] w-full justify-between px-[20px]
|
|
68
|
-
`}>
|
|
69
|
-
<div className={`
|
|
70
|
-
dr_talk_subtitle_small flex items-center gap-[2px] pt-[31.5px] text-drTalkGrayscale1
|
|
71
|
-
`}>
|
|
62
|
+
const backgroundImage = (inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.sleeve_image_url) || DaeryuntalkIntro;
|
|
63
|
+
return (<div ref={wrapperRef} className={`
|
|
64
|
+
no-scrollbar relative w-full rounded-t-[30px]
|
|
65
|
+
${isMobile
|
|
66
|
+
? 'flex h-[calc(100dvh-64px)] flex-col items-center justify-between '
|
|
67
|
+
: 'flex h-[100vh] flex-col items-center justify-between xs:h-[calc(100vh-165px-64px)] lg:h-[calc(100vh-110px-64px)] ' +
|
|
68
|
+
' xs:max-h-[626px] xs:min-h-[320px] '}
|
|
69
|
+
`}>
|
|
70
|
+
<header className="z-10 flex h-[56px] w-full justify-between rounded-t-[30px] px-[20px]">
|
|
71
|
+
<div className="dr_talk_subtitle_small flex items-center gap-[2px] pt-[31.5px] text-drTalkGrayscale1">
|
|
72
72
|
<TimeIcon width={20} height={20}/>
|
|
73
|
-
<span>24시간
|
|
73
|
+
<span>24시간 운영</span>
|
|
74
74
|
</div>
|
|
75
|
-
<div className={`${isHash ? 'pointer-events-none !opacity-0' : ''} ${isMobile ? 'block' : '
|
|
75
|
+
<div className={`${isHash ? 'pointer-events-none !opacity-0' : ''} ${isMobile ? 'block' : 'xs:pointer-events-none xs:!opacity-0'} py-[14px] text-drTalkGrayscale2 hover:cursor-pointer`} onClick={onClose}>
|
|
76
76
|
<CloseSvgIcon width={28} height={28}/>
|
|
77
77
|
</div>
|
|
78
78
|
</header>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
${isMobile ? `h-full max-h-[360px] w-full object-center will-change-transform ` : `w-full object-contain object-top will-change-transform`}`}/>
|
|
79
|
+
|
|
80
|
+
<div className="absolute left-0 top-0 z-0 h-full w-full overflow-hidden">
|
|
81
|
+
<Image src={backgroundImage} alt="대화 배경" fill className={`${isMobile
|
|
82
|
+
? 'h-full max-h-[360px] w-full object-center will-change-transform'
|
|
83
|
+
: 'w-full object-contain object-top will-change-transform'}`}/>
|
|
85
84
|
</div>
|
|
86
85
|
|
|
87
|
-
<div className={`
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<section className={`
|
|
96
|
-
flex flex-col rounded-[12px] bg-white px-[16px] py-[24px]
|
|
97
|
-
${isMobile ? `w-full` : ``}
|
|
98
|
-
`} style={{
|
|
99
|
-
boxShadow: '0px 4px 10px 0px #00000026'
|
|
100
|
-
}}>
|
|
101
|
-
<div className={`relative`}>
|
|
102
|
-
{/* 해당 높이가 먼저 줄어둘고 */}
|
|
103
|
-
<div ref={containerRef} className={`
|
|
104
|
-
no-scrollbar flex max-h-[210px] min-h-[80px] flex-col overflow-auto
|
|
105
|
-
`} style={{
|
|
106
|
-
height: `${clampHeight}px`
|
|
107
|
-
}}>
|
|
108
|
-
<div className={`flex items-center gap-[10px]`}>
|
|
109
|
-
{(inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_logo_image_url) ? (<Image src={inquiryMainData.channel_logo_image_url} alt="로고" width={32} height={32} className={''}/>) : (<DaeryunLogoIcon width={24} height={24} className="mr-2"/>)}
|
|
110
|
-
<h1 className={`dr_talk_title_small text-drTalkBlack`}>
|
|
86
|
+
<div className={`relative z-10 px-[20px] ${isMobile ? 'flex w-full justify-center' : 'flex h-full w-full flex-col justify-center'}`}>
|
|
87
|
+
<section className={`flex flex-col rounded-[12px] bg-white px-[16px] py-[24px] ${isMobile ? 'w-full' : ''}`} style={{ boxShadow: '0px 4px 10px 0px #00000026' }}>
|
|
88
|
+
{/* 해당 컴포넌트의 최상위 부모와 브라우저 상단과 닿았을 때 우선적으로 해당 부분의 높이가 먼저 줄어들게 하고 싶다*/}
|
|
89
|
+
<div className="relative">
|
|
90
|
+
<div ref={containerRef} className="no-scrollbar flex max-h-[210px] min-h-[80px] flex-col overflow-auto" style={{ maxHeight: `${contentHeight}px` }}>
|
|
91
|
+
<div className="flex items-center gap-[10px]">
|
|
92
|
+
{(inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_logo_image_url) ? (<Image src={inquiryMainData.channel_logo_image_url} alt="로고" width={32} height={32}/>) : (<DaeryunLogoIcon width={24} height={24} className="mr-2"/>)}
|
|
93
|
+
<h1 className="dr_talk_title_small text-drTalkBlack">
|
|
111
94
|
{(inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_name) || '법무법인(유한)대륜'}
|
|
112
95
|
</h1>
|
|
113
96
|
</div>
|
|
114
|
-
<div className=
|
|
115
|
-
|
|
116
|
-
{(inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.salutation) ||
|
|
97
|
+
<div className="dr_talk_body_medium2 relative ml-[42px] mr-[16px] mt-[16px] whitespace-pre-line">
|
|
98
|
+
{(inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.salutation) ||
|
|
117
99
|
`안녕하세요.
|
|
118
100
|
법무법인(유한)대륜입니다.
|
|
119
101
|
방문해 주셔서 감사합니다.\n
|
|
120
102
|
궁금한 점이나 도움이 필요하신 부분
|
|
121
103
|
말씀해 주시면 도와드리겠습니다.
|
|
122
104
|
6:00~24:00 외 시간에는 상담인력의 편성에 따라 순차적으로 응대를 도와드리고 있습니다.
|
|
123
|
-
|
|
124
|
-
</div>
|
|
105
|
+
`}
|
|
125
106
|
</div>
|
|
126
107
|
</div>
|
|
127
108
|
{isScroll && !isBottom && <ShadowBox />}
|
|
128
109
|
</div>
|
|
129
110
|
|
|
130
|
-
<Button3 onClick={handleStartChat} isDisabled={isLoading} className=
|
|
131
|
-
<div className=
|
|
111
|
+
<Button3 onClick={handleStartChat} isDisabled={isLoading} className="mt-[40px]">
|
|
112
|
+
<div className="flex items-center justify-center gap-[4px]">
|
|
132
113
|
<div>{isLoading ? '로딩 중...' : '문의하기'}</div>
|
|
133
114
|
{!isLoading && <SendIcon width={24} height={24}/>}
|
|
134
115
|
</div>
|
|
135
116
|
</Button3>
|
|
136
117
|
|
|
137
|
-
<div className=
|
|
118
|
+
<div className="flex items-center justify-center gap-[4px] pt-[20px]">
|
|
138
119
|
<InfoIcon width={20} height={20}/>
|
|
139
|
-
<span className=
|
|
120
|
+
<span className="dr_talk_body_small1 text-drTalkGrayscale2">
|
|
140
121
|
{(inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.answer_speed_message) || '빠르게 답변 받으실 수 있어요'}
|
|
141
122
|
</span>
|
|
142
123
|
</div>
|
|
143
124
|
</section>
|
|
144
125
|
</div>
|
|
145
|
-
{isMobile && <div
|
|
126
|
+
{isMobile && <div />}
|
|
146
127
|
</div>);
|
|
147
128
|
};
|
|
148
129
|
export default HomeView;
|