file preview styling: full width -> wrap
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import type { Base64ContentBlock } from "@langchain/core/messages";
|
import type { Base64ContentBlock } from "@langchain/core/messages";
|
||||||
import { MultimodalPreview } from "../ui/MultimodalPreview";
|
import { MultimodalPreview } from "./MultimodalPreview";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
interface ContentBlocksPreviewProps {
|
interface ContentBlocksPreviewProps {
|
||||||
|
|||||||
@@ -18,15 +18,6 @@ export const MultimodalPreview: React.FC<MultimodalPreviewProps> = ({
|
|||||||
className,
|
className,
|
||||||
size = "md",
|
size = "md",
|
||||||
}) => {
|
}) => {
|
||||||
// Sizing
|
|
||||||
const sizeMap = {
|
|
||||||
sm: "h-10 w-10 text-base",
|
|
||||||
md: "h-16 w-16 text-lg",
|
|
||||||
lg: "h-24 w-24 text-xl",
|
|
||||||
};
|
|
||||||
const iconSize: string =
|
|
||||||
typeof sizeMap[size] === "string" ? sizeMap[size] : sizeMap["md"];
|
|
||||||
|
|
||||||
// Image block
|
// Image block
|
||||||
if (
|
if (
|
||||||
block.type === "image" &&
|
block.type === "image" &&
|
||||||
@@ -72,28 +63,28 @@ export const MultimodalPreview: React.FC<MultimodalPreviewProps> = ({
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"relative flex items-center gap-2 rounded-md border bg-gray-100 px-3 py-2",
|
"relative flex items-start gap-2 rounded-md border bg-gray-100 px-3 py-2",
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<File
|
<div className="flex flex-shrink-0 flex-col items-start justify-start">
|
||||||
className={cn(
|
<File
|
||||||
"flex-shrink-0 text-teal-700",
|
className={cn(
|
||||||
size === "sm" ? "h-5 w-5" : "h-7 w-7",
|
"text-teal-700",
|
||||||
)}
|
size === "sm" ? "h-5 w-5" : "h-7 w-7",
|
||||||
/>
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<span
|
<span
|
||||||
className={cn(
|
className={cn("min-w-0 flex-1 text-sm break-all text-gray-800")}
|
||||||
"truncate text-sm text-gray-800",
|
style={{ wordBreak: "break-all", whiteSpace: "pre-wrap" }}
|
||||||
size === "sm" ? "max-w-[80px]" : "max-w-[160px]",
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
{String(filename)}
|
{String(filename)}
|
||||||
</span>
|
</span>
|
||||||
{removable && (
|
{removable && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="ml-2 rounded-full bg-gray-200 p-1 text-teal-700 hover:bg-gray-300"
|
className="ml-2 self-start rounded-full bg-gray-200 p-1 text-teal-700 hover:bg-gray-300"
|
||||||
onClick={onRemove}
|
onClick={onRemove}
|
||||||
aria-label="Remove PDF"
|
aria-label="Remove PDF"
|
||||||
>
|
>
|
||||||
@@ -5,7 +5,7 @@ import { getContentString } from "../utils";
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { Textarea } from "@/components/ui/textarea";
|
import { Textarea } from "@/components/ui/textarea";
|
||||||
import { BranchSwitcher, CommandBar } from "./shared";
|
import { BranchSwitcher, CommandBar } from "./shared";
|
||||||
import { MultimodalPreview } from "@/components/ui/MultimodalPreview";
|
import { MultimodalPreview } from "@/components/thread/MultimodalPreview";
|
||||||
import type { Base64ContentBlock } from "@langchain/core/messages";
|
import type { Base64ContentBlock } from "@langchain/core/messages";
|
||||||
|
|
||||||
function EditableContent({
|
function EditableContent({
|
||||||
|
|||||||
Reference in New Issue
Block a user