mirror of
https://github.com/vercel/next-learn.git
synced 2026-07-07 14:09:06 +00:00
* Run create-next-app * Add READMEs * Remove stuff we don't need * Add dummy data * Add types for dummy data * Add dummy routes * Remove unused CSS * Split dummy data and definitions * Add prettier plugin for tailwind * Create background-blur.tsx * Create hero.tsx * Create login-form.tsx * Tweak * Install hero icons and clsx * Create calculations.tsx * Update dummy-data.tsx * Create card.tsx * Create dashboard-overview.tsx * Update page.tsx * Add placeholder for dashboard-topnav * Adjust sizings for whole page * Update card styles and add icons * ugh, fonts are hard * misc * Remo unused import
15 lines
373 B
TypeScript
15 lines
373 B
TypeScript
import { Invoice } from "./definitions";
|
|
|
|
export const calculateInvoices = (
|
|
invoices: Invoice[],
|
|
status: "pending" | "paid",
|
|
) => {
|
|
return invoices
|
|
.filter((invoice) => !status || invoice.status === status)
|
|
.reduce((total, invoice) => total + invoice.amount / 100, 0)
|
|
.toLocaleString("en-US", {
|
|
style: "currency",
|
|
currency: "USD",
|
|
});
|
|
};
|