File tree Expand file tree Collapse file tree 7 files changed +190
-9
lines changed
src/widgets/WebsiteLayoutWidgets Expand file tree Collapse file tree 7 files changed +190
-9
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,13 @@ import Image from 'next/image';
44import Link from 'next/link' ;
55import React from 'react' ;
66import { getDimension } from './utils' ;
7+ import { MainMenuBurger } from '@/widgets/WebsiteLayoutWidgets/MainMenuBurger' ;
78
89export function Logo ( ) {
910 const width = useWindowWidth ( ) ;
1011 const imgDim = getDimension ( width ) ;
1112 if ( width <= 1070 ) {
12- return < div > M </ div > ;
13+ return < MainMenuBurger / >;
1314 }
1415 return (
1516 < Link href = { '/3d_printing' } >
Original file line number Diff line number Diff line change 33 display : flex ;
44 justify-content : center ;
55 align-items : center ;
6+
7+ @media (max-width : 1070px ) {
8+ box-sizing : border-box ;
9+ font-size : 35px ;
10+ color : #e49e00 ;
11+ }
12+ @media (max-width : 630px ) {
13+ font-size : 30px ;
14+ }
15+ @media (max-width : 590px ) {
16+ font-size : 25px ;
17+ }
18+ @media (max-width : 530px ) {
19+ font-size : 20px ;
20+ }
621}
Original file line number Diff line number Diff line change 11'use client' ;
22import cn from 'classnames' ;
3- import { useRouter } from 'next/navigation' ;
4-
5- import s from './style.module.scss' ;
63import { MenuDrawer } from './ui/MenuDrawer' ;
74import { useCallback , useState } from 'react' ;
5+ import s from './style.module.scss' ;
86
97export const MainMenuBurger = ( ) => {
108 const [ open , setOpen ] = useState ( false ) ;
9+
1110 const handleOpenModal = ( ) => {
12- setOpen ( ( v ) => ! v ) ;
11+ setOpen ( ( ) => true ) ;
1312 } ;
1413 const handleCloseDrawer = useCallback ( ( ) => {
15- console . log ( 'on close' ) ;
16- //setOpen(false);
14+ setOpen ( false ) ;
1715 } , [ ] ) ;
18- console . log ( 'open' , open ) ;
16+
1917 return (
2018 < div className = { s . container } >
2119 < button
@@ -25,7 +23,7 @@ export const MainMenuBurger = () => {
2523 >
2624 < div > </ div >
2725 </ button >
28- < MenuDrawer open = { false } onCloseDrawer = { handleCloseDrawer } />
26+ < MenuDrawer open = { open } onCloseDrawer = { handleCloseDrawer } />
2927 </ div >
3028 ) ;
3129} ;
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import s from './style.module.scss' ;
3+ type DrawerCloseButtonProps = {
4+ handleCloseDrawer : ( ) => void ;
5+ } ;
6+ export function MainMenuDrawerCloseButton ( {
7+ handleCloseDrawer,
8+ } : DrawerCloseButtonProps ) {
9+ return (
10+ < button className = { s . btnContainer } onClick = { handleCloseDrawer } >
11+ < div className = { s . btnCross } />
12+ </ button >
13+ ) ;
14+ }
Original file line number Diff line number Diff line change 1+ .btn {
2+ & Container {
3+ all : unset ;
4+ height : auto ;
5+ width : auto ;
6+ border-radius : 8px ;
7+ display : flex ;
8+ flex-direction : row ;
9+ align-items : center ;
10+ justify-content : center ;
11+ box-sizing : border-box ;
12+ cursor : pointer ;
13+ }
14+ & Cross {
15+ color : #ebebeb ;
16+ width : 32px ;
17+ height : 32px ;
18+ position : relative ;
19+ & ::after {
20+ content : ' ' ;
21+ position : absolute ;
22+ width : 2px ;
23+ height : 32px ;
24+ top : 0px ;
25+ left : 15px ;
26+ background-color : #ebebeb ;
27+ transform : rotate (45deg );
28+ }
29+ & ::before {
30+ content : ' ' ;
31+ position : absolute ;
32+ width : 2px ;
33+ height : 32px ;
34+ top : 0px ;
35+ left : 15px ;
36+ background-color : #ebebeb ;
37+ transform : rotate (-45deg );
38+ }
39+ }
40+ }
Original file line number Diff line number Diff line change 1+ 'use client' ;
2+ import Drawer from '@mui/material/Drawer' ;
3+ import { useRouter , usePathname } from 'next/navigation' ;
4+ import React from 'react' ;
5+ import cn from 'classnames' ;
6+ import { menuItems } from '@/shared/constants/mainMenu' ;
7+ import { MainMenuDrawerCloseButton } from '../MainMenuCloseButton' ;
8+ import s from './style.module.scss' ;
9+
10+ type MenuDrawerProps = {
11+ open : boolean ;
12+ onCloseDrawer : ( ) => void ;
13+ } ;
14+ export const MenuDrawer : React . FC < MenuDrawerProps > = ( {
15+ open,
16+ onCloseDrawer,
17+ } ) => {
18+ const pathname = usePathname ( ) ;
19+ const router = useRouter ( ) ;
20+
21+ const handleClickLink = ( path : string ) => {
22+ router . push ( path ) ;
23+ onCloseDrawer ( ) ;
24+ } ;
25+ return (
26+ < Drawer
27+ onClose = { onCloseDrawer }
28+ slotProps = { {
29+ paper : {
30+ style : {
31+ backgroundColor : 'black' ,
32+ } ,
33+ } ,
34+ } }
35+ anchor = "left"
36+ open = { open }
37+ >
38+ < div className = { s . drawerContainer } >
39+ < div className = { s . drawerControlsContainer } >
40+ < MainMenuDrawerCloseButton handleCloseDrawer = { onCloseDrawer } />
41+ </ div >
42+ < div className = { s . drawerDataContainer } >
43+ { menuItems . map ( ( i ) => (
44+ < div key = { i . href } className = { s . menuItem } >
45+ < button
46+ className = { cn ( s . menuItemLabel , {
47+ [ s . menuItemLabelActive ] : pathname === i . href ,
48+ } ) }
49+ onClick = { ( ) => handleClickLink ( i . href ) }
50+ >
51+ { i . label }
52+ </ button >
53+ </ div >
54+ ) ) }
55+ </ div >
56+ </ div >
57+ </ Drawer >
58+ ) ;
59+ } ;
Original file line number Diff line number Diff line change 1+ @use ' sass:math' ;
2+ $WIDTH : 300px ;
3+
4+ .drawer {
5+ & ControlsContainer {
6+ width : 100% ;
7+ height : 40px ;
8+ display : flex ;
9+ flex-direction : row ;
10+ align-items : center ;
11+ justify-content : flex-end ;
12+ box-sizing : border-box ;
13+ padding-right : 5px ;
14+ }
15+ & DataContainer {
16+ display : flex ;
17+ flex-direction : column ;
18+ align-items : flex-start ;
19+ justify-content : flex-start ;
20+ gap : 30px ;
21+ }
22+ & Container {
23+ background-color : black ;
24+ width : $WIDTH ;
25+ height : auto ;
26+ & Loader {
27+ position : fixed ;
28+ top : 50% ;
29+ right : math .div ($WIDTH , 2 );
30+ }
31+ }
32+ }
33+
34+ .menuItem {
35+ width : 100% ;
36+ height : 40px ;
37+ box-sizing : border-box ;
38+ padding-left : 50px ;
39+ display : flex ;
40+ flex-direction : row ;
41+ align-items : center ;
42+ justify-content : flex-start ;
43+
44+ & Label {
45+ all : unset ;
46+ color : #ededed ;
47+ cursor : pointer ;
48+ font-weight : bold ;
49+ font-size : 20px ;
50+ & Active {
51+ color : #e49e00 ;
52+ }
53+ }
54+ }
You can’t perform that action at this time.
0 commit comments