Skip to content

Commit

Permalink
sarted working on a more sustainable solutions to show form data
Browse files Browse the repository at this point in the history
  • Loading branch information
Youllou committed May 22, 2024
1 parent 3d1c6ec commit 82823db
Show file tree
Hide file tree
Showing 4 changed files with 316 additions and 53 deletions.
6 changes: 5 additions & 1 deletion src/Components/Modal/Modal.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@

/* Styles de l'overlay */
.overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
display: flex;
justify-content: center;
align-items: center;
}

.overlay.active{
display: flex;
}

/* Styles de la carte */
.card {
Expand Down
8 changes: 4 additions & 4 deletions src/Components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ interface ModalProps{
text: string;
handleTextChange: (event: { target: { value: React.SetStateAction<string>;}; })=> void;
close: ()=>void;
toRef: React.MutableRefObject<HTMLDivElement|null>;
}

const Modal: React.FC<ModalProps>=({text, handleTextChange, close})=>{
const Modal: React.FC<ModalProps>=({text, handleTextChange, close, toRef})=>{
const [isEditing, setIsEditing] = useState(false); // Added state for edit mode

const handleOverlayTextChange = (event: React.ChangeEvent<HTMLTextAreaElement>)=>{
Expand All @@ -17,8 +18,7 @@ const Modal: React.FC<ModalProps>=({text, handleTextChange, close})=>{

const handleOverlayClick = (event: React.MouseEvent<HTMLElement>)=>{
const element = event!.target as HTMLElement
console.log(event);
if(element.className == "overlay"|| element.className == "close-icon"){
if(element.className == "overlay active"|| element.className == "close-icon"){
close();
};
};
Expand All @@ -28,7 +28,7 @@ const Modal: React.FC<ModalProps>=({text, handleTextChange, close})=>{
};

return(
<div className="overlay" onClick={handleOverlayClick}>
<div className="overlay" onClick={handleOverlayClick} ref={toRef}>
<div className="card">
<img src={closeIcon} alt="Fermer la carte" className="close-icon" onClick={handleOverlayClick} />
<div className="card-content">
Expand Down
13 changes: 11 additions & 2 deletions src/Pages/Form/Form.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,32 @@ textarea {
position: relative;
top: 40px;
right: 50px;
margin: -8.5%;
}

.data-section{
display: flex;
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 10px;
}

.data-section.active{
display: flex;
}

.input-container{
display: inline-flex;
display: none;
flex-direction: column;
align-items: baseline;
width: 300px;
}

.input-container.active{
display: inline-flex;
}

.input-container input{
width: 98%;
}
Expand Down
Loading

0 comments on commit 82823db

Please sign in to comment.