Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VCCI-News
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ăn Hoàng
VCCI-News
Commits
5dc31199
Commit
5dc31199
authored
Nov 03, 2025
by
Phạm Quang Bảo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix/design home page
parent
56b6b49f
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
172 additions
and
68 deletions
+172
-68
index.tsx
src/app/(main)/(home)/components/event-calendar/index.tsx
+113
-0
page.tsx
src/app/(main)/(home)/page.tsx
+59
-68
No files found.
src/app/(main)/(home)/components/event-calendar/index.tsx
0 → 100644
View file @
5dc31199
"use client"
;
import
React
,
{
useState
}
from
"react"
;
import
{
ArrowRight
,
ArrowLeft
}
from
"lucide-react"
;
export
default
function
EventCalendar
()
{
const
mockCalendar
=
{
month
:
10
,
year
:
2025
,
highlighted
:
[
6
,
9
,
12
],
};
const
[
month
,
setMonth
]
=
useState
<
number
>
(
mockCalendar
.
month
);
const
[
year
,
setYear
]
=
useState
<
number
>
(
mockCalendar
.
year
);
return
(
<
div
className=
"bg-white border rounded-md p-4"
>
<
div
className=
"flex items-center justify-between mb-3"
>
<
div
className=
"text-sm font-medium"
>
THÁNG
{
month
}
/
{
year
}
</
div
>
<
div
className=
"flex items-center gap-2"
>
<
div
className=
"group"
>
<
button
aria
-
label=
"Tháng trước"
onClick=
{
()
=>
{
// prev month
if
(
month
===
1
)
{
setMonth
(
12
);
setYear
((
y
)
=>
y
-
1
);
}
else
{
setMonth
((
m
)
=>
m
-
1
);
}
}
}
className=
"group-hover:border-primary p-1 h-10 w-10 flex items-center justify-center rounded-full border-2 border-[#363636] "
>
<
ArrowLeft
size=
{
24
}
className=
"group-hover:text-muted-foreground text-[#363636]"
/>
</
button
>
</
div
>
<
div
className=
"group"
>
<
button
aria
-
label=
"Tháng sau"
onClick=
{
()
=>
{
// next month
if
(
month
===
12
)
{
setMonth
(
1
);
setYear
((
y
)
=>
y
+
1
);
}
else
{
setMonth
((
m
)
=>
m
+
1
);
}
}
}
className=
"p-1 group-hover:border-primary h-10 w-10 flex items-center justify-center rounded-full border-2 border-[#363636]"
>
<
ArrowRight
size=
{
24
}
className=
"group-hover:text-muted-foreground"
/>
</
button
>
</
div
>
</
div
>
</
div
>
<
div
className=
"grid grid-cols-7 gap-1 text-center text-xs"
>
{
[
"CN"
,
"T2"
,
"T3"
,
"T4"
,
"T5"
,
"T6"
,
"T7"
].
map
((
d
)
=>
(
<
div
key=
{
d
}
className=
"text-gray-400 py-1"
>
{
d
}
</
div
>
))
}
{
(()
=>
{
const
totalDays
=
new
Date
(
year
,
month
,
0
).
getDate
()
const
firstDayIndex
=
new
Date
(
year
,
month
-
1
,
1
).
getDay
()
// 0 (Sun) - 6 (Sat)
// previous month total days
const
prevMonthTotalDays
=
new
Date
(
year
,
month
-
1
,
0
).
getDate
()
const
totalCells
=
firstDayIndex
+
totalDays
const
trailingCount
=
(
7
-
(
totalCells
%
7
))
%
7
return
(
<>
{
Array
.
from
({
length
:
firstDayIndex
}).
map
((
_
,
i
)
=>
{
const
dayNum
=
prevMonthTotalDays
-
(
firstDayIndex
-
1
)
+
i
return
(
<
div
key=
{
`prev-${i}`
}
className=
"py-2 text-sm text-gray-300"
>
{
dayNum
}
</
div
>
)
})
}
{
Array
.
from
({
length
:
totalDays
},
(
_
,
i
)
=>
i
+
1
).
map
((
day
)
=>
{
const
isHighlighted
=
mockCalendar
.
highlighted
.
includes
(
day
)
return
(
<
div
key=
{
day
}
className=
{
`py-2 rounded-full w-10 h-10 flex flex-col justify-center items-center text-sm ${isHighlighted ? 'bg-yellow-500 text-white' : 'text-gray-700'
}`
}
>
{
day
}
</
div
>
)
})
}
{
Array
.
from
({
length
:
trailingCount
}).
map
((
_
,
i
)
=>
(
<
div
key=
{
`next-${i}`
}
className=
"py-2 text-sm text-gray-300"
>
{
i
+
1
}
</
div
>
))
}
</>
)
})()
}
</
div
>
</
div
>
);
}
src/app/(main)/(home)/page.tsx
View file @
5dc31199
This diff is collapsed.
Click to expand it.
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