Skip to content

Commit c5cf416

Browse files
authored
feat(app): fix composer attachment fades (#38547)
1 parent 3dbce3d commit c5cf416

2 files changed

Lines changed: 55 additions & 4 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
@keyframes prompt-input-v2-attachments-fade-left {
2+
from {
3+
visibility: hidden;
4+
}
5+
to {
6+
visibility: visible;
7+
}
8+
}
9+
10+
@keyframes prompt-input-v2-attachments-fade-right {
11+
from {
12+
visibility: visible;
13+
}
14+
to {
15+
visibility: hidden;
16+
}
17+
}
18+
19+
[data-component="prompt-input-v2-attachments"] {
20+
timeline-scope: --prompt-input-v2-attachments-scroll;
21+
22+
[data-slot^="prompt-attachments-fade-"] {
23+
visibility: hidden;
24+
}
25+
}
26+
27+
@supports (animation-timeline: --prompt-input-v2-attachments-scroll) and
28+
(timeline-scope: --prompt-input-v2-attachments-scroll) {
29+
[data-component="prompt-input-v2-attachments"] [data-slot="prompt-attachments-scroll"] {
30+
scroll-timeline: --prompt-input-v2-attachments-scroll x;
31+
}
32+
33+
[data-component="prompt-input-v2-attachments"] [data-slot="prompt-attachments-fade-left"] {
34+
animation: prompt-input-v2-attachments-fade-left linear both;
35+
animation-timeline: --prompt-input-v2-attachments-scroll;
36+
animation-range: 0 0.1px;
37+
}
38+
39+
[data-component="prompt-input-v2-attachments"] [data-slot="prompt-attachments-fade-right"] {
40+
animation: prompt-input-v2-attachments-fade-right linear both;
41+
animation-timeline: --prompt-input-v2-attachments-scroll;
42+
animation-range: calc(100% - 1.1px) calc(100% - 1px);
43+
}
44+
}

packages/session-ui/src/v2/components/prompt-input/index.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import type {
2121
PromptInputV2Suggestion,
2222
} from "./types"
2323
import type { PromptInputV2Interaction, PromptInputV2SelectControl } from "./interaction"
24+
import "./attachments.css"
2425

2526
export type {
2627
PromptInputV2Attachment,
@@ -107,7 +108,7 @@ export function PromptInputV2(props: PromptInputV2Props) {
107108
<form
108109
data-component="prompt-input-v2"
109110
data-dock-border-underlay={props.borderUnderlay ? "v2" : undefined}
110-
class="group/prompt-input relative min-h-[96px] w-full rounded-xl bg-v2-background-bg-base"
111+
class="group/prompt-input relative min-h-[96px] w-full overflow-clip rounded-xl bg-v2-background-bg-base"
111112
classList={{
112113
"shadow-[var(--v2-elevation-raised)]": !props.borderUnderlay,
113114
"border border-v2-icon-icon-info border-dashed": state.drag === "active",
@@ -378,7 +379,7 @@ export function PromptInputV2Attachments(props: {
378379
}) {
379380
return (
380381
<Show when={props.attachments.length > 0 || (props.comments?.length ?? 0) > 0}>
381-
<div data-slot="prompt-attachments" class="relative">
382+
<div data-component="prompt-input-v2-attachments" data-slot="prompt-attachments" class="relative">
382383
<div
383384
data-slot="prompt-attachments-scroll"
384385
class="flex flex-nowrap gap-2 overflow-x-auto no-scrollbar px-2 pt-2 pb-1"
@@ -444,8 +445,14 @@ export function PromptInputV2Attachments(props: {
444445
)}
445446
</For>
446447
</div>
447-
<div class="pointer-events-none absolute inset-y-0 left-0 z-10 w-6 bg-[linear-gradient(to_right,var(--v2-background-bg-base),transparent)]" />
448-
<div class="pointer-events-none absolute inset-y-0 right-0 z-10 w-6 bg-[linear-gradient(to_left,var(--v2-background-bg-base),transparent)]" />
448+
<div
449+
data-slot="prompt-attachments-fade-left"
450+
class="pointer-events-none absolute inset-y-0 left-0 z-10 w-6 bg-[linear-gradient(to_right,var(--v2-background-bg-base),transparent)]"
451+
/>
452+
<div
453+
data-slot="prompt-attachments-fade-right"
454+
class="pointer-events-none absolute inset-y-0 right-0 z-10 w-6 bg-[linear-gradient(to_left,var(--v2-background-bg-base),transparent)]"
455+
/>
449456
</div>
450457
</Show>
451458
)

0 commit comments

Comments
 (0)