@daeryun/dr_components 0.8.68 → 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.
Files changed (34) hide show
  1. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  2. package/dist/components/Daeryuntalk/ChatConversation.jsx +54 -25
  3. package/dist/components/Daeryuntalk/ChatConversation.tsx +84 -42
  4. package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.jsx +1 -1
  5. package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.tsx +3 -1
  6. package/dist/components/Daeryuntalk/ChatHomeView.jsx +6 -4
  7. package/dist/components/Daeryuntalk/ChatHomeView.tsx +10 -5
  8. package/dist/components/Daeryuntalk/ChatInput.jsx +9 -7
  9. package/dist/components/Daeryuntalk/ChatInput.tsx +15 -12
  10. package/dist/components/Daeryuntalk/ChatWidget.jsx +15 -16
  11. package/dist/components/Daeryuntalk/ChatWidget.tsx +19 -20
  12. package/dist/components/Daeryuntalk/HistoryView.jsx +9 -3
  13. package/dist/components/Daeryuntalk/HistoryView.tsx +15 -3
  14. package/dist/components/Daeryuntalk/HomeView.jsx +73 -92
  15. package/dist/components/Daeryuntalk/HomeView.tsx +83 -103
  16. package/dist/components/Daeryuntalk/NavigationFooter.jsx +1 -1
  17. package/dist/components/Daeryuntalk/NavigationFooter.tsx +1 -1
  18. package/dist/components/Daeryuntalk/Tiptap/Tiptap.d.ts +1 -0
  19. package/dist/components/Daeryuntalk/Tiptap/Tiptap.jsx +3 -3
  20. package/dist/components/Daeryuntalk/Tiptap/Tiptap.tsx +4 -3
  21. package/dist/components/Daeryuntalk/ViewportHandler.d.ts +1 -1
  22. package/dist/components/Daeryuntalk/ViewportHandler.jsx +5 -23
  23. package/dist/components/Daeryuntalk/ViewportHandler.tsx +44 -30
  24. package/dist/components/Footer/IFooterTypes.js +4 -4
  25. package/dist/components/Footer/IFooterTypes.ts +4 -4
  26. package/dist/components/common/strength/index.js +5 -5
  27. package/dist/components/common/strength/index.ts +5 -5
  28. package/dist/components/common/system/index.jsx +1 -1
  29. package/dist/components/common/system/index.tsx +1 -1
  30. package/dist/components/page/Strength/StrengthIntro.jsx +1 -1
  31. package/dist/components/page/Strength/StrengthIntro.tsx +1 -1
  32. package/dist/styles/globals.css +46 -8
  33. package/dist/tsconfig.tsbuildinfo +1 -1
  34. package/package.json +1 -1
@@ -28,7 +28,9 @@ const ChatConversationHeader = ({
28
28
  }
29
29
  };
