Vector Motion
Education

Facility Status Card - Campus Management

Monitor campus facility status and maintenance needs. Track building conditions and maintenance requests.

Facility Status Card

The Facility Status Card displays facility maintenance status, showing open tickets and issues that need attention.

Preview

Installation

npx shadcn@latest add https://vectormotion.vercel.app/registry/facility-status-card.json
Facility Status Card
'use client'import React from 'react';import { Wrench } from 'lucide-react';import { motion } from 'motion/react';import { clsx, type ClassValue } from "clsx";import { twMerge } from "tailwind-merge";import { ResponsiveContainer, BarChart, Bar, Tooltip, XAxis, Cell } from 'recharts';function cn(...inputs: ClassValue[]) {  return twMerge(clsx(inputs));}interface FacilityData {  type: string;  count: number;  color: string;  [key: string]: any;}interface FacilityStatusCardProps {  className?: string;  title?: string;  subtitle?: string;  data?: FacilityData[];}const DEFAULT_DATA: FacilityData[] = [  { type: 'HVAC', count: 3, color: '#ef4444' },  { type: 'Plumbing', count: 1, color: '#f59e0b' },  { type: 'Electrical', count: 2, color: '#eab308' },];const DEFAULT_TITLE = "Facilities";const DEFAULT_SUBTITLE = "Maintenance Tickets";export const FacilityStatusCard: React.FC<FacilityStatusCardProps> = ({  className = "",  title = DEFAULT_TITLE,  subtitle = DEFAULT_SUBTITLE,  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-amber-300 dark:hover:border-amber-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-amber-500/10 p-2.5 text-amber-500 dark:text-amber-400 flex items-center justify-center ring-1 ring-amber-100 dark:ring-amber-800">            <Wrench className="h-5 w-5" />          </div>        </div>        <div className="flex-1 w-full min-h-[100px]">          <ResponsiveContainer width="100%" height="100%">            <BarChart data={data}>              <XAxis                dataKey="type"                axisLine={false}                tickLine={false}                tick={{ fontSize: 10, fill: '#71717a' }}              />              <Tooltip                cursor={{ fill: 'transparent' }}                content={({ active, payload }) => {                  if (active && payload && payload.length) {                    return (                      <div className="rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-800 p-2 shadow-sm text-xs">                        <span className="font-bold">{payload[0].payload.type}:</span> {payload[0].value} tickets                      </div>                    );                  }                  return null;                }}              />              <Bar dataKey="count" radius={[4, 4, 0, 0]}>                {data.map((entry, index) => (                  <Cell key={`cell-${index}`} fill={entry.color} />                ))}              </Bar>            </BarChart>          </ResponsiveContainer>        </div>        <div className="absolute -bottom-4 -right-4 z-0 opacity-5 pointer-events-none">          <Wrench className="w-32 h-32 text-amber-500" />        </div>      </div>    </motion.div>  );};

Usage

This component helps facilities management track maintenance requests and ensure school facilities remain in good condition.

Prop

Type