Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
Newspaper Frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lap nguyen
Newspaper Frontend
Commits
4d454d21
Commit
4d454d21
authored
Dec 25, 2022
by
Ken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add logo and sticky navbar
parent
2a97d85c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
130 additions
and
82 deletions
+130
-82
Header.scss
src/components/Header/Header.scss
+28
-5
HeaderLogo.tsx
src/components/Header/HeaderLogo.tsx
+19
-0
index.tsx
src/components/Header/index.tsx
+79
-76
index.tsx
src/index.tsx
+4
-1
No files found.
src/components/Header/Header.scss
View file @
4d454d21
@use
"styles/index"
as
*
;
@use
"styles/index"
as
*
;
.header
{
.header
{
&
-logo
{
width
:
40px
;
height
:
40px
;
cursor
:
pointer
;
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
display
:
block
;
}
@include
desktop
{
position
:
absolute
;
top
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
}
}
&
-toolbar
{
&
-toolbar
{
padding
:
0
!
important
;
padding
:
0
;
justify-content
:
center
;
justify-content
:
center
;
@include
desktop
{
@include
desktop
{
padding
:
0
20px
!
important
;
padding
:
0
20px
;
justify-content
:
flex-start
;
justify-content
:
flex-start
;
}
}
&
__
iconDrawer
{
&
__
tablet
{
display
:
none
!
important
;
display
:
none
;
@include
desktop
{
@include
desktop
{
display
:
inline-flex
!
important
;
display
:
block
;
}
.iconDrawer
{
}
}
}
}
...
...
src/components/Header/HeaderLogo.tsx
0 → 100644
View file @
4d454d21
import
{
Box
}
from
"@mui/material"
;
import
{
PageUrl
}
from
"configuration/enum"
;
import
React
from
"react"
;
import
{
useNavigate
}
from
"react-router-dom"
;
const
HeaderLogo
=
()
=>
{
const
navigate
=
useNavigate
();
return
(
<
Box
className=
"header-logo"
onClick=
{
()
=>
navigate
(
PageUrl
.
ROOT
)
}
>
<
img
src=
"https://meu-solutions.com/wp-content/uploads/2020/08/MeU-logo-newest-08-150.png"
alt=
"logo"
/>
</
Box
>
);
};
export
default
HeaderLogo
;
src/components/Header/index.tsx
View file @
4d454d21
...
@@ -4,8 +4,6 @@ import Box from "@mui/material/Box";
...
@@ -4,8 +4,6 @@ import Box from "@mui/material/Box";
import
IconButton
from
"@mui/material/IconButton"
;
import
IconButton
from
"@mui/material/IconButton"
;
import
MenuIcon
from
"@mui/icons-material/Menu"
;
import
MenuIcon
from
"@mui/icons-material/Menu"
;
import
Toolbar
from
"@mui/material/Toolbar"
;
import
Toolbar
from
"@mui/material/Toolbar"
;
import
Button
from
"@mui/material/Button"
;
import
HomeIcon
from
"@mui/icons-material/Home"
;
import
Sidenav
from
"../Sidenav"
;
import
Sidenav
from
"../Sidenav"
;
import
{
Typography
}
from
"@mui/material"
;
import
{
Typography
}
from
"@mui/material"
;
import
{
useAppDispatch
,
useAppSelector
}
from
"app/hooks"
;
import
{
useAppDispatch
,
useAppSelector
}
from
"app/hooks"
;
...
@@ -13,6 +11,8 @@ import { getCategories } from "./headerSlice";
...
@@ -13,6 +11,8 @@ import { getCategories } from "./headerSlice";
import
{
handleLoading
}
from
"app/globalSlice"
;
import
{
handleLoading
}
from
"app/globalSlice"
;
import
{
headerSelector
}
from
"app/selectors"
;
import
{
headerSelector
}
from
"app/selectors"
;
import
{
useNavigate
}
from
"react-router-dom"
;
import
{
useNavigate
}
from
"react-router-dom"
;
import
{
PageUrl
}
from
"configuration/enum"
;
import
HeaderLogo
from
"./HeaderLogo"
;
export
default
function
Header
()
{
export
default
function
Header
()
{
const
dispatch
=
useAppDispatch
();
const
dispatch
=
useAppDispatch
();
...
@@ -43,95 +43,98 @@ export default function Header() {
...
@@ -43,95 +43,98 @@ export default function Header() {
};
};
return
(
return
(
<
Box
sx=
{
{
display
:
"flex"
}
}
className=
"header"
>
<>
<
AppBar
<
AppBar
component=
"nav"
component=
"nav"
position=
"sticky"
position=
"sticky"
sx=
{
{
background
:
"
transparent
"
,
overflow
:
"hidden"
}
}
sx=
{
{
background
:
"
white
"
,
overflow
:
"hidden"
}
}
>
>
<
Toolbar
<
Box
className=
"header"
>
sx=
{
{
<
Toolbar
display
:
"flex"
,
sx=
{
{
alignItems
:
"center"
,
display
:
"flex"
,
color
:
"#000"
,
alignItems
:
"center"
,
}
}
color
:
"#000"
,
className=
"header-toolbar"
}
}
>
className=
"header-toolbar"
<
IconButton
color=
"inherit"
aria
-
label=
"open drawer"
edge=
"start"
onClick=
{
handleDrawerToggle
}
sx=
{
{
mr
:
2
}
}
className=
"header-toolbar__iconDrawer"
>
>
<
MenuIcon
/>
<
Box
className=
"header-toolbar__tablet"
>
</
IconButton
>
<
IconButton
<
Box
color=
"inherit"
sx=
{
{
gap
:
2
}
}
aria
-
label=
"open drawer"
ref=
{
headerRef
}
edge=
"start"
className=
"header-toolbar__navbar"
onClick=
{
handleDrawerToggle
}
>
sx=
{
{
mr
:
2
}
}
<
Button
sx=
{
{
padding
:
0
,
minWidth
:
"auto"
,
color
:
"#000"
}
}
>
className=
"iconDrawer"
<
HomeIcon
/>
>
</
Button
>
<
MenuIcon
/>
<
Box
</
IconButton
>
className=
"header-list"
<
HeaderLogo
/>
component=
"ul"
sx=
{
{
gap
:
2
,
margin
:
0
,
padding
:
0
,
listStyleType
:
"none"
,
alignItems
:
"center"
,
}
}
>
{
categoryData
.
map
((
item
)
=>
(
<
Box
onClick=
{
()
=>
navigate
(
item
.
link
)
}
component=
"li"
key=
{
item
.
link
}
sx=
{
{
color
:
"#000"
,
fontWeight
:
700
,
padding
:
0
,
minWidth
:
"auto"
,
cursor
:
"pointer"
,
}
}
className=
"header-list__item"
>
{
item
.
label
}
</
Box
>
))
}
</
Box
>
</
Box
>
<
Box
<
Box
sx=
{
{
sx=
{
{
gap
:
2
}
}
padding
:
0
,
ref=
{
headerRef
}
minWidth
:
"auto"
,
className=
"header-toolbar__navbar"
color
:
"#999"
,
display
:
"flex"
,
alignItems
:
"center"
,
justifyContent
:
"center"
,
cursor
:
"pointer"
,
}
}
onClick=
{
handleDrawerToggle
}
className=
"navbar-readAll"
>
>
<
Typography
<
HeaderLogo
/>
sx=
{
{
fontSize
:
13
,
marginRight
:
"5px"
,
fontWeight
:
700
}
}
<
Box
className=
"header-list"
component=
"ul"
sx=
{
{
gap
:
2
,
margin
:
0
,
padding
:
0
,
listStyleType
:
"none"
,
alignItems
:
"center"
,
}
}
>
{
categoryData
.
map
((
item
)
=>
(
<
Box
onClick=
{
()
=>
navigate
(
item
.
link
)
}
component=
"li"
key=
{
item
.
link
}
sx=
{
{
color
:
"#000"
,
fontWeight
:
700
,
padding
:
0
,
minWidth
:
"auto"
,
cursor
:
"pointer"
,
}
}
className=
"header-list__item"
>
{
item
.
label
}
</
Box
>
))
}
</
Box
>
<
Box
sx=
{
{
padding
:
0
,
minWidth
:
"auto"
,
color
:
"#999"
,
display
:
"flex"
,
alignItems
:
"center"
,
justifyContent
:
"center"
,
cursor
:
"pointer"
,
}
}
onClick=
{
handleDrawerToggle
}
className=
"navbar-readAll"
>
>
Tất cả
<
Typography
</
Typography
>
sx=
{
{
fontSize
:
13
,
marginRight
:
"5px"
,
fontWeight
:
700
}
}
<
MenuIcon
sx=
{
{
fontSize
:
17
}
}
/>
>
Tất cả
</
Typography
>
<
MenuIcon
sx=
{
{
fontSize
:
17
}
}
/>
</
Box
>
</
Box
>
</
Box
>
</
Box
>
</
Toolbar
>
</
Toolbar
>
</
Box
>
</
AppBar
>
</
AppBar
>
<
Sidenav
<
Sidenav
handleDrawerToggle=
{
handleDrawerToggle
}
handleDrawerToggle=
{
handleDrawerToggle
}
navItems=
{
categoryData
}
navItems=
{
categoryData
}
mobileOpen=
{
mobileOpen
}
mobileOpen=
{
mobileOpen
}
/>
/>
</
Box
>
</>
);
);
}
}
src/index.tsx
View file @
4d454d21
import
{
StyledEngineProvider
}
from
"@mui/material"
;
import
React
from
"react"
;
import
React
from
"react"
;
import
ReactDOM
from
"react-dom/client"
;
import
ReactDOM
from
"react-dom/client"
;
import
{
Provider
}
from
"react-redux/es/exports"
;
import
{
Provider
}
from
"react-redux/es/exports"
;
...
@@ -10,7 +11,9 @@ const root = ReactDOM.createRoot(
...
@@ -10,7 +11,9 @@ const root = ReactDOM.createRoot(
);
);
root
.
render
(
root
.
render
(
<
Provider
store=
{
store
}
>
<
Provider
store=
{
store
}
>
<
Routers
/>
<
StyledEngineProvider
injectFirst
>
<
Routers
/>
</
StyledEngineProvider
>
</
Provider
>
</
Provider
>
);
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment