Add scroll down to create event popup
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
dvirlabs 2026-04-14 16:52:03 +03:00
parent a067a92205
commit 2298143652
2 changed files with 31 additions and 5 deletions

View File

@ -5,9 +5,11 @@
right: 0; right: 0;
bottom: 0; bottom: 0;
display: flex; display: flex;
align-items: center; align-items: flex-start;
justify-content: center; justify-content: center;
z-index: 1000; z-index: 2000;
padding: 1.5rem 1rem;
overflow-y: auto;
} }
.event-form-overlay { .event-form-overlay {
@ -28,6 +30,8 @@
padding: 2rem; padding: 2rem;
max-width: 500px; max-width: 500px;
width: 90%; width: 90%;
max-height: calc(100vh - 3rem);
overflow-y: auto;
box-shadow: var(--shadow-heavy); box-shadow: var(--shadow-heavy);
} }
@ -130,8 +134,14 @@
} }
@media (max-width: 600px) { @media (max-width: 600px) {
.event-form-container {
padding: 0.75rem;
}
.event-form { .event-form {
padding: 1.5rem; padding: 1.5rem;
width: 100%;
max-height: calc(100vh - 1.5rem);
} }
.event-form h2 { .event-form h2 {

View File

@ -1,4 +1,4 @@
import { useState, useRef } from 'react' import { useEffect, useState, useRef } from 'react'
import { createEvent, uploadImage } from '../api/api' import { createEvent, uploadImage } from '../api/api'
import './EventForm.css' import './EventForm.css'
@ -46,6 +46,15 @@ function EventForm({ onEventCreated, onCancel }) {
const [error, setError] = useState('') const [error, setError] = useState('')
const fileInputRef = useRef(null) const fileInputRef = useRef(null)
useEffect(() => {
const previousOverflow = document.body.style.overflow
document.body.style.overflow = 'hidden'
return () => {
document.body.style.overflow = previousOverflow
}
}, [])
const handleChange = (e) => { const handleChange = (e) => {
const { name, value } = e.target const { name, value } = e.target
setFormData(prev => ({ setFormData(prev => ({
@ -94,8 +103,15 @@ function EventForm({ onEventCreated, onCancel }) {
return ( return (
<div className="event-form-container"> <div className="event-form-container">
<div className="event-form-overlay" onClick={onCancel}></div> <div
<div className="event-form"> className="event-form-overlay"
onMouseDown={(e) => {
e.preventDefault()
e.stopPropagation()
onCancel()
}}
></div>
<div className="event-form" onMouseDown={(e) => e.stopPropagation()}>
<h2>{he.createNewEvent}</h2> <h2>{he.createNewEvent}</h2>
{error && <div className="error-message">{error}</div>} {error && <div className="error-message">{error}</div>}