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
0d6114e2
Unverified
Commit
0d6114e2
authored
Oct 13, 2022
by
boojack
Committed by
GitHub
Oct 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update sidebar mask styles (#287)
parent
ce5a6fa3
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
34 additions
and
79 deletions
+34
-79
MemosHeader.tsx
web/src/components/MemosHeader.tsx
+1
-1
ShortcutList.tsx
web/src/components/ShortcutList.tsx
+0
-2
Sidebar.tsx
web/src/components/Sidebar.tsx
+23
-11
TagList.tsx
web/src/components/TagList.tsx
+1
-2
utils.ts
web/src/helpers/utils.ts
+0
-7
shortcut-list.less
web/src/less/shortcut-list.less
+2
-2
siderbar.less
web/src/less/siderbar.less
+7
-51
tailwind.config.js
web/tailwind.config.js
+0
-3
No files found.
web/src/components/MemosHeader.tsx
View file @
0d6114e2
...
...
@@ -38,7 +38,7 @@ const MemosHeader = () => {
return
(
<
div
className=
"section-header-container memos-header-container"
>
<
div
className=
"title-container"
>
<
div
className=
"action-btn"
onClick=
{
toggleSiderbar
}
>
<
div
className=
"action-btn"
onClick=
{
()
=>
toggleSiderbar
(
true
)
}
>
<
Icon
.
Menu
className=
"icon-img"
/>
</
div
>
<
span
className=
"title-text"
onClick=
{
handleTitleTextClick
}
>
...
...
web/src/components/ShortcutList.tsx
View file @
0d6114e2
...
...
@@ -5,7 +5,6 @@ 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"
;
...
...
@@ -64,7 +63,6 @@ const ShortcutContainer: React.FC<ShortcutContainerProps> = (props: ShortcutCont
const
[
showConfirmDeleteBtn
,
toggleConfirmDeleteBtn
]
=
useToggle
(
false
);
const
handleShortcutClick
=
()
=>
{
closeSidebar
();
if
(
isActive
)
{
locationService
.
setMemoShortcut
(
undefined
);
}
else
{
...
...
web/src/components/Sidebar.tsx
View file @
0d6114e2
import
{
isUndefined
}
from
"lodash-es"
;
import
{
useEffect
}
from
"react"
;
import
{
Link
}
from
"react-router-dom"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
userService
}
from
"../services"
;
import
{
useAppSelector
}
from
"../store"
;
import
showDailyReviewDialog
from
"./DailyReviewDialog"
;
import
showSettingDialog
from
"./SettingDialog"
;
import
UserBanner
from
"./UserBanner"
;
import
UsageHeatMap
from
"./UsageHeatMap"
;
import
ShortcutList
from
"./ShortcutList"
;
import
TagList
from
"./TagList"
;
import
{
closeSidebar
}
from
"../helpers/utils"
;
import
"../less/siderbar.less"
;
const
Sidebar
=
()
=>
{
const
{
t
}
=
useTranslation
();
const
location
=
useAppSelector
((
state
)
=>
state
.
location
);
useEffect
(()
=>
{
toggleSiderbar
(
false
);
},
[
location
.
query
]);
const
handleSettingBtnClick
=
()
=>
{
showSettingDialog
();
};
return
(
<
div
>
<
aside
className=
"sidebar-wrapper
close-sidebar
"
>
<>
<
aside
className=
"sidebar-wrapper"
>
<
UserBanner
/>
<
UsageHeatMap
/>
<
div
className=
"action-btns-container"
>
...
...
@@ -40,20 +47,25 @@ const Sidebar = () => {
{
!
userService
.
isVisitorMode
()
&&
<
ShortcutList
/>
}
<
TagList
/>
</
aside
>
<
div
className=
"mask"
onClick=
{
closeSidebar
}
></
div
>
</
div
>
<
div
className=
"mask"
onClick=
{
()
=>
toggleSiderbar
(
false
)
}
></
div
>
</>
);
};
export
const
toggleSiderbar
=
()
=>
{
export
const
toggleSiderbar
=
(
show
?:
boolean
)
=>
{
const
sidebarEl
=
document
.
body
.
querySelector
(
".sidebar-wrapper"
)
as
HTMLDivElement
;
const
maskEl
=
document
.
body
.
querySelector
(
".mask"
)
as
HTMLDivElement
;
if
(
!
sidebarEl
.
classList
.
contains
(
"close-sidebar"
))
{
sidebarEl
.
classList
.
replace
(
"open-sidebar"
,
"close-sidebar"
);
if
(
isUndefined
(
show
))
{
show
=
!
sidebarEl
.
classList
.
contains
(
"show"
);
}
if
(
show
)
{
sidebarEl
.
classList
.
add
(
"show"
);
maskEl
.
classList
.
add
(
"show"
);
}
else
{
sidebarEl
.
classList
.
re
place
(
"close-sidebar"
,
"open-sidebar
"
);
maskEl
.
classList
.
contains
(
"hide-mask"
)
?
maskEl
.
classList
.
replace
(
"hide-mask"
,
"show-mask"
)
:
maskEl
.
classList
.
add
(
"show-mask
"
);
sidebarEl
.
classList
.
re
move
(
"show
"
);
maskEl
.
classList
.
remove
(
"show
"
);
}
};
...
...
web/src/components/TagList.tsx
View file @
0d6114e2
...
...
@@ -3,7 +3,6 @@ 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"
;
...
...
@@ -70,7 +69,7 @@ const TagList = () => {
},
[
tagsText
]);
return
(
<
div
className=
"tags-wrapper"
onClick=
{
closeSidebar
}
>
<
div
className=
"tags-wrapper"
>
<
p
className=
"title-text"
>
{
t
(
"common.tags"
)
}
</
p
>
<
div
className=
"tags-container"
>
{
tags
.
map
((
t
,
idx
)
=>
(
...
...
web/src/helpers/utils.ts
View file @
0d6114e2
...
...
@@ -134,10 +134,3 @@ export const parseHTMLToRawText = (htmlStr: string): string => {
const
text
=
tempEl
.
innerText
;
return
text
;
};
export
function
closeSidebar
()
{
const
sidebarEl
=
document
.
body
.
querySelector
(
".sidebar-wrapper"
)
as
HTMLDivElement
;
const
maskEl
=
document
.
body
.
querySelector
(
".mask"
)
as
HTMLDivElement
;
sidebarEl
.
classList
.
replace
(
"open-sidebar"
,
"close-sidebar"
);
maskEl
.
classList
.
replace
(
"show-mask"
,
"hide-mask"
);
}
web/src/less/shortcut-list.less
View file @
0d6114e2
...
...
@@ -12,10 +12,10 @@
}
> .btn {
@apply flex flex-col justify-center items-center w-5 h-5 bg-gray-200 rounded ml-2
shadow hover:opacity-80
;
@apply flex flex-col justify-center items-center w-5 h-5 bg-gray-200 rounded ml-2
hover:shadow
;
> .icon-img {
@apply w-4 h-4;
@apply w-4 h-4
text-gray-500
;
}
}
}
...
...
web/src/less/siderbar.less
View file @
0d6114e2
@import "./mixin.less";
.sidebar-wrapper {
@apply fixed sm:sticky top-0 z-30 sm:z-0
sm:!flex flex-col justify-start items-start w-64 h-screen py-4 pl-2 bg-white sm:bg-transparent shadow-2xl sm:shadow-none overflow-x-hidden overflow-y-auto transition-transform duration-377
;
@apply fixed sm:sticky top-0 z-30 sm:z-0
-translate-x-64 sm:translate-x-0 sm:flex flex-col justify-start items-start w-64 h-screen py-4 pl-2 bg-white sm:bg-transparent overflow-x-hidden overflow-y-auto transition-transform duration-300 overscroll-contain
;
.hide-scroll-bar();
overscroll-behavior: contain;
> .close-container {
@apply w-full pr-6 my-2 flex sm:hidden flex-row justify-end items-center;
> .action-btn {
@apply p-1 bg-gray-100 rounded shadow w-7 h-7 flex flex-row justify-center items-center;
}
&.show {
@apply translate-x-0 shadow-2xl sm:shadow-none;
}
> .action-btns-container {
...
...
@@ -26,49 +21,10 @@
}
}
.open-sidebar{
@apply sm:transform translate-x-0;
}
.mask {
@apply fixed top-0 right-0 w-screen h-screen bg-transparent transition-all duration-300 z-0;
.close-sidebar{
@apply sm:transform -translate-x-64 md:translate-x-0;
}
.mask{
@apply fixed top-0 right-0 w-screen h-screen;
z-index: -1;
}
.hide-mask{
animation: hide 0.23s ease-in;
@keyframes hide {
0%{
background-color: rgba(0, 0, 0, 0.6);
z-index: 20;
}
65%{
background-color: rgba(0, 0, 0, 0);
}
100% {
z-index: 0;
}
}
}
.show-mask{
@apply translate-x-0 z-20;
background-color: rgba(0, 0, 0, 0.6);
animation: show 0.37s ease-in;
@keyframes show {
0%{
background-color: rgba(0, 0, 0, 0);
}
80%{
background-color: rgba(0, 0, 0, 0.56);
}
100% {
background-color: rgba(0, 0, 0, 0.6);
}
&.show {
@apply z-20 bg-black opacity-60;
}
}
web/tailwind.config.js
View file @
0d6114e2
...
...
@@ -27,9 +27,6 @@ module.exports = {
gridTemplateRows
:
{
7
:
"repeat(7, minmax(0, 1fr))"
,
},
transitionDuration
:
{
'377'
:
'377ms'
,
}
},
},
};
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