Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Кнопка "Перейти в приют" #240

Merged
merged 1 commit into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/components/ProfileSheltersBlock/ProfileSheltersBlock.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React from 'react';
import React, { useContext } from 'react';
import { useNavigate } from 'react-router-dom';
import './ProfileSheltersBlock.scss';
import ShelterCard from '../ShelterCard/ShelterCard';
import Button from '../../ui/Button/Button';
import CurrentUserContext from '../../contexts/CurrentUserContext';

const ProfileSheltersBlock = ({ myShelters, sheltersTitle }) => {
const { own_shelter } = useContext(CurrentUserContext);
const navigate = useNavigate();

return (
<div className='profile-shelters'>
{myShelters && myShelters.length !== 0 &&
{myShelters && myShelters.length !== 0 && (
<div className='profile-shelters__container'>
<h3 className='profile-shelters__title standard-font standard-font_type_h3'>{sheltersTitle}</h3>
<div className='profile-shelters__shelters'>
Expand All @@ -31,12 +32,18 @@ const ProfileSheltersBlock = ({ myShelters, sheltersTitle }) => {
);
})}
</ul>
{myShelters && <Button onClick={
() => {return navigate('my-shelter');}
}>Перейти в приют</Button>}
{myShelters && (
<Button
onClick={() => {
return navigate(`/shelters/${own_shelter.id}/about`);
}}
>
Перейти в приют
</Button>
)}
</div>
</div>
}
)}
</div>
);
};
Expand Down
Loading