Vector Motion
Education

Library Due Date Card - Book Management

Track library book due dates and overdue materials. Monitor circulation and library resource usage.

Library Due Date Card

The Library Due Date Card displays books currently on loan with due date information and overdue warnings.

Preview

Installation

npx shadcn@latest add https://vectormotion.vercel.app/registry/library-due-date-card.json
Library Due Date Card
'use client'import React from 'react';import { Book } from 'lucide-react';import { motion } from 'motion/react';import { clsx, type ClassValue } from "clsx";import { twMerge } from "tailwind-merge";import { ResponsiveContainer, RadialBarChart, RadialBar, Tooltip } from 'recharts';function cn(...inputs: ClassValue[]) {  return twMerge(clsx(inputs));}interface DueDateData {  name: string;  count: number;  fill: string;  [key: string]: any;}interface LibraryDueDateCardProps {  className?: string;  title?: string;  subtitle?: string;  totalBooks?: number;  data?: DueDateData[];}const DEFAULT_DATA: DueDateData[] = [  { name: 'Overdue', count: 2, fill: '#ef4444' },  { name: 'Due Today', count: 1, fill: '#f59e0b' },  { name: 'Due Later', count: 5, fill: '#6366f1' },];const DEFAULT_TITLE = "Library";const DEFAULT_SUBTITLE = "Books on Loan";const DEFAULT_TOTAL_BOOKS = 8;export const LibraryDueDateCard: React.FC<LibraryDueDateCardProps> = ({  className = "",  title = DEFAULT_TITLE,  subtitle = DEFAULT_SUBTITLE,  totalBooks = DEFAULT_TOTAL_BOOKS,  data = DEFAULT_DATA,}) => {  return (    <motion.div      initial={{ opacity: 0, y: 20 }}      animate={{ opacity: 1, y: 0 }}      transition={{ duration: 0.5, delay: 0.3 }}      className={cn(        "relative overflow-hidden rounded-2xl border border-border bg-card text-card-foreground shadow-sm transition-all hover:border-indigo-300 dark:hover:border-indigo-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-indigo-50 dark:bg-indigo-900/20 p-2.5 text-indigo-500 dark:text-indigo-400 flex items-center justify-center ring-1 ring-indigo-100 dark:ring-indigo-800">            <Book className="h-5 w-5" />          </div>        </div>        <div className="flex-1 w-full min-h-[120px] relative">          <ResponsiveContainer width="100%" height="100%">            <RadialBarChart              cx="50%"              cy="50%"              innerRadius="40%"              outerRadius="100%"              barSize={10}              data={data}              startAngle={90}              endAngle={450}            >              <RadialBar                background                dataKey="count"                cornerRadius={10}              />              <Tooltip cursor={false} content={() => null} />            </RadialBarChart>          </ResponsiveContainer>          <div className="absolute inset-0 flex items-center justify-center pointer-events-none">            <div className="text-center">              <span className="text-xl font-bold text-foreground">{totalBooks}</span>              <p className="text-[10px] text-muted-foreground uppercase tracking-wider">Total</p>            </div>          </div>        </div>      </div>      <div className="absolute -bottom-4 -right-4 z-0 opacity-5 pointer-events-none">        <Book className="w-32 h-32 text-indigo-500" />      </div>    </motion.div >  );};

Usage

This component helps students track their library book loans and due dates, preventing overdue fines.

Prop

Type