30
30
  return (
31
- <div className="flex items-center justify-between border-b border-gray-200 px-[24px] py-[14px]">
31
+ <div
32
+ className={`${isMobile ? 'sticky top-0 z-10 bg-white ' : ''} flex h-[56px] w-full items-center justify-between border-b border-gray-200 px-[16px]`}
33
+ >
32
34
  <button
33
35
  className="flex h-[28px] w-[28px] items-center justify-center"
34
36
  aria-label="이전"
@@ -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
- h-[100dvh] w-full rounded-[0px]
75
- xs:max-h-[690px] xs:w-[390px] xs:rounded-[30px]
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
- <div className="overflow-hidden border-2">{content}</div>
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
- h-[100dvh] w-full rounded-[0px]
131
- xs:max-h-[690px] xs:w-[390px] xs:rounded-[30px]
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 className="flex h-full flex-col ">
141
- <div className="overflow-hidden border-2">{content}</div>
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
- </div>
38
- <button type="submit" className={`flex h-10 w-10 items-center justify-center rounded-[8px] bg-[#2E385B] text-white ${isLoading || !message.trim() ? 'cursor-not-allowed opacity-50' : 'bg-[#AA1D36]'}`} disabled={isLoading || !message.trim()}>
39
- <div className="flex h-9 w-9 items-center justify-center">
40
- <SendIcon width={24} height={24}/>
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
- </button>
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
- </div>
45
- <button
46
- type="submit"
47
- className={`flex h-10 w-10 items-center justify-center rounded-[8px] bg-[#2E385B] text-white ${
48
- isLoading || !message.trim() ? 'cursor-not-allowed opacity-50' : 'bg-[#AA1D36]'
49
- }`}
50
- disabled={isLoading || !message.trim()}
51
- >
52
- <div className="flex h-9 w-9 items-center justify-center">
53
- <SendIcon width={24} height={24} />
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
- </button>
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
- fixed w-screen max-w-[100vw] z-[999998] rounded-none flex flex-col
20
- bottom-0 right-0 h-[100dvh]
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
- ${isHash ? '' : 'duration-300 ease-in-out'}
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
- ${isHash
25
+ ${isHash
27
26
  ? `
28
- xs:fixed xs:flex xs:justify-center xs:items-center xs:inset-0 xs:bg-white
29
- xs:w-screen xs:h-[100dvh] xs:inset-0 xs:pt-[70px]
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
- xs:bottom-[165px] xs:right-[30px] xs:max-w-[400px]
34
- xs:max-h-[calc(100vh-165px)] xs:rounded-[30px]
35
- lg:bottom-[110px] lg:max-h-[calc(100vh-110px)]
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
- no-scrollbar
66
- relative z-[999998] flex h-full flex-col items-center justify-end
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
- fixed w-screen max-w-[100vw] z-[999998] rounded-none flex flex-col
32
- bottom-0 right-0 h-[100dvh]
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
- ${isHash ? '' : 'duration-300 ease-in-out'}
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
- isHash
41
- ? `
42
- xs:fixed xs:flex xs:justify-center xs:items-center xs:inset-0 xs:bg-white
43
- xs:w-screen xs:h-[100dvh] xs:inset-0 xs:pt-[70px]
44
-
45
- `
46
- : `
47
- xs:bottom-[165px] xs:right-[30px] xs:max-w-[400px]
48
- xs:max-h-[calc(100vh-165px)] xs:rounded-[30px]
49
- lg:bottom-[110px] lg:max-h-[calc(100vh-110px)]
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
- no-scrollbar
92
- relative z-[999998] flex h-full flex-col items-center justify-end
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={`flex h-full flex-col`}>
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 className={`flex h-full flex-col`}>
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 className={`flex h-[56px] items-center justify-between border-b border-gray-200 p-[16px]`}>
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
- // import DaeryuntalkIntro from '../../asset/images/daeryuntalk/daeryuntalk_home_bg.png';
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 [wrapperHeight, setWrapperHeight] = useState(626);
18
- const [clampHeight, setClampHeight] = useState(210);
19
- const updateDistance = () => {
20
- if (wrapperRef.current) {
21
- const rect = wrapperRef.current.getBoundingClientRect();
22
- const distanceTop = rect.top;
23
- // 0이하면
24
- if (distanceTop < 0) {
25
- setClampHeight(210 + distanceTop);
26
- setWrapperHeight(626 + distanceTop);
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 (wrapperHeight !== 626) {
31
- setWrapperHeight(626);
40
+ if (current < 140) {
41
+ target = 140;
32
42
  }
33
- if (clampHeight !== 210) {
34
- setClampHeight(210);
43
+ else if (current < 210) {
44
+ target = 210;
35
45
  }
36
46
  }
37
- }
38
- };
39
- useEffect(() => {
40
- updateDistance(); // 초기 계산
41
- const resizeObserver = new ResizeObserver(updateDistance);
42
- if (wrapperRef.current) {
43
- resizeObserver.observe(wrapperRef.current);
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
- // 아직 커버이미지 url이 안나옴
56
- const backgroundImage = (inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.sleeve_image_url) ? inquiryMainData.sleeve_image_url : DaeryuntalkIntro;
57
- return (
58
- // 중간 부분에 min-h-[80px]이 되면 여기서 스크롤이 생겨야함
59
- <div ref={wrapperRef} className={`
60
- relative w-full
61
- ${isMobile ? `flex flex-col items-center justify-between` : `flex flex-col items-center `}
62
- `} style={{
63
- height: `${wrapperHeight}px`
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시간 운영{wrapperHeight}</span>
73
+ <span>24시간 운영</span>
74
74
  </div>
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}>
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
- <div>
80
- <Image src={DaeryuntalkHomeLogo} width={200} height={100} alt="헤더 로고" className={``}/>
81
- </div>
82
- <div className={'absolute left-0 top-0 z-0 h-full w-full overflow-hidden'}>
83
- <Image src={backgroundImage} alt="대화 배경" fill className={`
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
- relative z-10 px-[20px]
89
- ${isMobile
90
- ? `flex w-full justify-center `
91
- : `
92
- flex h-full w-full flex-col justify-center
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={`dr_talk_body_medium2 relative ml-[42px] mr-[16px] mt-[16px]`}>
115
- <div className={`whitespace-pre-line `}>
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={`mt-[40px]`}>
131
- <div className={`flex items-center justify-center gap-[4px]`}>
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={`flex items-center justify-center gap-[4px] pt-[20px]`}>
118
+ <div className="flex items-center justify-center gap-[4px] pt-[20px]">
138
119
  <InfoIcon width={20} height={20}/>
139
- <span className={`dr_talk_body_small1 text-drTalkGrayscale2 `}>
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></div>}
126
+ {isMobile && <div />}
146
127
  </div>);
147
128
  };
148
129
  export default HomeView;