49 lines
1.7 KiB
JavaScript
49 lines
1.7 KiB
JavaScript
import React from "react";
|
|
import UserLayout from "./Layout/UserLayout";
|
|
import { Link } from "@inertiajs/react";
|
|
import { FaBookOpen } from "react-icons/fa6";
|
|
import { data } from "autoprefixer";
|
|
|
|
const Dashboard = (props) => {
|
|
console.log(props);
|
|
return (
|
|
<UserLayout>
|
|
<div className="w-full flex flex-col py-4 container">
|
|
<h1 className="font-semibold text-xl">
|
|
Pilih Modul Pembelajaran
|
|
</h1>
|
|
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-3 gap-3 mt-4">
|
|
{props.data.map((item, index) => (
|
|
<Link key={index} href={`/user/module/${item.id}`}>
|
|
<CardMaterial
|
|
title={item.name}
|
|
description={item.materi.length}
|
|
/>
|
|
</Link>
|
|
))}
|
|
</div>
|
|
</div>
|
|
</UserLayout>
|
|
);
|
|
};
|
|
|
|
const CardMaterial = ({ title, description }) => {
|
|
const image = title.toLowerCase().includes("baca")
|
|
? "membaca"
|
|
: title.toLowerCase().includes("hitung")
|
|
? "berhitung"
|
|
: "kuis";
|
|
|
|
return (
|
|
<div className="flex flex-col md:flex-row md:items-center py-8 px-6 border-2 rounded-md shadow-md gap-3 hover:bg-gray-100 bg-white">
|
|
<img className="w-16" src={`/assets/images/${image}.png`} alt="" />
|
|
<div className="flex flex-col">
|
|
<h1 className="font-bold text-blue-800">{title}</h1>
|
|
<p className="line-clamp-2 text-xs">{description} Materi</p>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Dashboard;
|