fix: open file in new tab (#4697)

This commit is contained in:
Dhruwang Jariwala
2025-01-31 12:38:02 +05:30
committed by GitHub
parent 06e00f3066
commit 2bc23594ad
2 changed files with 3 additions and 10 deletions

View File

@@ -77,12 +77,7 @@ export const FileUploadSummary = ({
return (
<div className="relative m-2 rounded-lg bg-slate-200" key={fileUrl}>
<a
href={fileUrl as string}
key={index}
download={fileName}
target="_blank"
rel="noopener noreferrer">
<a href={fileUrl} key={index} target="_blank" rel="noopener noreferrer">
<div className="absolute right-0 top-0 m-2">
<div className="flex h-8 w-8 items-center justify-center rounded-lg bg-slate-50 hover:bg-white">
<DownloadIcon className="h-6 text-slate-500" />

View File

@@ -7,23 +7,21 @@ import { getOriginalFileNameFromUrl } from "@formbricks/lib/storage/utils";
interface FileUploadResponseProps {
selected: string[];
}
export const FileUploadResponse = ({ selected }: FileUploadResponseProps) => {
const t = useTranslations();
if (selected.length === 0) {
return <div className="font-semibold text-slate-500">{t("common.skipped")}</div>;
}
return (
<div className="">
{selected.map((fileUrl, index) => {
const fileName = getOriginalFileNameFromUrl(fileUrl);
return (
<a
href={fileUrl}
key={index}
download={fileName}
target="_blank"
rel="noopener noreferrer"
className="group flex max-w-60 items-center justify-center rounded-lg bg-slate-200 px-2 py-1 hover:bg-slate-300">
<p className="w-full overflow-hidden overflow-ellipsis whitespace-nowrap text-center text-slate-700 group-hover:text-slate-800">
{fileName ? fileName : "Download"}