Browse Source

feat: add question photo, file, and error toast components

master
parent
commit
0c4b7c12b2
  1. 8
      src/components/Componentes/error-toast.tsx
  2. 2
      src/components/Componentes/question-file.tsx
  3. 2
      src/components/Componentes/question-photo.tsx

8
src/components/Componentes/error-toast.tsx

@ -1,6 +1,7 @@
"use client"; "use client";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { createPortal } from "react-dom";
import { Ic } from "@/icons"; import { Ic } from "@/icons";
type ErrorToastProps = { type ErrorToastProps = {
@ -48,7 +49,9 @@ export default function ErrorToast({
} }
}; };
return (
if (typeof document === "undefined") return null;
return createPortal(
<div <div
className={[ className={[
"fixed top-3.5 left-1/2 z-[70] flex w-[calc(100%-32px)] max-w-[360px] -translate-x-1/2 items-start justify-between gap-3 rounded-[16px] bg-[#141414]/95 p-3.5 px-4 text-white shadow-[0_10px_30px_rgba(0,0,0,0.35)] backdrop-blur-md border border-white/5 border-t-[2.5px] transition-all duration-300 ease-out", "fixed top-3.5 left-1/2 z-[70] flex w-[calc(100%-32px)] max-w-[360px] -translate-x-1/2 items-start justify-between gap-3 rounded-[16px] bg-[#141414]/95 p-3.5 px-4 text-white shadow-[0_10px_30px_rgba(0,0,0,0.35)] backdrop-blur-md border border-white/5 border-t-[2.5px] transition-all duration-300 ease-out",
@ -83,7 +86,8 @@ export default function ErrorToast({
> >
<Ic name="close" className="size-5" /> <Ic name="close" className="size-5" />
</button> </button>
</div>
</div>,
document.body,
); );
} }

2
src/components/Componentes/question-file.tsx

@ -417,7 +417,7 @@ export function QuestionFile({
source: pickerSource as any, source: pickerSource as any,
picker_type: pickerType as any, picker_type: pickerType as any,
returnAs: "upload", returnAs: "upload",
uploadUrl: `${process.env.NEXT_PUBLIC_API_BASE_URL ?? ""}/upload-tmp-media/`,
uploadUrl: `${window.location.origin}/api/proxy?__proxyPath=/upload-tmp-media/`,
fieldName: "file", fieldName: "file",
allowedExtensions: extensions, allowedExtensions: extensions,
maxBytes: 10_485_760, // 10 MB maxBytes: 10_485_760, // 10 MB

2
src/components/Componentes/question-photo.tsx

@ -257,7 +257,7 @@ export function QuestionPhoto({
source: pickerSource as any, source: pickerSource as any,
picker_type: pickerType as any, picker_type: pickerType as any,
returnAs: "upload", returnAs: "upload",
uploadUrl: `${process.env.NEXT_PUBLIC_API_BASE_URL ?? ""}/upload-tmp-media/`,
uploadUrl: `${window.location.origin}/api/proxy?__proxyPath=/upload-tmp-media/`,
fieldName: "file", fieldName: "file",
allowedExtensions: allowedExtensions:
extensions.length > 0 ? extensions : ["jpg", "jpeg", "png", "webp"], extensions.length > 0 ? extensions : ["jpg", "jpeg", "png", "webp"],

Loading…
Cancel
Save