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
65a34ee4
Commit
65a34ee4
authored
Nov 08, 2023
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update home sidebar
parent
5ff0234c
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
50 additions
and
82 deletions
+50
-82
Header.tsx
web/src/components/Header.tsx
+1
-1
HomeSidebar.tsx
web/src/components/HomeSidebar.tsx
+7
-27
HomeSidebarDrawer.tsx
web/src/components/HomeSidebarDrawer.tsx
+37
-0
MobileHeader.tsx
web/src/components/MobileHeader.tsx
+2
-4
Home.tsx
web/src/pages/Home.tsx
+3
-1
index.ts
web/src/store/index.ts
+0
-2
index.ts
web/src/store/module/index.ts
+0
-1
layout.ts
web/src/store/module/layout.ts
+0
-15
layout.ts
web/src/store/reducer/layout.ts
+0
-24
layout.ts
web/src/utils/layout.ts
+0
-7
No files found.
web/src/components/Header.tsx
View file @
65a34ee4
...
@@ -98,7 +98,7 @@ const Header = () => {
...
@@ -98,7 +98,7 @@ const Header = () => {
:
[
exploreNavLink
,
signInNavLink
];
:
[
exploreNavLink
,
signInNavLink
];
return
(
return
(
<
header
className=
{
`w-full h-full overflow-auto flex flex-col justify-start items-start py-4 z-30`
}
>
<
header
className=
"w-full h-full overflow-auto flex flex-col justify-start items-start py-4 z-30"
>
<
UserBanner
/>
<
UserBanner
/>
<
div
className=
"w-full px-2 py-2 flex flex-col justify-start items-start shrink-0 space-y-2"
>
<
div
className=
"w-full px-2 py-2 flex flex-col justify-start items-start shrink-0 space-y-2"
>
{
navLinks
.
map
((
navLink
)
=>
(
{
navLinks
.
map
((
navLink
)
=>
(
...
...
web/src/components/HomeSidebar.tsx
View file @
65a34ee4
import
{
useLayoutStore
}
from
"../store/module"
;
import
SearchBar
from
"./SearchBar"
;
import
SearchBar
from
"./SearchBar"
;
import
TagList
from
"./TagList"
;
import
TagList
from
"./TagList"
;
import
UsageHeatMap
from
"./UsageHeatMap"
;
import
UsageHeatMap
from
"./UsageHeatMap"
;
const
HomeSidebar
=
()
=>
{
const
HomeSidebar
=
()
=>
{
const
layoutStore
=
useLayoutStore
();
const
showHomeSidebar
=
layoutStore
.
state
.
showHomeSidebar
;
return
(
return
(
<
div
<
aside
className=
"relative w-full pr-2 h-full overflow-auto hide-scrollbar flex flex-col justify-start items-start py-4"
>
className=
{
`fixed md:sticky top-0 left-0 w-full md:w-56 h-full shrink-0 pointer-events-none md:pointer-events-auto z-10 ${
showHomeSidebar && "pointer-events-auto"
}`
}
>
<
div
className=
{
`fixed top-0 left-0 w-full h-full opacity-0 pointer-events-none transition-opacity duration-300 md:!hidden ${
showHomeSidebar && "opacity-60 pointer-events-auto"
}`
}
onClick=
{
()
=>
layoutStore
.
setHomeSidebarStatus
(
false
)
}
></
div
>
<
aside
className=
{
`absolute md:relative top-0 right-0 w-56 pr-2 md:w-full h-full max-h-screen border-l sm:border-none dark:border-l-zinc-700 overflow-auto hide-scrollbar flex flex-col justify-start items-start py-4 z-30 bg-zinc-100 dark:bg-zinc-800 md:bg-transparent md:shadow-none transition-all duration-300 translate-x-full md:translate-x-0 ${
showHomeSidebar && "!translate-x-0 shadow-2xl"
}`
}
>
<
div
className=
"px-4 pr-8 mb-4 w-full"
>
<
div
className=
"px-4 pr-8 mb-4 w-full"
>
<
SearchBar
/>
<
SearchBar
/>
</
div
>
</
div
>
<
UsageHeatMap
/>
<
UsageHeatMap
/>
<
TagList
/>
<
TagList
/>
</
aside
>
</
aside
>
</
div
>
);
);
};
};
...
...
web/src/components/HomeSidebarDrawer.tsx
0 → 100644
View file @
65a34ee4
import
{
Drawer
,
IconButton
}
from
"@mui/joy"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useLocation
}
from
"react-router-dom"
;
import
HomeSidebar
from
"./HomeSidebar"
;
import
Icon
from
"./Icon"
;
const
HomeSidebarDrawer
=
()
=>
{
const
location
=
useLocation
();
const
[
open
,
setOpen
]
=
useState
(
false
);
useEffect
(()
=>
{
setOpen
(
false
);
},
[
location
.
pathname
]);
const
toggleDrawer
=
(
inOpen
:
boolean
)
=>
(
event
:
React
.
KeyboardEvent
|
React
.
MouseEvent
)
=>
{
if
(
event
.
type
===
"keydown"
&&
((
event
as
React
.
KeyboardEvent
).
key
===
"Tab"
||
(
event
as
React
.
KeyboardEvent
).
key
===
"Shift"
))
{
return
;
}
setOpen
(
inOpen
);
};
return
(
<
div
className=
"md:hidden"
>
<
IconButton
onClick=
{
toggleDrawer
(
true
)
}
>
<
Icon
.
Search
className=
"w-5 h-auto dark:text-gray-200"
/>
</
IconButton
>
<
Drawer
anchor=
"right"
open=
{
open
}
onClose=
{
toggleDrawer
(
false
)
}
>
<
div
className=
"w-full px-4"
>
<
HomeSidebar
/>
</
div
>
</
Drawer
>
</
div
>
);
};
export
default
HomeSidebarDrawer
;
web/src/components/MobileHeader.tsx
View file @
65a34ee4
import
{
useState
}
from
"react"
;
import
{
useState
}
from
"react"
;
import
{
useLayoutStore
}
from
"@/store/module"
;
import
HeaderDrawer
from
"./HeaderDrawer"
;
import
HeaderDrawer
from
"./HeaderDrawer"
;
import
Icon
from
"./Icon
"
;
import
HomeSidebarDrawer
from
"./HomeSidebarDrawer
"
;
interface
Props
{
interface
Props
{
showSearch
?:
boolean
;
showSearch
?:
boolean
;
...
@@ -9,7 +8,6 @@ interface Props {
...
@@ -9,7 +8,6 @@ interface Props {
const
MobileHeader
=
(
props
:
Props
)
=>
{
const
MobileHeader
=
(
props
:
Props
)
=>
{
const
{
showSearch
=
true
}
=
props
;
const
{
showSearch
=
true
}
=
props
;
const
layoutStore
=
useLayoutStore
();
const
[
titleText
]
=
useState
(
"MEMOS"
);
const
[
titleText
]
=
useState
(
"MEMOS"
);
return
(
return
(
...
@@ -24,7 +22,7 @@ const MobileHeader = (props: Props) => {
...
@@ -24,7 +22,7 @@ const MobileHeader = (props: Props) => {
</
span
>
</
span
>
</
div
>
</
div
>
<
div
className=
{
`${showSearch ? "flex" : "hidden"} flex-row justify-end items-center pr-1`
}
>
<
div
className=
{
`${showSearch ? "flex" : "hidden"} flex-row justify-end items-center pr-1`
}
>
<
Icon
.
Search
className=
"w-5 h-auto dark:text-gray-200"
onClick=
{
()
=>
layoutStore
.
setHomeSidebarStatus
(
true
)
}
/>
<
HomeSidebarDrawer
/>
</
div
>
</
div
>
</
div
>
</
div
>
);
);
...
...
web/src/pages/Home.tsx
View file @
65a34ee4
...
@@ -11,8 +11,10 @@ const Home = () => {
...
@@ -11,8 +11,10 @@ const Home = () => {
<
MemoEditor
className=
"mb-2"
cacheKey=
"home-memo-editor"
/>
<
MemoEditor
className=
"mb-2"
cacheKey=
"home-memo-editor"
/>
<
MemoList
/>
<
MemoList
/>
</
div
>
</
div
>
<
div
className=
"hidden md:block sticky top-0 left-0 w-56"
>
<
HomeSidebar
/>
<
HomeSidebar
/>
</
div
>
</
div
>
</
div
>
);
);
};
};
...
...
web/src/store/index.ts
View file @
65a34ee4
...
@@ -3,7 +3,6 @@ import { TypedUseSelectorHook, useDispatch, useSelector } from "react-redux";
...
@@ -3,7 +3,6 @@ import { TypedUseSelectorHook, useDispatch, useSelector } from "react-redux";
import
dialogReducer
from
"./reducer/dialog"
;
import
dialogReducer
from
"./reducer/dialog"
;
import
filterReducer
from
"./reducer/filter"
;
import
filterReducer
from
"./reducer/filter"
;
import
globalReducer
from
"./reducer/global"
;
import
globalReducer
from
"./reducer/global"
;
import
layoutReducer
from
"./reducer/layout"
;
import
memoReducer
from
"./reducer/memo"
;
import
memoReducer
from
"./reducer/memo"
;
import
resourceReducer
from
"./reducer/resource"
;
import
resourceReducer
from
"./reducer/resource"
;
import
tagReducer
from
"./reducer/tag"
;
import
tagReducer
from
"./reducer/tag"
;
...
@@ -18,7 +17,6 @@ const store = configureStore({
...
@@ -18,7 +17,6 @@ const store = configureStore({
filter
:
filterReducer
,
filter
:
filterReducer
,
resource
:
resourceReducer
,
resource
:
resourceReducer
,
dialog
:
dialogReducer
,
dialog
:
dialogReducer
,
layout
:
layoutReducer
,
},
},
});
});
...
...
web/src/store/module/index.ts
View file @
65a34ee4
...
@@ -5,4 +5,3 @@ export * from "./tag";
...
@@ -5,4 +5,3 @@ export * from "./tag";
export
*
from
"./resource"
;
export
*
from
"./resource"
;
export
*
from
"./user"
;
export
*
from
"./user"
;
export
*
from
"./dialog"
;
export
*
from
"./dialog"
;
export
*
from
"./layout"
;
web/src/store/module/layout.ts
deleted
100644 → 0
View file @
5ff0234c
import
store
,
{
useAppSelector
}
from
".."
;
import
{
setHomeSidebarStatus
}
from
"../reducer/layout"
;
export
const
useLayoutStore
=
()
=>
{
const
state
=
useAppSelector
((
state
)
=>
state
.
layout
);
return
{
state
,
getState
:
()
=>
{
return
store
.
getState
().
tag
;
},
setHomeSidebarStatus
:
(
showHomeSidebar
:
boolean
)
=>
{
store
.
dispatch
(
setHomeSidebarStatus
(
showHomeSidebar
));
},
};
};
web/src/store/reducer/layout.ts
deleted
100644 → 0
View file @
5ff0234c
import
{
createSlice
,
PayloadAction
}
from
"@reduxjs/toolkit"
;
interface
State
{
showHomeSidebar
:
boolean
;
}
const
layoutSlice
=
createSlice
({
name
:
"layout"
,
initialState
:
{
showHomeSidebar
:
false
,
}
as
State
,
reducers
:
{
setHomeSidebarStatus
:
(
state
,
action
:
PayloadAction
<
boolean
>
)
=>
{
return
{
...
state
,
showHomeSidebar
:
action
.
payload
,
};
},
},
});
export
const
{
setHomeSidebarStatus
}
=
layoutSlice
.
actions
;
export
default
layoutSlice
.
reducer
;
web/src/utils/layout.ts
deleted
100644 → 0
View file @
5ff0234c
// resolution is used to define the breakpoints for the media queries.
// It's same as the breakpoints defined in tailwind.config.js
export
const
resolution
=
{
sm
:
640
,
md
:
768
,
lg
:
1024
,
};
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