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
878fea5f
Commit
878fea5f
authored
Jul 17, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: use popover for update tag view setting
parent
5a26b765
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
734 additions
and
12 deletions
+734
-12
components.json
web/components.json
+17
-0
package.json
web/package.json
+4
-0
pnpm-lock.yaml
web/pnpm-lock.yaml
+546
-0
TagsSection.tsx
web/src/components/HomeSidebar/TagsSection.tsx
+10
-9
popover.tsx
web/src/components/ui/popover.tsx
+29
-0
tailwind.css
web/src/css/tailwind.css
+57
-0
utils.ts
web/src/utils/utils.ts
+6
-0
tailwind.config.js
web/tailwind.config.js
+65
-3
No files found.
web/components.json
0 → 100644
View file @
878fea5f
{
"$schema"
:
"https://ui.shadcn.com/schema.json"
,
"style"
:
"default"
,
"rsc"
:
false
,
"tsx"
:
true
,
"tailwind"
:
{
"config"
:
"tailwind.config.js"
,
"css"
:
"src/css/tailwind.css"
,
"baseColor"
:
"zinc"
,
"cssVariables"
:
true
,
"prefix"
:
""
},
"aliases"
:
{
"components"
:
"@/components"
,
"utils"
:
"@/utils/utils"
}
}
web/package.json
View file @
878fea5f
...
...
@@ -17,7 +17,9 @@
"@github/relative-time-element"
:
"^4.4.0"
,
"@matejmazur/react-katex"
:
"^3.1.3"
,
"@mui/joy"
:
"5.0.0-beta.48"
,
"@radix-ui/react-popover"
:
"^1.1.1"
,
"@reduxjs/toolkit"
:
"^2.2.6"
,
"class-variance-authority"
:
"^0.7.0"
,
"clsx"
:
"^2.1.1"
,
"copy-to-clipboard"
:
"^3.3.3"
,
"dayjs"
:
"^1.11.11"
,
...
...
@@ -36,7 +38,9 @@
"react-redux"
:
"^9.1.2"
,
"react-router-dom"
:
"^6.24.0"
,
"react-use"
:
"^17.5.0"
,
"tailwind-merge"
:
"^2.4.0"
,
"tailwindcss"
:
"^3.4.5"
,
"tailwindcss-animate"
:
"^1.0.7"
,
"textarea-caret"
:
"^3.1.0"
,
"uuid"
:
"^10.0.0"
,
"zustand"
:
"^4.5.4"
...
...
web/pnpm-lock.yaml
View file @
878fea5f
This diff is collapsed.
Click to expand it.
web/src/components/HomeSidebar/TagsSection.tsx
View file @
878fea5f
...
...
@@ -12,6 +12,7 @@ import { useTranslate } from "@/utils/i18n";
import
Icon
from
"../Icon"
;
import
showRenameTagDialog
from
"../RenameTagDialog"
;
import
TagTree
from
"../TagTree"
;
import
{
Popover
,
PopoverContent
,
PopoverTrigger
}
from
"../ui/popover"
;
interface
Props
{
readonly
?:
boolean
;
...
...
@@ -59,17 +60,17 @@ const TagsSection = (props: Props) => {
<
div
className=
"flex flex-col justify-start items-start w-full mt-3 px-1 h-auto shrink-0 flex-nowrap hide-scrollbar"
>
<
div
className=
"flex flex-row justify-between items-center w-full gap-1 mb-1 text-sm leading-6 text-gray-400 select-none"
>
<
span
>
{
t
(
"common.tags"
)
}
</
span
>
<
Dropdown
>
<
MenuButton
slots=
{
{
root
:
"div"
}
}
>
<
Popover
>
<
PopoverTrigger
>
<
Icon
.
MoreHorizontal
className=
"w-4 h-auto shrink-0 opacity-60"
/>
</
MenuButton
>
<
Menu
size=
"sm"
placement=
"bottom-end"
>
<
MenuItem
>
<
span
className=
"text-sm shrink-0
mr-2
"
>
Tree mode
</
span
>
</
PopoverTrigger
>
<
PopoverContent
>
<
div
className=
"w-auto flex flex-row justify-between items-center gap-2"
>
<
span
className=
"text-sm shrink-0"
>
Tree mode
</
span
>
<
Switch
size=
"sm"
checked=
{
treeMode
}
onChange=
{
(
event
)
=>
setTreeMode
(
event
.
target
.
checked
)
}
/>
</
MenuItem
>
</
Menu
>
</
Dropdown
>
</
div
>
</
PopoverContent
>
</
Popover
>
</
div
>
{
tagAmounts
.
length
>
0
?
(
treeMode
?
(
...
...
web/src/components/ui/popover.tsx
0 → 100644
View file @
878fea5f
import
*
as
PopoverPrimitive
from
"@radix-ui/react-popover"
;
import
clsx
from
"clsx"
;
import
*
as
React
from
"react"
;
const
Popover
=
PopoverPrimitive
.
Root
;
const
PopoverTrigger
=
PopoverPrimitive
.
Trigger
;
const
PopoverContent
=
React
.
forwardRef
<
React
.
ElementRef
<
typeof
PopoverPrimitive
.
Content
>
,
React
.
ComponentPropsWithoutRef
<
typeof
PopoverPrimitive
.
Content
>
// eslint-disable-next-line react/prop-types
>
(({
className
,
align
=
"center"
,
sideOffset
=
4
,
...
props
},
ref
)
=>
(
<
PopoverPrimitive
.
Portal
>
<
PopoverPrimitive
.
Content
ref=
{
ref
}
align=
{
align
}
sideOffset=
{
sideOffset
}
className=
{
clsx
(
"z-50 w-auto rounded-md border dark:border-zinc-800 bg-popover p-2 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
,
className
,
)
}
{
...
props
}
/>
</
PopoverPrimitive
.
Portal
>
));
PopoverContent
.
displayName
=
PopoverPrimitive
.
Content
.
displayName
;
export
{
Popover
,
PopoverTrigger
,
PopoverContent
};
web/src/css/tailwind.css
View file @
878fea5f
...
...
@@ -2,6 +2,63 @@
@tailwind
components
;
@tailwind
utilities
;
@layer
base
{
:root
{
--background
:
0
0%
100%
;
--foreground
:
240
10%
3.9%
;
--card
:
0
0%
100%
;
--card-foreground
:
240
10%
3.9%
;
--popover
:
0
0%
100%
;
--popover-foreground
:
240
10%
3.9%
;
--primary
:
240
5.9%
10%
;
--primary-foreground
:
0
0%
98%
;
--secondary
:
240
4.8%
95.9%
;
--secondary-foreground
:
240
5.9%
10%
;
--muted
:
240
4.8%
95.9%
;
--muted-foreground
:
240
3.8%
46.1%
;
--accent
:
240
4.8%
95.9%
;
--accent-foreground
:
240
5.9%
10%
;
--destructive
:
0
84.2%
60.2%
;
--destructive-foreground
:
0
0%
98%
;
--border
:
240
5.9%
90%
;
--input
:
240
5.9%
90%
;
--ring
:
240
10%
3.9%
;
--radius
:
0.5rem
;
--chart-1
:
12
76%
61%
;
--chart-2
:
173
58%
39%
;
--chart-3
:
197
37%
24%
;
--chart-4
:
43
74%
66%
;
--chart-5
:
27
87%
67%
;
}
.dark
{
--background
:
240
10%
3.9%
;
--foreground
:
0
0%
98%
;
--card
:
240
10%
3.9%
;
--card-foreground
:
0
0%
98%
;
--popover
:
240
10%
3.9%
;
--popover-foreground
:
0
0%
98%
;
--primary
:
0
0%
98%
;
--primary-foreground
:
240
5.9%
10%
;
--secondary
:
240
3.7%
15.9%
;
--secondary-foreground
:
0
0%
98%
;
--muted
:
240
3.7%
15.9%
;
--muted-foreground
:
240
5%
64.9%
;
--accent
:
240
3.7%
15.9%
;
--accent-foreground
:
0
0%
98%
;
--destructive
:
0
62.8%
30.6%
;
--destructive-foreground
:
0
0%
98%
;
--border
:
240
3.7%
15.9%
;
--input
:
240
3.7%
15.9%
;
--ring
:
240
4.9%
83.9%
;
--chart-1
:
220
70%
50%
;
--chart-2
:
160
60%
45%
;
--chart-3
:
30
80%
55%
;
--chart-4
:
280
65%
60%
;
--chart-5
:
340
75%
55%
;
}
}
@layer
utilities
{
.hide-scrollbar
{
-ms-overflow-style
:
none
;
/* IE and Edge */
...
...
web/src/utils/utils.ts
0 → 100644
View file @
878fea5f
import
{
type
ClassValue
,
clsx
}
from
"clsx"
;
import
{
twMerge
}
from
"tailwind-merge"
;
export
function
cn
(...
inputs
:
ClassValue
[])
{
return
twMerge
(
clsx
(
inputs
));
}
web/tailwind.config.js
View file @
878fea5f
/* eslint-disable no-undef */
/** @type {import('tailwindcss').Config} */
module
.
exports
=
{
content
:
[
"./index.html"
,
"./src/**/*.{js,ts,tsx}"
],
darkMode
:
"class"
,
darkMode
:
[
"class"
],
content
:
[
"./index.html"
,
"./src/**/*.{ts,tsx}"
],
prefix
:
""
,
theme
:
{
fontSize
:
{
xs
:
".75rem"
,
...
...
@@ -16,6 +17,13 @@ module.exports = {
"5xl"
:
"2.5rem"
,
"6xl"
:
"3rem"
,
},
container
:
{
center
:
true
,
padding
:
"2rem"
,
screens
:
{
"2xl"
:
"1400px"
,
},
},
extend
:
{
spacing
:
{
112
:
"28rem"
,
...
...
@@ -33,7 +41,61 @@ module.exports = {
gridTemplateRows
:
{
7
:
"repeat(7, minmax(0, 1fr))"
,
},
colors
:
{
border
:
"hsl(var(--border))"
,
input
:
"hsl(var(--input))"
,
ring
:
"hsl(var(--ring))"
,
background
:
"hsl(var(--background))"
,
foreground
:
"hsl(var(--foreground))"
,
primary
:
{
DEFAULT
:
"hsl(var(--primary))"
,
foreground
:
"hsl(var(--primary-foreground))"
,
},
secondary
:
{
DEFAULT
:
"hsl(var(--secondary))"
,
foreground
:
"hsl(var(--secondary-foreground))"
,
},
destructive
:
{
DEFAULT
:
"hsl(var(--destructive))"
,
foreground
:
"hsl(var(--destructive-foreground))"
,
},
muted
:
{
DEFAULT
:
"hsl(var(--muted))"
,
foreground
:
"hsl(var(--muted-foreground))"
,
},
accent
:
{
DEFAULT
:
"hsl(var(--accent))"
,
foreground
:
"hsl(var(--accent-foreground))"
,
},
popover
:
{
DEFAULT
:
"hsl(var(--popover))"
,
foreground
:
"hsl(var(--popover-foreground))"
,
},
card
:
{
DEFAULT
:
"hsl(var(--card))"
,
foreground
:
"hsl(var(--card-foreground))"
,
},
},
borderRadius
:
{
lg
:
"var(--radius)"
,
md
:
"calc(var(--radius) - 2px)"
,
sm
:
"calc(var(--radius) - 4px)"
,
},
keyframes
:
{
"accordion-down"
:
{
from
:
{
height
:
"0"
},
to
:
{
height
:
"var(--radix-accordion-content-height)"
},
},
"accordion-up"
:
{
from
:
{
height
:
"var(--radix-accordion-content-height)"
},
to
:
{
height
:
"0"
},
},
},
animation
:
{
"accordion-down"
:
"accordion-down 0.2s ease-out"
,
"accordion-up"
:
"accordion-up 0.2s ease-out"
,
},
},
},
plugins
:
[],
plugins
:
[
require
(
"tailwindcss-animate"
)
],
};
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