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
4f88221b
Commit
4f88221b
authored
Mar 29, 2022
by
email
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update sidebar style
parent
1cebf1db
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
107 additions
and
96 deletions
+107
-96
MenuBtnsPopup.tsx
web/src/components/MenuBtnsPopup.tsx
+0
-17
Sidebar.tsx
web/src/components/Sidebar.tsx
+42
-5
UserBanner.tsx
web/src/components/UserBanner.tsx
+7
-27
shortcut-list.less
web/src/less/shortcut-list.less
+5
-8
siderbar.less
web/src/less/siderbar.less
+29
-3
user-banner.less
web/src/less/user-banner.less
+11
-36
tailwind.config.js
web/tailwind.config.js
+13
-0
No files found.
web/src/components/MenuBtnsPopup.tsx
View file @
4f88221b
import
{
useEffect
,
useRef
}
from
"react"
;
import
{
useEffect
,
useRef
}
from
"react"
;
import
{
locationService
,
userService
}
from
"../services"
;
import
{
locationService
,
userService
}
from
"../services"
;
import
showAboutSiteDialog
from
"./AboutSiteDialog"
;
import
showAboutSiteDialog
from
"./AboutSiteDialog"
;
import
showSettingDialog
from
"./SettingDialog"
;
import
showMemoTrashDialog
from
"./MemoTrashDialog"
;
import
"../less/menu-btns-popup.less"
;
import
"../less/menu-btns-popup.less"
;
interface
Props
{
interface
Props
{
...
@@ -12,7 +10,6 @@ interface Props {
...
@@ -12,7 +10,6 @@ interface Props {
const
MenuBtnsPopup
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
MenuBtnsPopup
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
{
shownStatus
,
setShownStatus
}
=
props
;
const
{
shownStatus
,
setShownStatus
}
=
props
;
const
popupElRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
popupElRef
=
useRef
<
HTMLDivElement
>
(
null
);
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -30,14 +27,6 @@ const MenuBtnsPopup: React.FC<Props> = (props: Props) => {
...
@@ -30,14 +27,6 @@ const MenuBtnsPopup: React.FC<Props> = (props: Props) => {
}
}
},
[
shownStatus
]);
},
[
shownStatus
]);
const
handleMyAccountBtnClick
=
()
=>
{
showSettingDialog
();
};
const
handleMemosTrashBtnClick
=
()
=>
{
showMemoTrashDialog
();
};
const
handleAboutBtnClick
=
()
=>
{
const
handleAboutBtnClick
=
()
=>
{
showAboutSiteDialog
();
showAboutSiteDialog
();
};
};
...
@@ -50,12 +39,6 @@ const MenuBtnsPopup: React.FC<Props> = (props: Props) => {
...
@@ -50,12 +39,6 @@ const MenuBtnsPopup: React.FC<Props> = (props: Props) => {
return
(
return
(
<
div
className=
{
`menu-btns-popup ${shownStatus ? "" : "hidden"}`
}
ref=
{
popupElRef
}
>
<
div
className=
{
`menu-btns-popup ${shownStatus ? "" : "hidden"}`
}
ref=
{
popupElRef
}
>
<
button
className=
"btn action-btn"
onClick=
{
handleMyAccountBtnClick
}
>
<
span
className=
"icon"
>
👤
</
span
>
Setting
</
button
>
<
button
className=
"btn action-btn"
onClick=
{
handleMemosTrashBtnClick
}
>
<
span
className=
"icon"
>
🗑️
</
span
>
Recycle Bin
</
button
>
<
button
className=
"btn action-btn"
onClick=
{
handleAboutBtnClick
}
>
<
button
className=
"btn action-btn"
onClick=
{
handleAboutBtnClick
}
>
<
span
className=
"icon"
>
🤠
</
span
>
About
<
span
className=
"icon"
>
🤠
</
span
>
About
</
button
>
</
button
>
...
...
web/src/components/Sidebar.tsx
View file @
4f88221b
import
{
useRef
}
from
"react"
;
import
{
useContext
}
from
"react"
;
import
appContext
from
"../stores/appContext"
;
import
utils
from
"../helpers/utils"
;
import
showDailyMemoDiaryDialog
from
"./DailyMemoDiaryDialog"
;
import
showSettingDialog
from
"./SettingDialog"
;
import
showMemoTrashDialog
from
"./MemoTrashDialog"
;
import
UserBanner
from
"./UserBanner"
;
import
UserBanner
from
"./UserBanner"
;
import
ShortcutList
from
"./ShortcutList"
;
import
ShortcutList
from
"./ShortcutList"
;
import
UsageHeatMap
from
"./UsageHeatMap"
;
import
"../less/siderbar.less"
;
import
"../less/siderbar.less"
;
interface
Props
{}
interface
Props
{}
const
Sidebar
:
React
.
FC
<
Props
>
=
()
=>
{
const
Sidebar
:
React
.
FC
<
Props
>
=
()
=>
{
const
wrapperElRef
=
useRef
<
HTMLElement
>
(
null
);
const
{
memoState
:
{
memos
,
tags
},
userState
:
{
user
},
}
=
useContext
(
appContext
);
const
createdDays
=
user
?
Math
.
ceil
((
Date
.
now
()
-
utils
.
getTimeStampByDate
(
user
.
createdAt
))
/
1000
/
3600
/
24
)
:
0
;
const
handleMyAccountBtnClick
=
()
=>
{
showSettingDialog
();
};
const
handleMemosTrashBtnClick
=
()
=>
{
showMemoTrashDialog
();
};
return
(
return
(
<
aside
className=
"sidebar-wrapper"
ref=
{
wrapperElRef
}
>
<
aside
className=
"sidebar-wrapper"
>
<
UserBanner
/>
<
UserBanner
/>
<
UsageHeatMap
/>
<
div
className=
"action-btns-container"
>
<
button
className=
"btn action-btn"
onClick=
{
handleMyAccountBtnClick
}
>
<
span
className=
"icon"
>
👤
</
span
>
Setting
</
button
>
<
button
className=
"btn action-btn"
onClick=
{
handleMemosTrashBtnClick
}
>
<
span
className=
"icon"
>
🗑️
</
span
>
Recycle Bin
</
button
>
</
div
>
<
ShortcutList
/>
<
ShortcutList
/>
<
div
className=
"status-text-container"
>
<
div
className=
"status-text memos-text"
>
<
span
className=
"amount-text"
>
{
memos
.
length
}
</
span
>
<
span
className=
"type-text"
>
MEMO
</
span
>
</
div
>
<
div
className=
"status-text tags-text"
>
<
span
className=
"amount-text"
>
{
tags
.
length
}
</
span
>
<
span
className=
"type-text"
>
TAG
</
span
>
</
div
>
<
div
className=
"status-text duration-text"
onClick=
{
()
=>
showDailyMemoDiaryDialog
()
}
>
<
span
className=
"amount-text"
>
{
createdDays
}
</
span
>
<
span
className=
"type-text"
>
DAY
</
span
>
</
div
>
</
div
>
</
aside
>
</
aside
>
);
);
};
};
...
...
web/src/components/UserBanner.tsx
View file @
4f88221b
import
{
useCallback
,
useContext
,
useState
}
from
"react"
;
import
{
useCallback
,
useContext
,
useState
}
from
"react"
;
import
appContext
from
"../stores/appContext"
;
import
appContext
from
"../stores/appContext"
;
import
{
locationService
}
from
"../services"
;
import
{
locationService
}
from
"../services"
;
import
utils
from
"../helpers/utils"
;
import
MenuBtnsPopup
from
"./MenuBtnsPopup"
;
import
MenuBtnsPopup
from
"./MenuBtnsPopup"
;
import
showDailyMemoDiaryDialog
from
"./DailyMemoDiaryDialog"
;
import
"../less/user-banner.less"
;
import
"../less/user-banner.less"
;
interface
Props
{}
interface
Props
{}
const
UserBanner
:
React
.
FC
<
Props
>
=
()
=>
{
const
UserBanner
:
React
.
FC
<
Props
>
=
()
=>
{
const
{
const
{
memoState
:
{
memos
,
tags
},
userState
:
{
user
},
userState
:
{
user
},
}
=
useContext
(
appContext
);
}
=
useContext
(
appContext
);
const
username
=
user
?
user
.
name
:
"Memos"
;
const
username
=
user
?
user
.
name
:
"Memos"
;
const
createdDays
=
user
?
Math
.
ceil
((
Date
.
now
()
-
utils
.
getTimeStampByDate
(
user
.
createdAt
))
/
1000
/
3600
/
24
)
:
0
;
const
[
shouldShowPopupBtns
,
setShouldShowPopupBtns
]
=
useState
(
false
);
const
[
shouldShowPopupBtns
,
setShouldShowPopupBtns
]
=
useState
(
false
);
...
@@ -32,29 +28,13 @@ const UserBanner: React.FC<Props> = () => {
...
@@ -32,29 +28,13 @@ const UserBanner: React.FC<Props> = () => {
return
(
return
(
<
div
className=
"user-banner-container"
>
<
div
className=
"user-banner-container"
>
<
div
className=
"userinfo-header-container"
>
<
p
className=
"username-text"
onClick=
{
handleUsernameClick
}
>
<
p
className=
"username-text"
onClick=
{
handleUsernameClick
}
>
{
username
}
{
username
}
</
p
>
</
p
>
<
span
className=
"action-btn menu-popup-btn"
onClick=
{
handlePopupBtnClick
}
>
<
span
className=
"action-btn menu-popup-btn"
onClick=
{
handlePopupBtnClick
}
>
<
img
src=
"/icons/more.svg"
className=
"icon-img"
/>
<
img
src=
"/icons/more.svg"
className=
"icon-img"
/>
</
span
>
</
span
>
<
MenuBtnsPopup
shownStatus=
{
shouldShowPopupBtns
}
setShownStatus=
{
setShouldShowPopupBtns
}
/>
<
MenuBtnsPopup
shownStatus=
{
shouldShowPopupBtns
}
setShownStatus=
{
setShouldShowPopupBtns
}
/>
</
div
>
<
div
className=
"status-text-container"
>
<
div
className=
"status-text memos-text"
>
<
span
className=
"amount-text"
>
{
memos
.
length
}
</
span
>
<
span
className=
"type-text"
>
MEMO
</
span
>
</
div
>
<
div
className=
"status-text tags-text"
>
<
span
className=
"amount-text"
>
{
tags
.
length
}
</
span
>
<
span
className=
"type-text"
>
TAG
</
span
>
</
div
>
<
div
className=
"status-text duration-text"
onClick=
{
()
=>
showDailyMemoDiaryDialog
()
}
>
<
span
className=
"amount-text"
>
{
createdDays
}
</
span
>
<
span
className=
"type-text"
>
DAY
</
span
>
</
div
>
</
div
>
</
div
>
</
div
>
);
);
};
};
...
...
web/src/less/shortcut-list.less
View file @
4f88221b
...
@@ -2,12 +2,12 @@
...
@@ -2,12 +2,12 @@
.shortcuts-wrapper {
.shortcuts-wrapper {
.flex(column, flex-start, flex-start);
.flex(column, flex-start, flex-start);
@apply w-full py-0 px-2
h-auto
flex-nowrap;
@apply w-full py-0 px-2
mt-1 h-auto grow shrink
flex-nowrap;
.hide-scroll-bar();
.hide-scroll-bar();
> .title-text {
> .title-text {
.flex(row, space-between, center);
.flex(row, space-between, center);
@apply w-full p
y-1 p
x-4;
@apply w-full px-4;
> .normal-text {
> .normal-text {
@apply text-xs leading-6 font-bold text-black opacity-50;
@apply text-xs leading-6 font-bold text-black opacity-50;
...
@@ -58,8 +58,6 @@
...
@@ -58,8 +58,6 @@
background-color: @text-green !important;
background-color: @text-green !important;
> .shortcut-text-container {
> .shortcut-text-container {
@apply font-bold;
> * {
> * {
@apply text-white;
@apply text-white;
}
}
...
@@ -68,8 +66,7 @@
...
@@ -68,8 +66,7 @@
> .shortcut-text-container {
> .shortcut-text-container {
.flex(row, flex-start, center);
.flex(row, flex-start, center);
@apply overflow-hidden text-ellipsis shrink-0 leading-5;
@apply truncate shrink leading-5 mr-1;
max-width: calc(100% - 24px);
color: @text-black;
color: @text-black;
> .icon-text {
> .icon-text {
...
@@ -77,13 +74,13 @@
...
@@ -77,13 +74,13 @@
}
}
> .shortcut-text {
> .shortcut-text {
@apply
shrink-0
;
@apply
truncate
;
}
}
}
}
> .btns-container {
> .btns-container {
.flex(row, flex-end, center);
.flex(row, flex-end, center);
@apply hidden;
@apply hidden
shrink-0
;
> .action-btn {
> .action-btn {
.flex(row, center, center);
.flex(row, center, center);
...
...
web/src/less/siderbar.less
View file @
4f88221b
...
@@ -2,10 +2,36 @@
...
@@ -2,10 +2,36 @@
.sidebar-wrapper {
.sidebar-wrapper {
.flex(column, flex-start, flex-start);
.flex(column, flex-start, flex-start);
@apply w-6
0 h-full py-4
overflow-x-hidden overflow-y-auto shrink-0;
@apply w-6
4 h-full py-4 px-2
overflow-x-hidden overflow-y-auto shrink-0;
.hide-scroll-bar();
.hide-scroll-bar();
> * {
> .action-btns-container {
@apply shrink-0;
@apply w-full px-2 my-2 flex flex-col justify-start items-start shrink-0;
> .action-btn {
@apply leading-10 px-4 rounded-lg text-base hover:bg-white;
> .icon {
@apply mr-1;
}
}
}
> .status-text-container {
.flex(row, space-between, flex-start);
@apply w-full px-10 select-none shrink-0;
> .status-text {
.flex(column, flex-start, flex-start);
> .amount-text {
@apply font-bold text-2xl opacity-80 leading-10;
color: @text-black;
}
> .type-text {
@apply text-gray-400 text-xs font-mono;
}
}
}
}
}
}
web/src/less/user-banner.less
View file @
4f88221b
@import "./mixin.less";
@import "./mixin.less";
.user-banner-container {
.user-banner-container {
.flex(
column, flex-start, flex-start
);
.flex(
row, space-between, center
);
@apply w-full h-auto;
@apply w-full h-auto
px-6 flex-nowrap mb-1
;
> .userinfo-header-container {
> .username-text {
.flex(row, space-between, center);
@apply font-bold text-lg pr-2 text-slate-800 cursor-pointer shrink truncate;
@apply w-full px-6 flex-nowrap mb-1;
> .username-text {
@apply font-bold text-lg text-slate-800 overflow-hidden cursor-pointer shrink-0 text-ellipsis;
max-width: calc(100% - 32px);
}
> .action-btn {
@apply flex-shrink-0 select-none border-none;
background-color: unset;
&.menu-popup-btn {
.flex(column, center, center);
@apply w-9 h-10 -mr-2 cursor-pointer;
> .icon-img {
@apply w-5 h-auto;
}
}
}
}
}
> .status-text-container {
> .action-btn {
.flex(row, space-between, flex-start);
@apply shrink-0 select-none border-none;
@apply px-6 w-full select-none mb-3;
> .status-text {
&.menu-popup-btn {
.flex(column, flex-start, flex-start);
.flex(column, center, center);
@apply w-9 h-10 -mr-2 cursor-pointer;
> .amount-text {
@apply font-bold text-2xl opacity-80 leading-10;
color: @text-black;
}
> .
type-text
{
> .
icon-img
{
@apply
text-gray-400 text-xs font-mon
o;
@apply
w-5 h-aut
o;
}
}
}
}
}
}
...
...
web/tailwind.config.js
View file @
4f88221b
...
@@ -2,6 +2,19 @@
...
@@ -2,6 +2,19 @@
module
.
exports
=
{
module
.
exports
=
{
content
:
[
"./index.html"
,
"./src/**/*.{js,ts,tsx}"
],
content
:
[
"./index.html"
,
"./src/**/*.{js,ts,tsx}"
],
theme
:
{
theme
:
{
fontSize
:
{
xs
:
".75rem"
,
sm
:
".875rem"
,
base
:
"1rem"
,
lg
:
"1.125rem"
,
xl
:
"1.25rem"
,
"2xl"
:
"1.5rem"
,
"3xl"
:
"1.875rem"
,
"4xl"
:
"2.25rem"
,
"5xl"
:
"3rem"
,
"6xl"
:
"4rem"
,
"7xl"
:
"5rem"
,
},
extend
:
{
extend
:
{
spacing
:
{
spacing
:
{
128
:
"32rem"
,
128
:
"32rem"
,
...
...
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