import { ReactNode } from "react"; import { Button } from "@/components/ui/button"; import { ChevronUp, ChevronDown } from "lucide-react"; import { cn } from "@/lib/utils"; import { useState } from "react"; interface StickyBottomBarProps { summary: ReactNode; actions: ReactNode; expandable?: boolean; expandedContent?: ReactNode; className?: string; } export function StickyBottomBar({ summary, actions, expandable = false, expandedContent, className }: StickyBottomBarProps) { const [isExpanded, setIsExpanded] = useState(false); return (
{/* Expanded Content */} {expandable && isExpanded && expandedContent && (
{expandedContent}
)} {/* Main Bar */}
{/* Summary */}
{summary}
{/* Actions */}
{actions}
{/* Expand Toggle */} {expandable && expandedContent && ( )}
); } // Preset variations for common use cases interface FormBottomBarProps { totalLabel: string; totalValue: string | number; saveLabel?: string; onSave: () => void; cancelLabel?: string; onCancel?: () => void; saveDisabled?: boolean; expandable?: boolean; breakdown?: Array<{ label: string; value: string | number }>; } export function FormBottomBar({ totalLabel, totalValue, saveLabel = "जतन करा", onSave, cancelLabel, onCancel, saveDisabled = false, expandable = false, breakdown }: FormBottomBarProps) { return (
{totalLabel}
{typeof totalValue === 'number' ? `₹${totalValue.toLocaleString('en-IN')}` : totalValue }
} actions={ <> {cancelLabel && onCancel && ( )} } expandable={expandable} expandedContent={ breakdown && (
तपशील
{breakdown.map((item, index) => (
{item.label} {typeof item.value === 'number' ? `₹${item.value.toLocaleString('en-IN')}` : item.value }
))}
) } /> ); } // Simple action bar interface ActionBottomBarProps { primaryAction: { label: string; onClick: () => void; disabled?: boolean; variant?: "default" | "destructive"; }; secondaryAction?: { label: string; onClick: () => void; }; } export function ActionBottomBar({ primaryAction, secondaryAction }: ActionBottomBarProps) { return (
{secondaryAction && ( )}
); } // Info bar with single action interface InfoBottomBarProps { icon?: ReactNode; title: string; description?: string; action: { label: string; onClick: () => void; icon?: ReactNode; }; } export function InfoBottomBar({ icon, title, description, action }: InfoBottomBarProps) { return (
{icon && (
{icon}
)}
{title}
{description && (
{description}
)}
); }