Remove static markdown file dependencies and update all pages/components to fetch data directly from Appwrite collections, while maintaining existing service functions for data retrieval and adding new CRUD operations for projects.
23 lines
640 B
TypeScript
23 lines
640 B
TypeScript
import { clsx, type ClassValue } from "clsx"
|
|
import { twMerge } from "tailwind-merge"
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs))
|
|
}
|
|
|
|
export function formatDate(date: Date | string) {
|
|
if (typeof date === "string") date = new Date(date)
|
|
return Intl.DateTimeFormat("en-US", {
|
|
month: "short",
|
|
day: "2-digit",
|
|
year: "numeric"
|
|
}).format(date)
|
|
}
|
|
|
|
export function readingTime(html: string) {
|
|
const textOnly = html.replace(/<[^>]+>/g, "")
|
|
const wordCount = textOnly.split(/\s+/).length
|
|
const readingTimeMinutes = ((wordCount / 200) + 1).toFixed()
|
|
return `${readingTimeMinutes} min read`
|
|
}
|