web: port library page to clientside, router performance improvements

This commit is contained in:
Jens Langhammer
2020-11-30 12:33:09 +01:00
parent 775d80de6d
commit 1193608631
14 changed files with 287 additions and 387 deletions

View File

@ -20,3 +20,11 @@ export function convertToSlug(text: string): string {
.replace(/ /g, "-")
.replace(/[^\w-]+/g, "");
}
export function truncate(input?: string, max = 10): string {
input = input || "";
const array = input.trim().split(" ");
const ellipsis = array.length > max ? "..." : "";
return array.slice(0, max).join(" ") + ellipsis;
}