-
Notifications
You must be signed in to change notification settings - Fork 1
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 #101 from py-psychological-help/feature/main-page-…
…burger feat: add burger menu, fix accordion height
- Loading branch information
Showing
9 changed files
with
137 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,7 @@ | |
font-family: var(--font-family-main); | ||
background-color: #f2f2f2; | ||
} | ||
|
||
.main { | ||
position: relative; | ||
} |
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,60 @@ | ||
import { NavLink } from 'react-router-dom'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import clsx from 'clsx'; | ||
import cls from './BurgerMenu.module.scss'; | ||
import { burgerActions } from '../../slices/burgerSlice/burgerSlice'; | ||
|
||
const BurgerMenu = () => { | ||
const isLoggedIn = useSelector((state) => state.user.userData); | ||
const burger = useSelector((state) => state.burger); | ||
const dispatch = useDispatch(); | ||
|
||
return ( | ||
<nav className={clsx(cls.burger, { [cls.active]: burger.menuIsOpen })}> | ||
<ul className={cls.navLinks}> | ||
<li> | ||
<NavLink | ||
to="/#aboutSection" | ||
onClick={() => dispatch(burgerActions.setToggleMenu())} | ||
className={cls.navLink} | ||
> | ||
О проекте | ||
</NavLink> | ||
</li> | ||
<li> | ||
<NavLink | ||
to="/#howItWorksSection" | ||
className={cls.navLink} | ||
onClick={() => dispatch(burgerActions.setToggleMenu())} | ||
> | ||
Как это работает | ||
</NavLink> | ||
</li> | ||
<li> | ||
<NavLink | ||
to={isLoggedIn ? '/account-chat' : '/welcome'} | ||
className={cls.navLink} | ||
onClick={() => dispatch(burgerActions.setToggleMenu())} | ||
> | ||
Психологам | ||
</NavLink> | ||
</li> | ||
{!isLoggedIn && ( | ||
<li> | ||
<NavLink | ||
to="/#faqSection" | ||
className={cls.navLink} | ||
onClick={() => | ||
dispatch(burgerActions.setToggleMenu()) | ||
} | ||
> | ||
Вопросы | ||
</NavLink> | ||
</li> | ||
)} | ||
</ul> | ||
</nav> | ||
); | ||
}; | ||
|
||
export default BurgerMenu; |
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,36 @@ | ||
.burger { | ||
position: absolute; | ||
z-index: 5; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
background-color: #fff; | ||
transform: translateX(-100%); | ||
transition: transform 0.2s ease; | ||
} | ||
.active { | ||
transform: translateX(0); | ||
} | ||
|
||
.navLinks { | ||
margin-top: 50px; | ||
list-style: none; | ||
padding: 0; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
gap: 24px; | ||
font-weight: 500; | ||
font-size: 20px; | ||
line-height: 28px; | ||
} | ||
|
||
.navLink { | ||
text-decoration: none; | ||
color: #000; | ||
transition: color 0.2s ease; | ||
&:hover { | ||
color: var(--color-text-hover); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import Main from '../../components/Main/Main'; | ||
import BurgerMenu from '../../components/BurgerMenu/BurgerMenu'; | ||
|
||
const MainPage = () => { | ||
// Проверка стора | ||
// const user = useSelector((state) => state.user); | ||
|
||
return <Main />; | ||
return ( | ||
<> | ||
<Main /> | ||
<BurgerMenu /> | ||
</> | ||
); | ||
}; | ||
|
||
export default MainPage; |
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,18 @@ | ||
import { createSlice } from '@reduxjs/toolkit'; | ||
|
||
const initialState = { | ||
menuIsOpen: false, | ||
}; | ||
|
||
export const burgerSlice = createSlice({ | ||
name: 'burger', | ||
initialState, | ||
reducers: { | ||
setToggleMenu: (state) => { | ||
state.menuIsOpen = !state.menuIsOpen; | ||
}, | ||
}, | ||
}); | ||
|
||
export const { actions: burgerActions } = burgerSlice; | ||
export const { reducer: burgerReducer } = burgerSlice; |
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