Skip to content

Commit

Permalink
Merge pull request #134 from Lapkipomoshi/dev
Browse files Browse the repository at this point in the history
test-deploy: june-1
  • Loading branch information
Artyom774 committed Jul 6, 2023
2 parents ad9b37e + 2b4fdb8 commit 3a2cec8
Show file tree
Hide file tree
Showing 57 changed files with 885 additions and 339 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"class-methods-use-this": "warn",
"prefer-promise-reject-errors": "warn",
"react/jsx-one-expression-per-line": "off"
"react/jsx-one-expression-per-line": "off",
"camelcase": [1, { "properties": "never" }]
}
}
41 changes: 35 additions & 6 deletions src/components/InfoTooltip/InfoTooltip.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
import React from 'react';
import './InfoTooltip.css';
import React, { useEffect, useRef } from 'react';
import './InfoTooltip.scss';

const InfoTooltip = ({ isOpen, image, message, onClose }) => {
const popup = useRef(null);

const handleOverlayClose = (e) => {
const infoPopup = e.target.classList;
if (infoPopup.contains('popup_opened') || infoPopup.contains('popup__button-close')) {
onClose();
}
};

const handleEscClose = (e) => {
if (e.key === 'Escape') {
onClose();
}
};

useEffect(() => {
document.addEventListener('keydown', handleEscClose);
document.addEventListener('click', handleOverlayClose);
return () => {
document.removeEventListener('keydown', handleEscClose);
document.removeEventListener('click', handleOverlayClose);
};
}, []);

function InfoTooltip({
isOpen, image, message,
}) {
return (
<div
className={`popup ${isOpen && 'popup_opened'}`}
ref={popup}
>
<div className='popup__container'>
<img
Expand All @@ -16,9 +39,15 @@ function InfoTooltip({
/>

<p className='popup__text'>{message}</p>

<button
type='button'
className='popup__button-close'
onClick={onClose}
/>
</div>
</div>
);
}
};

export default InfoTooltip;
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
$images-path: '../../images';

.popup {
width: 100%;
height: 100%;
Expand All @@ -11,13 +13,13 @@
visibility: hidden;
opacity: 0;
transition: visibility 0.5s, opacity 0.5s ease-in-out;
}

.popup_opened {
display: flex;
visibility: visible;
opacity: 1;
z-index: 2;
&_opened {
display: flex;
visibility: visible;
opacity: 1;
z-index: 2;
}
}

.popup__container {
Expand All @@ -39,11 +41,31 @@
}

.popup__text {
font-family: 'Montserrat Alternates', Arial, sans-serif;
font-family: var(--font-family-title);
font-style: normal;
font-weight: 600;
font-size: 40px;
line-height: 49px;
text-align: center;
color: var(--color-text-base);
}

.popup__button-close {
background-image: url('#{$images-path}/icons/ic_button_close.svg');
background-size: contain;
border: none;
width: 36px;
height: 36px;
background-color: rgba(0, 0, 0, 0);
padding: 0;
margin: 0;
transition: opacity 0.2s;
position: absolute;
top: 36px;
right: 36px;

&:hover {
opacity: 0.6;
cursor: pointer;
}
}
2 changes: 1 addition & 1 deletion src/components/ProfileContainer/ProfileContainer.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import './ProfileContainer.css';
import './ProfileContainer.scss';
import Dog from '../../images/dog.png';
import VioletBall from '../Ball/VioletBall/VioletBall';
import OrangeBall from '../Ball/OrangeBall/OrangeBall';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
background-color: var(--color-background-base);
padding: 44px 132px 199px;
position: relative;

&_edit-profile {
padding-bottom: 85px;
}

&_sign-out {
min-height: 375px;
}
}

.profile-container__image {
Expand All @@ -10,12 +18,5 @@
position: absolute;
right: 132px;
top: 137px;
}

.profile-container_edit-profile {
padding-bottom: 85px;
}

.profile-container_sign-out {
min-height: 375px;
z-index: 0;
}
40 changes: 40 additions & 0 deletions src/components/ProfileSheltersBlock/ProfileSheltersBlock.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from 'react';
import './ProfileSheltersBlock.scss';
import ShelterCard from '../ShelterCard/ShelterCard';
import Button from '../../ui/Button/Button';

const ProfileSheltersBlock = ({ shelters, sheltersTitle, owner }) => {
return (
<div className='profile-shelters'>
{shelters && shelters.length !== 0 &&
<div className='profile-shelters__container'>
<h3 className='profile-shelters__title standard-font standard-font_type_h3'>{sheltersTitle}</h3>

<ul className='profile-shelters__shelters-container'>
{shelters.map((shelter) => {
return (
<li key={shelter.id}>
<ShelterCard
id={shelter.id}
name={shelter.name}
address={shelter.address}
workingFromHour={shelter.working_from_hour}
workingToHour={shelter.working_to_hour}
workingHours={shelter.working_hours}
logo={shelter.logo}
profileImage={shelter.profile_image}
/>
</li>
);
})}
</ul>

{owner && <Button link to='/'>Перейти в приют</Button>}

</div>
}
</div>
);
};

export default ProfileSheltersBlock;
21 changes: 21 additions & 0 deletions src/components/ProfileSheltersBlock/ProfileSheltersBlock.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.profile-shelters__container {
display: flex;
flex-direction: column;
margin-bottom: 44px;
}

.profile-shelters__title {
margin-top: 0;
margin-bottom: 28px;
}

.profile-shelters__shelters-container {
display: flex;
flex-direction: row;
column-gap: 24px;
margin-top: 0;
margin-bottom: 28px;
padding: 0;
z-index: 1;
overflow: hidden;
}
2 changes: 1 addition & 1 deletion src/components/SignUpBlock/SignUpBlock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Link } from 'react-router-dom';
const SignUpBlock = ({ className }) => {
return (
<div className={`signup-block signup-block_${className}`}>
<p className='signup-block__text standard-font standard-font_type_base'>Нет аккаунта?</p>
<p className='signup-block__text standard-font standard-font_type_base'>Нет аккаунта?&nbsp;</p>
<Link className='signup-block__link standard-font standard-font_type_base' to='/sign-up'>Зарегистрироваться</Link>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/components/SignUpBlock/SignUpBlock.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

@media (min-width: 750px) {
margin-top: 20px;
flex-direction: row;
}
}

Expand Down
29 changes: 15 additions & 14 deletions src/components/UserContainer/UserContainer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,25 @@
flex-direction: row;
padding: 24px 16px 38px;

@media (min-width: 750px) {
padding: 60px 45px 120px 14px;
}

@media (min-width: 1440px) {
padding-left: 134px;
padding-top: 62px;
padding-bottom: 147px;

&_register {
padding-right: 132px;
}
}

&_login {
padding-bottom: 142px;

@media (min-width: 1440px) {
padding-bottom: 213px;
padding-right: 169px;
}
}
Expand All @@ -20,20 +35,6 @@
padding-right: 132px;
padding-bottom: 188px;
}

