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
315ab94c
Unverified
Commit
315ab94c
authored
Oct 11, 2022
by
h2o2o
Committed by
GitHub
Oct 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加移动端点击自动关闭侧边栏 (#271)
parent
1aa9963e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
2 deletions
+11
-2
MemoList.tsx
web/src/components/MemoList.tsx
+2
-1
ShortcutList.tsx
web/src/components/ShortcutList.tsx
+2
-0
TagList.tsx
web/src/components/TagList.tsx
+2
-1
utils.ts
web/src/helpers/utils.ts
+5
-0
No files found.
web/src/components/MemoList.tsx
View file @
315ab94c
...
...
@@ -6,6 +6,7 @@ import { TAG_REG, LINK_REG } from "../labs/marked/parser";
import
*
as
utils
from
"../helpers/utils"
;
import
{
checkShouldShowMemoWithFilters
}
from
"../helpers/filter"
;
import
toastHelper
from
"./Toast"
;
import
{
closeSidebar
}
from
"../helpers/utils"
;
import
Memo
from
"./Memo"
;
import
"../less/memo-list.less"
;
...
...
@@ -92,7 +93,7 @@ const MemoList = () => {
}
, [query]);
return (
<
div
className=
"memo-list-container"
ref=
{
wrapperElement
}
>
<
div
className=
"memo-list-container"
ref=
{
wrapperElement
}
onClick=
{
closeSidebar
}
>
{
sortedMemos
.
map
((
memo
)
=>
(
<
Memo
key=
{
`${memo.id}-${memo.createdTs}-${memo.updatedTs}`
}
memo=
{
memo
}
/>
))
}
...
...
web/src/components/ShortcutList.tsx
View file @
315ab94c
...
...
@@ -5,6 +5,7 @@ import { useAppSelector } from "../store";
import
*
as
utils
from
"../helpers/utils"
;
import
useToggle
from
"../hooks/useToggle"
;
import
useLoading
from
"../hooks/useLoading"
;
import
{
closeSidebar
}
from
"../helpers/utils"
;
import
Icon
from
"./Icon"
;
import
toastHelper
from
"./Toast"
;
import
showCreateShortcutDialog
from
"./CreateShortcutDialog"
;
...
...
@@ -63,6 +64,7 @@ const ShortcutContainer: React.FC<ShortcutContainerProps> = (props: ShortcutCont
const
[
showConfirmDeleteBtn
,
toggleConfirmDeleteBtn
]
=
useToggle
(
false
);
const
handleShortcutClick
=
()
=>
{
closeSidebar
();
if
(
isActive
)
{
locationService
.
setMemoShortcut
(
undefined
);
}
else
{
...
...
web/src/components/TagList.tsx
View file @
315ab94c
...
...
@@ -3,6 +3,7 @@ import { useTranslation } from "react-i18next";
import
{
useAppSelector
}
from
"../store"
;
import
{
locationService
,
memoService
,
userService
}
from
"../services"
;
import
useToggle
from
"../hooks/useToggle"
;
import
{
closeSidebar
}
from
"../helpers/utils"
;
import
Icon
from
"./Icon"
;
import
"../less/tag-list.less"
;
...
...
@@ -69,7 +70,7 @@ const TagList = () => {
},
[
tagsText
]);
return
(
<
div
className=
"tags-wrapper"
>
<
div
className=
"tags-wrapper"
onClick=
{
closeSidebar
}
>
<
p
className=
"title-text"
>
{
t
(
"common.tags"
)
}
</
p
>
<
div
className=
"tags-container"
>
{
tags
.
map
((
t
,
idx
)
=>
(
...
...
web/src/helpers/utils.ts
View file @
315ab94c
...
...
@@ -134,3 +134,8 @@ export const parseHTMLToRawText = (htmlStr: string): string => {
const
text
=
tempEl
.
innerText
;
return
text
;
};
export
function
closeSidebar
()
{
const
sidebarEl
=
document
.
body
.
querySelector
(
".sidebar-wrapper"
)
as
HTMLDivElement
;
sidebarEl
.
style
.
display
=
"none"
;
}
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