Vector Motion
Education

Homework Status Card - Assignment Tracking

Monitor homework submission status and completion rates. Track assignment deadlines and student progress.

Homework Status Card

The Homework Status Card displays weekly homework status, showing completed, pending, and late assignments.

Preview

Installation

npx shadcn@latest add https://vectormotion.vercel.app/registry/homework-status-card.json
Homework Status Card
'use client'import React from 'react';import { CheckSquare } from 'lucide-react';import { motion } from 'motion/react';import { clsx, type ClassValue } from "clsx";import { twMerge } from "tailwind-merge";import { ResponsiveContainer, PieChart, Pie, Cell, Tooltip } from 'recharts';function cn(...inputs: ClassValue[]) {  return twMerge(clsx(inputs));}interface HomeworkData {  name: string;  count: number;  color: string;  [key: string]: any;}interface HomeworkStatusCardProps {  className?: string;  title?: string;  subtitle?: string;  data?: HomeworkData[];  overallProgress?: string;  completedLabel?: string;  completedValue?: string;  pendingLabel?: string;  pendingValue?: string;  nextTaskLabel?: string;  nextTaskName?: string;  nextTaskDue?: string;}const DEFAULT_DATA: HomeworkData[] = [  { name: 'Done', count: 8, color: '#10b981' },  { name: 'Pending', count: 2, color: '#e4e4e7' },  { name: 'Late', count: 1, color: '#ef4444' },];const DEFAULT_TITLE = "Homework";const DEFAULT_SUBTITLE = "Weekly Status";const DEFAULT_OVERALL_PROGRESS = "80%";const DEFAULT_COMPLETED_LABEL = "Completed";const DEFAULT_COMPLETED_VALUE = "8/11";const DEFAULT_PENDING_LABEL = "Pending";const DEFAULT_PENDING_VALUE = "2";const DEFAULT_NEXT_TASK_LABEL = "Up Next";const DEFAULT_NEXT_TASK_NAME = "Math: Algebra II #4";const DEFAULT_NEXT_TASK_DUE = "Due Tomorrow";export const HomeworkStatusCard: React.FC<HomeworkStatusCardProps> = ({  className = "",  title = DEFAULT_TITLE,  subtitle = DEFAULT_SUBTITLE,  data = DEFAULT_DATA,  overallProgress = DEFAULT_OVERALL_PROGRESS,  completedLabel = DEFAULT_COMPLETED_LABEL,  completedValue = DEFAULT_COMPLETED_VALUE,  pendingLabel = DEFAULT_PENDING_LABEL,  pendingValue = DEFAULT_PENDING_VALUE,  nextTaskLabel = DEFAULT_NEXT_TASK_LABEL,  nextTaskName = DEFAULT_NEXT_TASK_NAME,  nextTaskDue = DEFAULT_NEXT_TASK_DUE,}) => {  return (    <motion.div      initial={{ opacity: 0, y: 20 }}      animate={{ opacity: 1, y: 0 }}      transition={{ duration: 0.5, delay: 0.2 }}      className={cn(        "relative overflow-hidden rounded-2xl border border-border bg-card text-card-foreground shadow-sm transition-all hover:border-emerald-300 dark:hover:border-emerald-700 hover:shadow-md flex flex-col h-full",        className      )}    >      <div className="p-5 flex flex-col h-full relative z-10">        <div className="mb-4 flex items-start justify-between">          <div>            <h3 className="font-bold text-lg text-foreground">              {title}            </h3>            <p className="text-sm text-muted-foreground font-medium">              {subtitle}            </p>          </div>          <div className="rounded-xl bg-emerald-500/10 p-2.5 text-emerald-500 dark:text-emerald-400 flex items-center justify-center ring-1 ring-emerald-100 dark:ring-emerald-800">            <CheckSquare className="h-5 w-5" />          </div>        </div>        <div className="flex-1 w-full min-h-[120px] flex items-center justify-between gap-2">          <div className="h-[120px] w-[120px] relative shrink-0">            <ResponsiveContainer width="100%" height="100%">              <PieChart>                <Pie                  data={data}                  innerRadius={30}                  outerRadius={50}                  paddingAngle={5}                  dataKey="count"                  stroke="none"                >                  {data.map((entry, index) => (                    <Cell key={`cell-${index}`} fill={entry.color} />                  ))}                </Pie>                <Tooltip cursor={false} content={() => null} />              </PieChart>            </ResponsiveContainer>            <div className="absolute inset-0 flex items-center justify-center">              <span className="text-xl font-bold text-foreground">{overallProgress}</span>            </div>          </div>          <div className="flex-1 space-y-2">            <div className="flex justify-between text-xs">              <span className="text-muted-foreground">{completedLabel}</span>              <span className="font-bold text-emerald-600">{completedValue}</span>            </div>            <div className="flex justify-between text-xs">              <span className="text-muted-foreground">{pendingLabel}</span>              <span className="font-bold text-foreground">{pendingValue}</span>            </div>            <div className="mt-2 pt-2 border-t border-border">              <p className="text-[10px] text-muted-foreground uppercase tracking-wider mb-1">{nextTaskLabel}</p>              <p className="text-xs font-medium text-foreground truncate">{nextTaskName}</p>              <p className="text-[10px] text-red-500">{nextTaskDue}</p>            </div>          </div>        </div>      </div>      <div className="absolute -bottom-4 -right-4 z-0 opacity-5 pointer-events-none">        <CheckSquare className="w-32 h-32 text-emerald-500" />      </div>    </motion.div>  );};

Usage

This component helps students track their homework completion status, providing a clear view of assignments by status.

Prop

Type