mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 12:43:16 +00:00
feat(ui): soften long-message scroll indicator to a fade (#1531)
Replace the hard inset box-shadow scroll indicators on long user messages with a mask-image gradient so the text softly fades at the scroll edges instead of showing a heavy shadow. Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
This commit is contained in:
parent
3ce09c0864
commit
147a393ed0
1 changed files with 12 additions and 7 deletions
|
|
@ -24,12 +24,14 @@ export function UserMessage({ message }: { message: Message }) {
|
|||
updateScrollIndicators();
|
||||
}, [text, updateScrollIndicators]);
|
||||
|
||||
const textEdgeShadows = [
|
||||
scrolledFromTop ? "inset 0 12px 10px -10px rgba(42, 63, 95, 0.95)" : "",
|
||||
scrolledFromBottom ? "inset 0 -12px 10px -10px rgba(42, 63, 95, 0.95)" : "",
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(", ");
|
||||
const topStop = scrolledFromTop ? "transparent 0, black 24px" : "black 0";
|
||||
const bottomStop = scrolledFromBottom
|
||||
? "black calc(100% - 24px), transparent 100%"
|
||||
: "black 100%";
|
||||
const textEdgeMask =
|
||||
scrolledFromTop || scrolledFromBottom
|
||||
? `linear-gradient(to bottom, ${topStop}, ${bottomStop})`
|
||||
: undefined;
|
||||
|
||||
return (
|
||||
<div className="flex justify-end my-4">
|
||||
|
|
@ -54,7 +56,10 @@ export function UserMessage({ message }: { message: Message }) {
|
|||
ref={textRef}
|
||||
onScroll={updateScrollIndicators}
|
||||
className="max-h-[250px] overflow-auto px-3 py-1.5 text-[color:var(--ui-text)] text-[13px] whitespace-pre-wrap break-words"
|
||||
style={{ boxShadow: textEdgeShadows || "none" }}
|
||||
style={{
|
||||
maskImage: textEdgeMask,
|
||||
WebkitMaskImage: textEdgeMask,
|
||||
}}
|
||||
>
|
||||
{text}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue