mirror of
https://github.com/VladSez/easy-invoice-pdf
synced 2026-04-21 13:37:40 +00:00
* feat: update dependencies and enhance invoice form functionality - Added new dependencies: @radix-ui/react-label, @radix-ui/react-slot, class-variance-authority, clsx, sonner, tailwind-merge, and tailwindcss-animate. - Updated package.json and pnpm-lock.yaml to reflect new versions. - Enhanced the invoice form with improved error handling and UI components. - Integrated a toast notification system for better user feedback. - Updated the PDF download link to include invoice language in the filename. - Improved layout and styling in the invoice form and PDF template components. - Refactored state management for invoice data to streamline data loading from URL and local storage. * feat: add Prettier configuration and update project files - Introduced a Prettier configuration file (.prettierrc.js) for consistent code formatting. - Updated package.json to include Prettier and its Tailwind CSS plugin as dependencies. - Made minor formatting adjustments across various components and configuration files for improved readability and consistency. - Enhanced the loading and invoice form components with better styling and layout adjustments. - Ensured all JSON files and configuration files have proper formatting and structure. * feat: enhance invoice sharing and download experience - Updated toast notification to include rich text formatting for better user guidance on sharing invoices. - Increased toast duration for improved visibility. - Refactored layout of the invoice regeneration and download button for better mobile responsiveness. - Added conditional rendering for the PDF download link based on mobile view. - Improved styling consistency across components. * feat: implement responsive PDF download link and add media query hook - Introduced a custom hook `useMediaQuery` to manage responsive behavior. - Updated the `InvoicePDFDownloadLink` component to remove mobile-specific prop and enhance styling. - Modified the main page to conditionally render the PDF download link based on desktop view. - Enabled server-side rendering for the PDF download link for improved performance. * feat: enhance invoice PDF layout and translations - Added a new center style to align content in the invoice items table. - Updated the invoice items table to apply the center style for better visual alignment of headers. - Modified translations for 'netAmount' and 'netPrice' to include line breaks for improved readability in the PDF output. * fix: update link in footer to point to new personal website * feat: add contact link to footer for user engagement
58 lines
2.2 KiB
TypeScript
58 lines
2.2 KiB
TypeScript
import { Slot } from "@radix-ui/react-slot";
|
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
import * as React from "react";
|
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
const buttonVariants = cva(
|
|
"inline-flex items-center justify-center whitespace-nowrap rounded-lg text-sm font-medium transition-colors outline-offset-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring/70 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default:
|
|
"bg-slate-900 text-slate-50 shadow-sm shadow-black/5 hover:bg-slate-900/90 dark:bg-slate-50 dark:text-slate-900 dark:hover:bg-slate-50/90",
|
|
destructive:
|
|
"bg-red-500 text-slate-50 shadow-sm shadow-black/5 hover:bg-red-500/90 dark:bg-red-900 dark:text-slate-50 dark:hover:bg-red-900/90",
|
|
outline:
|
|
"border border-gray-200 bg-white shadow shadow-black/5 hover:bg-slate-100 hover:text-slate-900 dark:border-slate-800 dark:bg-slate-950 dark:hover:bg-slate-800 dark:hover:text-slate-50",
|
|
secondary:
|
|
"bg-slate-100 text-slate-900 shadow-sm shadow-black/5 hover:bg-slate-100/80 dark:bg-slate-800 dark:text-slate-50 dark:hover:bg-slate-800/80",
|
|
ghost:
|
|
"hover:bg-slate-100 hover:text-slate-900 dark:hover:bg-slate-800 dark:hover:text-slate-50",
|
|
link: "text-slate-900 underline-offset-4 hover:underline dark:text-slate-50",
|
|
},
|
|
size: {
|
|
default: "h-9 px-4 py-2",
|
|
sm: "h-8 rounded-lg px-3 text-xs",
|
|
lg: "h-10 rounded-lg px-8",
|
|
icon: "h-9 w-9",
|
|
},
|
|
},
|
|
defaultVariants: {
|
|
variant: "default",
|
|
size: "default",
|
|
},
|
|
}
|
|
);
|
|
|
|
export interface ButtonProps
|
|
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
VariantProps<typeof buttonVariants> {
|
|
asChild?: boolean;
|
|
}
|
|
|
|
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
const Comp = asChild ? Slot : "button";
|
|
return (
|
|
<Comp
|
|
className={cn(buttonVariants({ variant, size, className }))}
|
|
ref={ref}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
);
|
|
Button.displayName = "Button";
|
|
|
|
export { Button, buttonVariants };
|