DiskManagementReviewAndSubmitDialog.components.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { cn } from 'ui'
  2. import { formatCurrency } from '@/lib/helpers'
  3. export interface BreakdownRowProps {
  4. label: string
  5. description?: string
  6. children: React.ReactNode
  7. }
  8. export const BreakdownRow = ({ label, description, children }: BreakdownRowProps) => (
  9. <div className="flex items-start justify-between py-3 px-0 border-b border-dashed last:border-b-0">
  10. <div className="flex flex-col gap-0.5">
  11. <span className="text-sm text-foreground-light">{label}</span>
  12. {description && <span className="text-xs text-warning-600 max-w-72">{description}</span>}
  13. </div>
  14. {children}
  15. </div>
  16. )
  17. export const ValueChange = ({ from, to }: { from: string; to: string }) => (
  18. <span className="text-sm font-mono uppercase">
  19. <span className="text-foreground-lighter">{from}</span>
  20. <span className="text-foreground-lighter mx-2">&rarr;</span>
  21. <span className="text-foreground">{to}</span>
  22. </span>
  23. )
  24. export const PriceDelta = ({ delta }: { delta: number }) => (
  25. <span className={cn('text-xs', delta >= 0 ? 'text-brand' : 'text-destructive')}>
  26. {delta >= 0 ? `+${formatCurrency(delta)}` : `-${formatCurrency(Math.abs(delta))}`}{' '}
  27. <span className="text-foreground-lighter">per month</span>
  28. </span>
  29. )