-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: implement UI for student dashboard
- Loading branch information
1 parent
97760fb
commit 0e29407
Showing
10 changed files
with
204 additions
and
206 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import Image from 'next/image'; | ||
import React from 'react'; | ||
|
||
// Import Image từ next/image | ||
|
||
interface CourseCardProps { | ||
title: string; | ||
currentLesson: string; | ||
thumbnail: string; | ||
completed: string; | ||
} | ||
|
||
const CourseCard: React.FC<CourseCardProps> = ({ | ||
title, | ||
currentLesson, | ||
thumbnail, | ||
completed, | ||
}) => { | ||
// Kiểm tra nếu completed là "0%" | ||
const isCompletedZero = completed === '0%'; | ||
|
||
return ( | ||
<div className="p-6 bg-white border rounded-lg shadow-md mb-0 flex flex-col justify-between h-full"> | ||
{/* Phần 1: Hình ảnh và nội dung */} | ||
<div> | ||
{/* Sử dụng Image thay cho img */} | ||
<div className="relative w-full h-40 mb-4"> | ||
<Image | ||
src={thumbnail} | ||
alt={title} | ||
layout="fill" // Đặt layout fill để tự động phù hợp với container | ||
objectFit="cover" // Đảm bảo hình ảnh không bị méo | ||
className="rounded-lg" | ||
/> | ||
</div> | ||
|
||
<h3 className="text-xl font-semibold text-gray-900">{title}</h3> | ||
<p className="text-gray-500 mt-1">{currentLesson}</p> | ||
</div> | ||
|
||
{/* Phần 2: Nút và tiến độ (được đẩy xuống dưới cùng) */} | ||
<div className="mt-auto"> | ||
<hr className="my-4 border-gray-300 w-full" /> | ||
|
||
<div className="mt-6"> | ||
<div className="flex flex-col items-start space-y-4"> | ||
{/* Thanh tiến độ */} | ||
<div className="w-full"> | ||
<p | ||
className={`font-semibold mb-2 ${isCompletedZero ? 'text-gray-500' : ''}`} | ||
> | ||
{isCompletedZero ? 'Not Started' : `${completed} Completed`} | ||
</p> | ||
<div className="w-full h-2 bg-gray-300 rounded-full"> | ||
<div | ||
className={`h-2 ${isCompletedZero ? 'bg-gray-300' : 'bg-green-600'} rounded-full`} | ||
style={{ width: isCompletedZero ? '100%' : completed }} | ||
></div> | ||
</div> | ||
</div> | ||
<button className="bg-orange-500 text-white w-full py-2 rounded-lg mt-0"> | ||
Watch Lecture | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CourseCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react'; | ||
|
||
import CourseCard from './CourseCard'; | ||
|
||
const courses = [ | ||
{ | ||
id: 1, | ||
title: 'Reiki Level I, II and Master/Teacher Program', | ||
currentLesson: '1. Introductions', | ||
thumbnail: '/app/course/course01.png', | ||
completed: '0%', | ||
}, | ||
{ | ||
id: 2, | ||
title: 'The Complete 2021 Web Development Bootcamp', | ||
currentLesson: "167. What You'll Need to Get Started", | ||
thumbnail: '/app/course/course02.png', | ||
completed: '61%', | ||
}, | ||
{ | ||
id: 3, | ||
title: 'Copywriting - Become a Freelance Copywriter', | ||
currentLesson: '1. How to get started with figma', | ||
thumbnail: '/app/course/course03.png', | ||
completed: '0%', | ||
}, | ||
{ | ||
id: 4, | ||
title: '2021 Complete Python Bootcamp From Zero to Mastery', | ||
currentLesson: '9. Advanced CSS - Selector Priority', | ||
thumbnail: '/app/course/course04.png', | ||
completed: '12%', | ||
}, | ||
]; | ||
|
||
const CoursesSection = () => ( | ||
<div className="bg-white p-6 rounded-lg shadow-md"> | ||
<h2 className="text-2xl font-semibold">Lets start learning</h2> | ||
<div className="grid grid-cols-4 gap-6 mt-4"> | ||
{courses.map((course) => ( | ||
<CourseCard key={course.id} {...course} /> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
|
||
export default CoursesSection; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
|
||
interface StatProps { | ||
icon: React.ReactNode; | ||
value: string | number; | ||
label: string; | ||
bgColor: string; | ||
} | ||
|
||
const Stat: React.FC<StatProps> = ({ icon, value, label, bgColor }) => ( | ||
<div className={`p-6 rounded-lg ${bgColor} flex items-center space-x-4`}> | ||
<div className="bg-white p-4 rounded-full text-orange-500 text-2xl"> | ||
{icon} | ||
</div> | ||
<div> | ||
<h2 className="text-xl font-semibold">{value}</h2> | ||
<p className="text-gray-500">{label}</p> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default Stat; |
Oops, something went wrong.