upd
This commit is contained in:
@@ -7,7 +7,7 @@ function ModalContainer() {
|
||||
return (
|
||||
<div
|
||||
// onClick={() => setModal(null)}
|
||||
className={`fixed p-8 top-0 left-0 w-full h-full flex justify-center items-center bg-black bg-opacity-80 overflow-auto transition-opacity`}
|
||||
className={`fixed p-8 top-0 left-0 z-10 w-full h-full flex justify-center items-center bg-black bg-opacity-80 overflow-auto transition-opacity`}
|
||||
>
|
||||
<div onClick={(e) => e.stopPropagation()} className="cursor-default">
|
||||
{modal}
|
||||
|
||||
@@ -28,7 +28,7 @@ function ProjectCard({
|
||||
<div
|
||||
className="group-hover:scale-110 transition-transform duration-500 absolute top-0 left-0 w-full h-full bg-cover bg-center bg-no-repeat"
|
||||
style={{
|
||||
backgroundImage: `url(${import.meta.env.VITE_API_URL}/api/upload/${image})`,
|
||||
backgroundImage: `url(${import.meta.env.VITE_API_URL}/upload/${image})`,
|
||||
}}
|
||||
></div>
|
||||
<div className="absolute top-0 left-0 w-full h-full bg-gradient-card"></div>
|
||||
|
||||
@@ -44,7 +44,7 @@ function CreateProjectModal() {
|
||||
|
||||
setProject((prev) => ({
|
||||
...prev,
|
||||
image: `${import.meta.env.VITE_API_URL}/api/${file}`,
|
||||
image: file,
|
||||
}));
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
@@ -143,7 +143,9 @@ function CreateProjectModal() {
|
||||
className="absolute opacity-0"
|
||||
onChange={handleChangeFile}
|
||||
/>
|
||||
<p>{file ? file.name : "Выберите изображение"}</p>
|
||||
<p className="truncate">
|
||||
{file ? file.name : "Выберите изображение"}
|
||||
</p>
|
||||
|
||||
{previewFile && <img src={previewFile} alt="" />}
|
||||
</label>
|
||||
|
||||
@@ -42,13 +42,13 @@ function EditProjectModal({ projectId }: EditProjectModalProps) {
|
||||
formData.append("file", file);
|
||||
|
||||
try {
|
||||
const { file: url }: { file: string } = await api
|
||||
const { file }: { file: string } = await api
|
||||
.post("upload", { body: formData })
|
||||
.json();
|
||||
|
||||
setProject((prev) => ({
|
||||
...prev,
|
||||
image: `${import.meta.env.VITE_API_URL}/api/${url}`,
|
||||
image: file,
|
||||
}));
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
@@ -161,12 +161,17 @@ function EditProjectModal({ projectId }: EditProjectModalProps) {
|
||||
className="absolute opacity-0"
|
||||
onChange={handleChangeFile}
|
||||
/>
|
||||
<p>{file ? file.name : "Выберите изображение"}</p>
|
||||
<p className="truncate">{file ? file.name : "Выберите изображение"}</p>
|
||||
|
||||
{previewFile ? (
|
||||
<img src={previewFile} alt="" />
|
||||
) : (
|
||||
project.image && <img src={project.image} alt="" />
|
||||
project.image && (
|
||||
<img
|
||||
src={`${import.meta.env.VITE_API_URL}/upload/${project.image}`}
|
||||
alt=""
|
||||
/>
|
||||
)
|
||||
)}
|
||||
</label>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user