Vector Motion
E-Commerce

Discount Impact Card - Promotional Analysis

Monitor discount effectiveness and promotional impact on sales. Track coupon usage and price optimization results.

Discount Impact Card

The Discount Impact Card Analyze discount effectiveness and margin impact.

Preview

Installation

ash npx shadcn@latest add https://vectormotion.vercel.app/registry/discount-impact-card.json

Discount Impact Card
'use client';import React from "react";import { Percent, Tag } from "lucide-react";import { motion } from "motion/react";import { clsx, type ClassValue } from "clsx";import { twMerge } from "tailwind-merge";function cn(...inputs: ClassValue[]) {  return twMerge(clsx(inputs));}interface Discount {  type: string;  orders: number;  revenue: number;  margin: number;  [key: string]: any;}interface DiscountImpactCardProps {  className?: string;  title?: string;  description?: string;  totalDiscountRevenue?: string;  discounts?: Discount[];}const DEFAULT_TITLE = "Discount Impact";const DEFAULT_DESCRIPTION = "Performance Analysis";const DEFAULT_TOTAL_DISCOUNT_REVENUE = "$56,655";const DEFAULT_DISCOUNTS: Discount[] = [  { type: "10% OFF", orders: 245, revenue: 18375, margin: 72 },  { type: "20% OFF", orders: 189, revenue: 22680, margin: 65 },  { type: "BOGO", orders: 156, revenue: 15600, margin: 58 },];export const DiscountImpactCard: React.FC<DiscountImpactCardProps> = ({  className = "",  title = DEFAULT_TITLE,  description = DEFAULT_DESCRIPTION,  totalDiscountRevenue = DEFAULT_TOTAL_DISCOUNT_REVENUE,  discounts = DEFAULT_DISCOUNTS,}) => {  const isInteractive = true;  const index = 7;  return (    <motion.div      layoutId={isInteractive ? `card-${index}-${title}` : undefined}      transition={{ duration: 0.4, ease: "easeOut" }}      className={cn(        "relative overflow-hidden rounded-xl border border-border bg-card text-card-foreground p-6 shadow-sm transition-all flex flex-col group",        isInteractive          ? "cursor-pointer hover:border-zinc-300 dark:hover:border-zinc-700"          : "",        className,      )}    >      <div className="mb-4 flex items-start justify-between relative z-10">        <div>          <h3 className="font-semibold text-lg tracking-tight text-foreground">            {title}          </h3>          {description && (            <p className="text-sm text-muted-foreground mt-1">{description}</p>          )}        </div>        <div className="rounded-full bg-zinc-100 dark:bg-zinc-800 p-2 text-foreground flex items-center justify-center">          <Tag className="h-5 w-5 text-orange-500" />        </div>      </div>      <div className="relative z-10 flex-1">        <div className="space-y-3">          {discounts.map((discount, idx) => (            <motion.div              key={idx}              initial={{ opacity: 0, y: 10 }}              animate={{ opacity: 1, y: 0 }}              transition={{ duration: 0.5, delay: idx * 0.1 }}              className="bg-muted rounded-lg p-3"            >              <div className="flex items-center justify-between mb-2">                <div className="flex items-center gap-2">                  <div className="px-2 py-1 bg-orange-100 dark:bg-orange-900/30 rounded text-xs font-bold text-orange-500">                    {discount.type}                  </div>                  <span className="text-xs text-muted-foreground">                    {discount.orders} orders                  </span>                </div>                <span className="text-sm font-bold text-foreground">                  ${discount.revenue.toLocaleString()}                </span>              </div>              <div className="flex items-center gap-2">                <span className="text-xs text-muted-foreground">Margin:</span>                <div className="flex-1 bg-zinc-200 dark:bg-zinc-700 rounded-full h-1.5 overflow-hidden">                  <motion.div                    initial={{ width: 0 }}                    animate={{ width: `${discount.margin}%` }}                    transition={{ duration: 1, delay: idx * 0.1 }}                    className={`h-full rounded-full ${discount.margin >= 70                        ? "bg-emerald-500"                        : discount.margin >= 60                          ? "bg-amber-500"                          : "bg-red-500"                      }`}                  />                </div>                <span className="text-xs font-medium text-foreground">                  {discount.margin}%                </span>              </div>            </motion.div>          ))}        </div>        <div className="mt-4 pt-4 border-t border-border">          <div className="flex justify-between items-center text-sm">            <span className="text-muted-foreground">              Total Discount Revenue            </span>            <span className="font-bold text-foreground">              {totalDiscountRevenue}            </span>          </div>        </div>      </div>    </motion.div>  );};

Usage

This component is a data-rich dashboard card displaying e-commerce metrics with animated visualizations and dark mode support. Perfect for dashboards, landing pages, and analytics interfaces.

Prop

Type