-
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.
Merge pull request #195 from Lapkipomoshi/dev
Merge dev into test
- Loading branch information
Showing
55 changed files
with
698 additions
and
243 deletions.
There are no files selected for viewing
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,104 @@ | ||
import React, { useState } from 'react'; | ||
import './Modal.scss'; | ||
import DeclarationInput from '../../ui/DeclarationInput/DeclarationInput'; | ||
import { Button } from '../../ui'; | ||
import PrivacyCheckbox from '../PrivacyCheckbox/PrivacyCheckbox'; | ||
import EscapeIcon from '../../images/EscapeIcon/EscapeIcon'; | ||
|
||
const Modal = ({ descrText, onClose, handleTakePet }) => { | ||
const createInputState = (initialValue = '', allowText = true) => { | ||
const [inputState, setInputState] = useState({ | ||
value: initialValue, | ||
onChange: (e) => { | ||
let newValue = e.target.value; | ||
if (!allowText) { | ||
newValue = newValue.replace(/\D/g, ''); | ||
} | ||
|
||
setInputState((prevState) => { | ||
return { | ||
...prevState, | ||
value: newValue, | ||
dirty: true, | ||
// invalidText: newValue.length >= 2 ? '' : 'Введите хотя бы 2 символа', | ||
}; | ||
}); | ||
}, | ||
onBlur: () => { | ||
// Здесь можно добавить дополнительную логику, если нужно | ||
}, | ||
dirty: false, | ||
invalidText: '', | ||
}); | ||
|
||
return inputState; | ||
}; | ||
|
||
const [isModalOpen, setIsModalOpen] = useState(true); | ||
const [isPrivacyChecked, setIsPrivacyChecked] = useState(false); | ||
|
||
const nameInputState = createInputState(); | ||
const phoneInputState = createInputState('', false); | ||
const emailInputState = createInputState(); | ||
|
||
const handleTakeHomeButtonClick = () => { | ||
setIsModalOpen(false); | ||
handleTakePet(); | ||
}; | ||
|
||
const isSubmitButtonEnabled = () => { | ||
return nameInputState.value.trim() !== '' && phoneInputState.value.trim() !== '' && emailInputState.value.trim() !== '' && isPrivacyChecked; | ||
}; | ||
|
||
return ( | ||
isModalOpen && ( | ||
<div className='modal-overlay'> | ||
<div className='wrapper'> | ||
{/* <EscapeIcon onClick={handleTakeHomeButtonClick} /> */} | ||
<EscapeIcon | ||
onClick={() => { | ||
setIsModalOpen(false); | ||
onClose(); // Добавьте вызов onClose, чтобы установить isApplicationSent в true при закрытии по иконке | ||
}} | ||
/> | ||
<div className='modal'> | ||
<div className='modal__title standard-font standard-font_type_h3'>Оставьте заявку и приют с вами свяжется</div> | ||
<div className='modal__descr standard-font standard-font_type_small'>{descrText}</div> | ||
<DeclarationInput caption='Имя' inputState={nameInputState} type='text' name='name' required showError={false} /> | ||
<DeclarationInput | ||
caption='Номер телефона' | ||
inputState={phoneInputState} | ||
type='tel' | ||
name='phone' | ||
placeholder='+7 (999) 999-99-99' | ||
required | ||
showError={false} | ||
/> | ||
<DeclarationInput | ||
caption='E-mail' | ||
inputState={emailInputState} | ||
type='email' | ||
name='email' | ||
placeholder='[email protected]' | ||
required | ||
showError={false} | ||
/> | ||
<PrivacyCheckbox | ||
isChecked={isPrivacyChecked} | ||
onChange={(isChecked) => { | ||
setIsPrivacyChecked(isChecked); | ||
}} | ||
/> | ||
</div> | ||
<div className='btn'> | ||
<Button theme='accent' type='button' onClick={handleTakeHomeButtonClick} disabled={!isSubmitButtonEnabled()}> | ||
Отправить заявку | ||
</Button> | ||
</div> | ||
</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,38 @@ | ||
.modal-overlay { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgba(0, 0, 0, 0.32); | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
z-index: 1000; | ||
} | ||
|
||
.wrapper { | ||
padding: 52px 32px; | ||
width: 482px; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 32px; | ||
background-color: white; | ||
border-radius: 30px; | ||
position: relative; | ||
} | ||
|
||
.modal { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
gap: 20px; | ||
|
||
&__title { | ||
color: var(--color-text-base); | ||
} | ||
|
||
&__descr { | ||
color: var(--color-text-additional); | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -2,7 +2,4 @@ | |
width: 92%; | ||
margin: 0 0 12px; | ||
padding: 0; | ||
font-size: 24px; | ||
line-height: 29px; | ||
font-weight: 500; | ||
} |
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
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,29 @@ | ||
import React from 'react'; | ||
import './EscapeIcon.scss'; | ||
|
||
const EscapeIcon = ({ onClick }) => { | ||
return ( | ||
<svg className='icon' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' onClick={onClick}> | ||
<path | ||
d={ | ||
'M7.76562 4.84358L16.0003 13.0782L24.1923 4.88624C24.3732 4.69364 24.5912 4.53957 ' + | ||
'24.8332 4.43326C25.0751 4.32695 25.336 4.2706 25.6003 4.26758C26.1661 4.26758 26.7087 ' + | ||
'4.49234 27.1088 4.89242C27.5089 5.29249 27.7336 5.83512 27.7336 6.40091C27.7386 6.66246 ' + | ||
'27.6901 6.92227 27.591 7.16439C27.492 7.40651 27.3445 7.62584 27.1576 7.80891L18.8589 ' + | ||
'16.0009L27.1576 24.2996C27.5092 24.6436 27.7154 25.1094 27.7336 25.6009C27.7336 26.1667 ' + | ||
'27.5089 26.7093 27.1088 27.1094C26.7087 27.5095 26.1661 27.7342 25.6003 27.7342C25.3284 ' + | ||
'27.7455 25.0571 27.7001 24.8037 27.601C24.5503 27.5018 24.3203 27.3511 24.1283 27.1582' + | ||
'L16.0003 18.9236L7.78695 27.1369C7.60669 27.3231 7.39135 27.4717 7.15335 27.5743C6.91535 ' + | ||
'27.6768 6.65941 27.7312 6.40028 27.7342C5.83449 27.7342 5.29186 27.5095 4.89179 27.1094' + | ||
'C4.49171 26.7093 4.26695 26.1667 4.26695 25.6009C4.26197 25.3394 4.3105 25.0796 4.40955 ' + | ||
'24.8374C4.5086 24.5953 4.65608 24.376 4.84295 24.1929L13.1416 16.0009L4.84295 7.70224C4.49134 ' + | ||
'7.35826 4.28517 6.89246 4.26695 6.40091C4.26695 5.83512 4.49171 5.29249 4.89179 4.89242C5.29186 ' + | ||
'4.49234 5.83449 4.26758 6.40028 4.26758C6.91228 4.27398 7.40295 4.48091 7.76562 4.84358Z' | ||
} | ||
fill='#111C2C' | ||
/> | ||
</svg> | ||
); | ||
}; | ||
|
||
export default EscapeIcon; |
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,8 @@ | ||
.icon { | ||
width: 32px; | ||
height: 32px; | ||
position: absolute; | ||
right: 17px; | ||
top: 15px; | ||
cursor: pointer; | ||
} |
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,7 @@ | ||
import slide1 from './main__banner.png'; | ||
import slide2 from './main__promo_position_left.jpg'; | ||
import slide3 from './main__promo_position_right.jpg'; | ||
import clockIcon from './icons/ic_clock.svg'; | ||
import locationIcon from './icons/ic_location.svg'; | ||
|
||
export { slide1, slide2, slide3, clockIcon, locationIcon }; |
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
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
Oops, something went wrong.