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
2fb171e0
Unverified
Commit
2fb171e0
authored
Dec 22, 2022
by
boojack
Committed by
GitHub
Dec 22, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update create tag dialog style (#818)
* chore: update create tag dialog * chore: update
parent
201c0b02
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
14 deletions
+25
-14
CreateTagDialog.tsx
web/src/components/CreateTagDialog.tsx
+15
-7
Sidebar.tsx
web/src/components/Sidebar.tsx
+6
-2
TagList.tsx
web/src/components/TagList.tsx
+2
-3
tag-list.less
web/src/less/tag-list.less
+1
-1
en.json
web/src/locales/en.json
+1
-1
No files found.
web/src/components/CreateTagDialog.tsx
View file @
2fb171e0
import
{
TextField
}
from
"@mui/joy"
;
import
{
TextField
}
from
"@mui/joy"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
useTagStore
}
from
"../store/module"
;
import
{
useTagStore
}
from
"../store/module"
;
import
{
getTagSuggestionList
}
from
"../helpers/api"
;
import
{
getTagSuggestionList
}
from
"../helpers/api"
;
import
Tag
from
"../labs/marked/parser/Tag"
;
import
Tag
from
"../labs/marked/parser/Tag"
;
...
@@ -31,8 +31,14 @@ const CreateTagDialog: React.FC<Props> = (props: Props) => {
...
@@ -31,8 +31,14 @@ const CreateTagDialog: React.FC<Props> = (props: Props) => {
});
});
},
[]);
},
[]);
const
handleTagNameChanged
=
(
e
:
React
.
ChangeEvent
<
HTMLInputElement
>
)
=>
{
const
handleTagNameInputKeyDown
=
(
event
:
React
.
KeyboardEvent
)
=>
{
const
tagName
=
e
.
target
.
value
as
string
;
if
(
event
.
key
===
"Enter"
)
{
handleSaveBtnClick
();
}
};
const
handleTagNameChanged
=
(
event
:
React
.
ChangeEvent
<
HTMLInputElement
>
)
=>
{
const
tagName
=
event
.
target
.
value
;
setTagName
(
tagName
.
trim
());
setTagName
(
tagName
.
trim
());
};
};
...
@@ -48,6 +54,7 @@ const CreateTagDialog: React.FC<Props> = (props: Props) => {
...
@@ -48,6 +54,7 @@ const CreateTagDialog: React.FC<Props> = (props: Props) => {
try
{
try
{
await
tagStore
.
upsertTag
(
tagName
);
await
tagStore
.
upsertTag
(
tagName
);
setTagName
(
""
);
}
catch
(
error
:
any
)
{
}
catch
(
error
:
any
)
{
console
.
error
(
error
);
console
.
error
(
error
);
toastHelper
.
error
(
error
.
response
.
data
.
message
);
toastHelper
.
error
(
error
.
response
.
data
.
message
);
...
@@ -80,9 +87,10 @@ const CreateTagDialog: React.FC<Props> = (props: Props) => {
...
@@ -80,9 +87,10 @@ const CreateTagDialog: React.FC<Props> = (props: Props) => {
placeholder=
"TAG_NAME"
placeholder=
"TAG_NAME"
value=
{
tagName
}
value=
{
tagName
}
onChange=
{
handleTagNameChanged
}
onChange=
{
handleTagNameChanged
}
onKeyDown=
{
handleTagNameInputKeyDown
}
fullWidth
fullWidth
startDecorator=
{
<
Icon
.
Hash
className=
"w-4 h-auto"
/>
}
startDecorator=
{
<
Icon
.
Hash
className=
"w-4 h-auto"
/>
}
endDecorator=
{
<
Icon
.
Check
Circle
onClick=
{
handleSaveBtnClick
}
className=
"w-4 h-auto
"
/>
}
endDecorator=
{
<
Icon
.
Check
onClick=
{
handleSaveBtnClick
}
className=
"w-4 h-auto cursor-pointer hover:opacity-80
"
/>
}
/>
/>
{
tagNameList
.
length
>
0
&&
(
{
tagNameList
.
length
>
0
&&
(
<>
<>
...
@@ -90,7 +98,7 @@ const CreateTagDialog: React.FC<Props> = (props: Props) => {
...
@@ -90,7 +98,7 @@ const CreateTagDialog: React.FC<Props> = (props: Props) => {
<
div
className=
"w-full flex flex-row justify-start items-start flex-wrap"
>
<
div
className=
"w-full flex flex-row justify-start items-start flex-wrap"
>
{
tagNameList
.
map
((
tag
)
=>
(
{
tagNameList
.
map
((
tag
)
=>
(
<
span
<
span
className=
"
text-sm mr-2 mt-1 font-mono cursor-pointer truncate
hover:opacity-60 hover:line-through"
className=
"
max-w-[120px] text-sm mr-2 mt-1 font-mono cursor-pointer truncate dark:text-gray-300
hover:opacity-60 hover:line-through"
key=
{
tag
}
key=
{
tag
}
onClick=
{
()
=>
handleDeleteTag
(
tag
)
}
onClick=
{
()
=>
handleDeleteTag
(
tag
)
}
>
>
...
@@ -107,7 +115,7 @@ const CreateTagDialog: React.FC<Props> = (props: Props) => {
...
@@ -107,7 +115,7 @@ const CreateTagDialog: React.FC<Props> = (props: Props) => {
<
div
className=
"w-full flex flex-row justify-start items-start flex-wrap"
>
<
div
className=
"w-full flex flex-row justify-start items-start flex-wrap"
>
{
shownSuggestTagNameList
.
map
((
tag
)
=>
(
{
shownSuggestTagNameList
.
map
((
tag
)
=>
(
<
span
<
span
className=
"
text-sm mr-2 mt-1 font-mono cursor-pointer truncate
hover:opacity-60"
className=
"
max-w-[120px] text-sm mr-2 mt-1 font-mono cursor-pointer truncate dark:text-gray-300
hover:opacity-60"
key=
{
tag
}
key=
{
tag
}
onClick=
{
()
=>
handleUpsertSuggestTag
(
tag
)
}
onClick=
{
()
=>
handleUpsertSuggestTag
(
tag
)
}
>
>
...
@@ -116,7 +124,7 @@ const CreateTagDialog: React.FC<Props> = (props: Props) => {
...
@@ -116,7 +124,7 @@ const CreateTagDialog: React.FC<Props> = (props: Props) => {
))
}
))
}
</
div
>
</
div
>
<
button
<
button
className=
"mt-2 text-sm border px-2 leading-6 rounded cursor-pointer hover:opacity-80 hover:shadow"
className=
"mt-2 text-sm border px-2 leading-6 rounded cursor-pointer
dark:border-gray-400 dark:text-gray-300
hover:opacity-80 hover:shadow"
onClick=
{
handleSaveSuggestTagList
}
onClick=
{
handleSaveSuggestTagList
}
>
>
Save all
Save all
...
...
web/src/components/Sidebar.tsx
View file @
2fb171e0
...
@@ -46,8 +46,12 @@ const Sidebar = () => {
...
@@ -46,8 +46,12 @@ const Sidebar = () => {
</>
</>
)
}
)
}
</
div
>
</
div
>
{
!
userStore
.
isVisitorMode
()
&&
<
ShortcutList
/>
}
{
!
userStore
.
isVisitorMode
()
&&
(
<
TagList
/>
<>
<
ShortcutList
/>
<
TagList
/>
</>
)
}
</
aside
>
</
aside
>
</>
</>
);
);
...
...
web/src/components/TagList.tsx
View file @
2fb171e0
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
useLocationStore
,
useTagStore
,
useUserStore
}
from
"../store/module"
;
import
{
useLocationStore
,
useTagStore
}
from
"../store/module"
;
import
useToggle
from
"../hooks/useToggle"
;
import
useToggle
from
"../hooks/useToggle"
;
import
Icon
from
"./Icon"
;
import
Icon
from
"./Icon"
;
import
showCreateTagDialog
from
"./CreateTagDialog"
;
import
showCreateTagDialog
from
"./CreateTagDialog"
;
...
@@ -15,7 +15,6 @@ interface Tag {
...
@@ -15,7 +15,6 @@ interface Tag {
const
TagList
=
()
=>
{
const
TagList
=
()
=>
{
const
{
t
}
=
useTranslation
();
const
{
t
}
=
useTranslation
();
const
locationStore
=
useLocationStore
();
const
locationStore
=
useLocationStore
();
const
userStore
=
useUserStore
();
const
tagStore
=
useTagStore
();
const
tagStore
=
useTagStore
();
const
tagsText
=
tagStore
.
state
.
tags
;
const
tagsText
=
tagStore
.
state
.
tags
;
const
query
=
locationStore
.
state
.
query
;
const
query
=
locationStore
.
state
.
query
;
...
@@ -84,7 +83,7 @@ const TagList = () => {
...
@@ -84,7 +83,7 @@ const TagList = () => {
{
tags
.
map
((
t
,
idx
)
=>
(
{
tags
.
map
((
t
,
idx
)
=>
(
<
TagItemContainer
key=
{
t
.
text
+
"-"
+
idx
}
tag=
{
t
}
tagQuery=
{
query
?.
tag
}
/>
<
TagItemContainer
key=
{
t
.
text
+
"-"
+
idx
}
tag=
{
t
}
tagQuery=
{
query
?.
tag
}
/>
))
}
))
}
{
!
userStore
.
isVisitorMode
()
&&
tags
.
length
===
0
&&
<
p
className=
"tip-text"
>
{
t
(
"tag-list.tip-text"
)
}
</
p
>
}
{
tags
.
length
<
3
&&
<
p
className=
"tip-text"
>
{
t
(
"tag-list.tip-text"
)
}
</
p
>
}
</
div
>
</
div
>
</
div
>
</
div
>
);
);
...
...
web/src/less/tag-list.less
View file @
2fb171e0
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
}
}
> .tip-text {
> .tip-text {
@apply w-full bg-gray-50 dark:bg-zinc-700 mt-2 p
l-4 leading-8
rounded text-sm text-gray-400 font-mono;
@apply w-full bg-gray-50 dark:bg-zinc-700 mt-2 p
x-4 py-1 leading-5
rounded text-sm text-gray-400 font-mono;
}
}
}
}
}
}
web/src/locales/en.json
View file @
2fb171e0
...
@@ -141,7 +141,7 @@
...
@@ -141,7 +141,7 @@
"text-placeholder"
:
"Starts with ^ to use regex"
"text-placeholder"
:
"Starts with ^ to use regex"
},
},
"tag-list"
:
{
"tag-list"
:
{
"tip-text"
:
"
Enter `#tag ` to create
"
"tip-text"
:
"
Click the '+' button or input `#tag ` to create a new tag.
"
},
},
"search"
:
{
"search"
:
{
"quickly-filter"
:
"Quickly filter"
"quickly-filter"
:
"Quickly filter"
...
...
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