@media (min-width: 750px) {
padding: 60px 45px 120px 14px;
}

@media (min-width: 1440px) {
padding-left: 134px;
padding-top: 62px;
padding-bottom: 147px;

&_register {
padding-right: 132px;
}
}
}

.user-container__container {
Expand Down
3 changes: 3 additions & 0 deletions src/images/add-item-plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/images/icons/ic_button_close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions src/modules/ShelterOwnerProfile/ShelterOwnerProfile.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React, { useContext } from 'react';
import './ShelterOwnerProfile.scss';
import CurrentUserContext from '../../contexts/CurrentUserContext';
import ProfileSheltersBlock from '../../components/ProfileSheltersBlock/ProfileSheltersBlock';

const ShelterOwnerProfile = () => {
const currentUser = useContext(CurrentUserContext);
const { subscription_shelter } = currentUser;

return (
<div>
<ProfileSheltersBlock
shelters={subscription_shelter}
sheltersTitle='Ваши приюты'
owner
/>

<ProfileSheltersBlock
shelters={subscription_shelter}
sheltersTitle='Ваши любимые приюты'
/>
</div>
);
};

export default ShelterOwnerProfile;
Empty file.
33 changes: 33 additions & 0 deletions src/modules/UserProfile/UserProfile.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React, { useContext } from 'react';
import './UserProfile.scss';
import CurrentUserContext from '../../contexts/CurrentUserContext';
import ProfileSheltersBlock from '../../components/ProfileSheltersBlock/ProfileSheltersBlock';

const UserProfile = () => {
const currentUser = useContext(CurrentUserContext);
const { donations_sum, subscription_shelter } = currentUser;

return (
<div>
<div className='user-profile__donation'>
<p className='user-profile__donation-text standard-font standard-font_type_body'>Вы пожертвовали приютам за всё время:</p>
<div className='user-profile__donation-sum'>
{ donations_sum }
<p className='user-profile__donation-rubles'>рублей</p>
</div>
</div>

<ProfileSheltersBlock
shelters={subscription_shelter}
sheltersTitle='Ваши любимые приюты'
/>

<ProfileSheltersBlock
shelters={subscription_shelter}
sheltersTitle='Приюты, которым вы помогли'
/>
</div>
);
};

export default UserProfile;
34 changes: 34 additions & 0 deletions src/modules/UserProfile/UserProfile.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.user-profile__donation {
display: flex;
align-items: center;
margin-bottom: 60px;
}

.user-profile__donation-text {
margin-right: 16px;
}

.user-profile__donation-sum {
border-width: 0 2px;
border-style: solid;
border-color: #FF852E;
border-radius: 8px;
padding-left: 20px;
padding-right: 20px;
min-height: 52px;
max-width: 82px;
font-weight: 500;
font-size: 20px;
line-height: 24px;
color: #FF852E;
text-align: center;
margin: 0;
}

.user-profile__donation-rubles {
margin: 0;
font-weight: 400;
font-size: 18px;
line-height: 28px;
color: #FF852E;
}
Loading

0 comments on commit 3a2cec8

Please sign in to comment.