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
1b69b73e
Commit
1b69b73e
authored
Jan 23, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update calendar styles
parent
3dbb254a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
14 deletions
+16
-14
ActivityCalendar.tsx
web/src/components/ActivityCalendar.tsx
+15
-13
Timeline.tsx
web/src/pages/Timeline.tsx
+1
-1
No files found.
web/src/components/ActivityCalendar.tsx
View file @
1b69b73e
...
...
@@ -9,20 +9,20 @@ interface Props {
onClick
?:
(
date
:
string
)
=>
void
;
}
const
get
BgColor
=
(
count
:
number
,
maxCount
:
number
)
=>
{
const
get
CellAdditionalStyles
=
(
count
:
number
,
maxCount
:
number
)
=>
{
if
(
count
===
0
)
{
return
"bg-gray-100
dark:bg-gray-7
00"
;
return
"bg-gray-100
text-gray-400 dark:bg-gray-700 dark:text-gray-5
00"
;
}
const
ratio
=
count
/
maxCount
;
if
(
ratio
>
0.7
)
{
return
"bg-blue-600"
;
return
"bg-blue-600
text-gray-200
"
;
}
else
if
(
ratio
>
0.5
)
{
return
"bg-blue-400"
;
return
"bg-blue-400
text-gray-200 dark:opacity-80
"
;
}
else
if
(
ratio
>
0.3
)
{
return
"bg-blue-300"
;
return
"bg-blue-300
text-gray-200 dark:opacity-80
"
;
}
else
{
return
"bg-blue-200"
;
return
"bg-blue-200
text-gray-200 dark:opacity-80
"
;
}
};
...
...
@@ -47,7 +47,7 @@ const ActivityCalendar = (props: Props) => {
}
return
(
<
div
className=
{
classNames
(
"w-
28
h-auto p-0.5 shrink-0 grid grid-cols-7 grid-flow-row gap-1"
)
}
>
<
div
className=
{
classNames
(
"w-
36
h-auto p-0.5 shrink-0 grid grid-cols-7 grid-flow-row gap-1"
)
}
>
{
days
.
map
((
day
,
index
)
=>
{
const
date
=
getNormalizedDateString
(
`${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`
);
const
count
=
data
[
date
]
||
0
;
...
...
@@ -57,19 +57,21 @@ const ActivityCalendar = (props: Props) => {
<
Tooltip
className=
"shrink-0"
key=
{
`${date}-${index}`
}
title=
{
tooltipText
}
placement=
"top"
arrow
>
<
div
className=
{
classNames
(
"w-
3 h-3 rounde
d flex justify-center items-center border border-transparent"
,
get
BgColor
(
count
,
maxCount
),
isToday
&&
"border-gray-600 dark:!border-gray-
4
00"
"w-
4 h-4 text-[9px] rounded-m
d flex justify-center items-center border border-transparent"
,
get
CellAdditionalStyles
(
count
,
maxCount
),
isToday
&&
"border-gray-600 dark:!border-gray-
5
00"
)
}
onClick=
{
()
=>
count
&&
onClick
&&
onClick
(
date
)
}
></
div
>
>
{
day
}
</
div
>
</
Tooltip
>
)
:
(
<
div
key=
{
`${date}-${index}`
}
className=
{
classNames
(
"shrink-0 opacity-30 w-
3 h-3 rounde
d flex justify-center items-center border border-transparent"
,
get
BgColor
(
count
,
maxCount
)
"shrink-0 opacity-30 w-
4 h-4 rounded-m
d flex justify-center items-center border border-transparent"
,
get
CellAdditionalStyles
(
count
,
maxCount
)
)
}
></
div
>
);
...
...
web/src/pages/Timeline.tsx
View file @
1b69b73e
...
...
@@ -145,7 +145,7 @@ const Timeline = () => {
{
groupedByMonth
.
map
((
group
,
index
)
=>
(
<
Fragment
key=
{
group
.
month
}
>
<
div
className=
{
classNames
(
"flex justify-start items-start w-full mt-2 last:mb-4"
,
md
?
"flex-row"
:
"flex-col"
)
}
>
<
div
className=
{
classNames
(
"flex shrink-0"
,
md
?
"flex-col w-
32
pr-4 pl-2 pb-8"
:
"flex-row w-full pl-1 mt-2 mb-2"
)
}
>
<
div
className=
{
classNames
(
"flex shrink-0"
,
md
?
"flex-col w-
40
pr-4 pl-2 pb-8"
:
"flex-row w-full pl-1 mt-2 mb-2"
)
}
>
<
div
className=
{
classNames
(
"w-full flex flex-col"
,
md
&&
"mt-4 mb-2"
)
}
>
<
span
className=
"font-medium text-3xl leading-none mb-1"
>
{
new
Date
(
group
.
month
).
toLocaleString
(
i18n
.
language
,
{
month
:
"short"
})
}
...
...
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