Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
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
Vũ Hoàng Anh
canifa_note
Commits
fb3c17d0
Commit
fb3c17d0
authored
Mar 12, 2025
by
Johnny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update mobile header
parent
0dfcb1a7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
18 deletions
+16
-18
HomeSidebarDrawer.tsx
web/src/components/HomeSidebar/HomeSidebarDrawer.tsx
+2
-2
MobileHeader.tsx
web/src/components/MobileHeader.tsx
+1
-11
NavigationDrawer.tsx
web/src/components/NavigationDrawer.tsx
+13
-5
No files found.
web/src/components/HomeSidebar/HomeSidebarDrawer.tsx
View file @
fb3c17d0
import
{
Drawer
}
from
"@mui/joy"
;
import
{
Button
}
from
"@usememos/mui"
;
import
{
Search
Icon
}
from
"lucide-react"
;
import
{
Menu
Icon
}
from
"lucide-react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useLocation
}
from
"react-router-dom"
;
import
HomeSidebar
from
"./HomeSidebar"
;
...
...
@@ -24,7 +24,7 @@ const HomeSidebarDrawer = () => {
return
(
<>
<
Button
variant=
"plain"
className=
"!bg-transparent px-2"
onClick=
{
toggleDrawer
(
true
)
}
>
<
SearchIcon
className=
"w-5
h-auto dark:text-gray-400"
/>
<
MenuIcon
className=
"w-6
h-auto dark:text-gray-400"
/>
</
Button
>
<
Drawer
anchor=
"right"
size=
"sm"
open=
{
open
}
onClose=
{
toggleDrawer
(
false
)
}
>
<
div
className=
"w-full h-full bg-zinc-100 dark:bg-zinc-900"
>
...
...
web/src/components/MobileHeader.tsx
View file @
fb3c17d0
import
useWindowScroll
from
"react-use/lib/useWindowScroll"
;
import
useResponsiveWidth
from
"@/hooks/useResponsiveWidth"
;
import
{
workspaceStore
}
from
"@/store/v2"
;
import
{
cn
}
from
"@/utils"
;
import
NavigationDrawer
from
"./NavigationDrawer"
;
...
...
@@ -13,7 +12,6 @@ const MobileHeader = (props: Props) => {
const
{
className
,
children
}
=
props
;
const
{
sm
}
=
useResponsiveWidth
();
const
{
y
:
offsetTop
}
=
useWindowScroll
();
const
workspaceGeneralSetting
=
workspaceStore
.
state
.
generalSetting
;
return
(
<
div
...
...
@@ -23,15 +21,7 @@ const MobileHeader = (props: Props) => {
className
,
)
}
>
<
div
className=
"flex flex-row justify-start items-center mr-2 shrink-0 overflow-hidden"
>
{
!
sm
&&
<
NavigationDrawer
/>
}
<
span
className=
"font-bold text-lg leading-10 mr-1 text-ellipsis shrink-0 cursor-pointer overflow-hidden text-gray-700 dark:text-gray-300"
onDoubleClick=
{
()
=>
location
.
reload
()
}
>
{
workspaceGeneralSetting
.
customProfile
?.
title
||
"Memos"
}
</
span
>
</
div
>
<
div
className=
"flex flex-row justify-start items-center mr-2 shrink-0 overflow-hidden"
>
{
!
sm
&&
<
NavigationDrawer
/>
}
</
div
>
<
div
className=
"flex flex-row justify-end items-center"
>
{
children
}
</
div
>
</
div
>
);
...
...
web/src/components/NavigationDrawer.tsx
View file @
fb3c17d0
import
{
Drawer
}
from
"@mui/joy"
;
import
{
Button
}
from
"@usememos/mui"
;
import
{
MenuIcon
}
from
"lucide-react
"
;
import
{
observer
}
from
"mobx-react-lite
"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useLocation
}
from
"react-router-dom"
;
import
{
workspaceStore
}
from
"@/store/v2"
;
import
Navigation
from
"./Navigation"
;
import
UserAvatar
from
"./UserAvatar"
;
const
NavigationDrawer
=
()
=>
{
const
NavigationDrawer
=
observer
(
()
=>
{
const
location
=
useLocation
();
const
[
open
,
setOpen
]
=
useState
(
false
);
const
workspaceGeneralSetting
=
workspaceStore
.
state
.
generalSetting
;
const
title
=
workspaceGeneralSetting
.
customProfile
?.
title
||
"Memos"
;
const
avatarUrl
=
workspaceGeneralSetting
.
customProfile
?.
logoUrl
||
"/full-logo.webp"
;
useEffect
(()
=>
{
setOpen
(
false
);
...
...
@@ -23,8 +28,11 @@ const NavigationDrawer = () => {
return
(
<>
<
Button
variant=
"plain"
className=
"!bg-transparent px-2"
onClick=
{
toggleDrawer
(
true
)
}
>
<
MenuIcon
className=
"w-5 h-auto dark:text-gray-400"
/>
<
Button
variant=
"plain"
className=
"px-2"
onClick=
{
toggleDrawer
(
true
)
}
>
<
UserAvatar
className=
"shrink-0 w-6 h-6 rounded-md"
avatarUrl=
{
avatarUrl
}
/>
<
span
className=
"font-bold text-lg leading-10 ml-2 text-ellipsis shrink-0 cursor-pointer overflow-hidden text-gray-700 dark:text-gray-300"
>
{
title
}
</
span
>
</
Button
>
<
Drawer
anchor=
"left"
size=
"sm"
open=
{
open
}
onClose=
{
toggleDrawer
(
false
)
}
>
<
div
className=
"w-full h-full overflow-auto px-2 bg-zinc-100 dark:bg-zinc-900"
>
...
...
@@ -33,6 +41,6 @@ const NavigationDrawer = () => {
</
Drawer
>
</>
);
};
}
)
;
export
default
NavigationDrawer
;
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