-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Карточку с персональным предложением - Возможность зумить и рассматривать фотографии - Модальное окно Изменил: - Карусель с фотографиями Подключил: - react-zoom-pan-pinch (для просмотра фотографий)
- Loading branch information
1 parent
652d725
commit 9ad7dd7
Showing
10 changed files
with
165 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React, {useState} from 'react'; | ||
import {FaArrowCircleRight} from 'react-icons/fa'; | ||
|
||
const PersonalityOrder = (props) => { | ||
|
||
const [message,setMessage] = useState({name:"",phone:"",date:"",time:"",text:""}); | ||
|
||
const sendMessage = (e)=>{ | ||
e.preventDefault(); | ||
if(message.name.length>128 || message.text.length > 1024){ | ||
alert("Слишком много символов в имене (>128) или в сообщении (>1024)"); | ||
return; | ||
} | ||
console.log(message); //Место вызова к серверу | ||
setMessage({name:"",phone:"",date:"",time:"",text:""}); | ||
alert("Сообщение отправлено"); | ||
} | ||
|
||
return ( | ||
<div className="container shadow d-grid align-content-center p-3 mt-3"> | ||
<h1 className="row mx-1 mb-2">{props?.title}</h1> | ||
<div className="row"> | ||
<form method="POST" className="d-grid "> | ||
<div className="row"> | ||
<div className="col-12 col-lg-6 mt-2"> | ||
<input className="form-control mt-1" value={message.name} type="text" maxLength="128" placeholder="Имя" onChange={(e)=>setMessage({...message,name:e.target.value})}/> | ||
<input className="form-control mt-1" value={message.phone} type="phone" placeholder="Телефон" onChange={(e)=>setMessage({...message,phone:e.target.value})}/> | ||
<div className="d-flex justify-content-between"> | ||
<input className="form-control mt-2 me-2" value={message.date} type="date" placeholder="дд.мм.гггг" onChange={(e)=>setMessage({...message,date:e.target.value})}/> | ||
<input className="form-control mt-2" value={message.time} type="time" placeholder="чч.мм" onChange={(e)=>setMessage({...message,time:e.target.value})}/> | ||
</div> | ||
</div> | ||
<div className="col-12 col-lg-6 mt-2 align-content-around"> | ||
<textarea cols="60" rows="5" className="form-control" value={message.text} maxLength="1024" placeholder="Сообщение" onChange={(e)=>setMessage({...message,text:e.target.value})}/> | ||
<button className="btn btn-success my-2 float-end w-50 text-start" onClick={(e)=>sendMessage(e)}> | ||
Отправить | ||
<FaArrowCircleRight className="float-end" size="1.5rem" color="white"/> | ||
</button> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PersonalityOrder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import {TransformWrapper, TransformComponent, useControls} from "react-zoom-pan-pinch"; | ||
import {FaSearchMinus, FaSearchPlus, FaTimes,FaHistory} from "react-icons/fa"; | ||
|
||
const Wrapper = ({children,setModalVisible}) => { | ||
|
||
const Controls = () => { | ||
const { zoomIn, zoomOut,resetTransform} = useControls(); | ||
return ( | ||
<div className="position-absolute top-0 end-0 z-3"> | ||
<div className=" d-flex justify-content-center"> | ||
<div className="col-4 m-0 p-0" onClick={()=>setModalVisible(false)}></div> | ||
<button className="btn bg-transparent px-2 mx-0" onClick={() => zoomIn()}><FaSearchPlus size="1.5rem" color="white"/></button> | ||
<button className="btn bg-transparent px-2 mx-0" onClick={() => zoomOut()}><FaSearchMinus size="1.5rem" color="white"/></button> | ||
<button className="btn bg-transparent px-2 mx-0" onClick={() => resetTransform()}><FaHistory size="1.5rem" color="white"/></button> | ||
<button className="btn bg-transparent px-2 mx-0" onClick={()=>setModalVisible(false)}> | ||
<FaTimes size="2rem" color="white"/> | ||
</button> | ||
<div className="col-4 m-0 p-0" onClick={()=>setModalVisible(false)}></div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
return ( | ||
<TransformWrapper> | ||
<Controls/> | ||
<TransformComponent> | ||
{children} | ||
</TransformComponent> | ||
</TransformWrapper> | ||
); | ||
}; | ||
|
||
export default Wrapper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
import style from './Modal.module.css'; | ||
|
||
const Modal = ({children,visible,setVisible}) => { | ||
|
||
const modalClass = []; | ||
if(visible)modalClass.push(style.active); | ||
|
||
return ( | ||
<div className={modalClass.join(' ')} onClick={()=>setVisible(false)}> | ||
<div className={style.content} onClick={(e)=>e.stopPropagation()}>{children}</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Modal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.active{ | ||
position: fixed; | ||
top:0px; | ||
left: 0px; | ||
right: 0px; | ||
bottom: 0px; | ||
background: rgba(0,0,0,0.75); | ||
z-index: 3; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
padding: 3rem; | ||
} | ||
|
||
.content{ | ||
display: grid; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters