mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-07 22:10:21 +08:00
refactor(Inputbar): improve textarea height adjustment and update padding for better layout consistency
This commit is contained in:
parent
527740bf42
commit
daa89df479
@ -143,8 +143,9 @@ const Inputbar: FC = () => {
|
|||||||
if (textareaHeight && !force) {
|
if (textareaHeight && !force) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
textArea.style.height = 'auto'
|
if (textArea?.scrollHeight) {
|
||||||
textArea.style.height = textArea?.scrollHeight > 400 ? '400px' : `${textArea?.scrollHeight}px`
|
textArea.style.height = Math.min(textArea.scrollHeight, 400) + 'px'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[textareaHeight]
|
[textareaHeight]
|
||||||
@ -791,7 +792,7 @@ const Inputbar: FC = () => {
|
|||||||
ref={textareaRef}
|
ref={textareaRef}
|
||||||
style={{
|
style={{
|
||||||
fontSize,
|
fontSize,
|
||||||
minHeight: textareaHeight ? `${textareaHeight}px` : undefined
|
minHeight: textareaHeight ? `${textareaHeight}px` : '30px'
|
||||||
}}
|
}}
|
||||||
styles={{ textarea: TextareaStyle }}
|
styles={{ textarea: TextareaStyle }}
|
||||||
onFocus={(e: React.FocusEvent<HTMLTextAreaElement>) => {
|
onFocus={(e: React.FocusEvent<HTMLTextAreaElement>) => {
|
||||||
@ -924,7 +925,7 @@ const InputBarContainer = styled.div`
|
|||||||
|
|
||||||
const TextareaStyle: CSSProperties = {
|
const TextareaStyle: CSSProperties = {
|
||||||
paddingLeft: 0,
|
paddingLeft: 0,
|
||||||
padding: '6px 15px 8px' // 减小顶部padding
|
padding: '6px 15px 0px' // 减小顶部padding
|
||||||
}
|
}
|
||||||
|
|
||||||
const Textarea = styled(TextArea)`
|
const Textarea = styled(TextArea)`
|
||||||
@ -948,10 +949,8 @@ const Toolbar = styled.div`
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 0 8px;
|
padding: 5px 8px;
|
||||||
padding-bottom: 0;
|
height: 40px;
|
||||||
margin-bottom: 5px;
|
|
||||||
height: 30px;
|
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user