Just use page count for book width

This commit is contained in:
Evan Fiordeliso 2025-07-05 10:51:06 -04:00
parent b9f146f922
commit 94fe4d5f1c
2 changed files with 5 additions and 7 deletions

View File

@ -84,8 +84,6 @@
return 1;
}
}
const calculateWidth = (pageCount: number) =>
Math.max(10, Math.min(1000, 200 + pageCount * 10));
function getBookData(metadata: FileMetadata): BookData {
return {
@ -94,9 +92,9 @@
? metadata.frontmatter[settings.subtitleProperty]
: undefined,
author: metadata.frontmatter[settings.authorsProperty].join(", "),
width: calculateWidth(
metadata.frontmatter[settingsStore.settings.pageCountProperty],
),
width: metadata.frontmatter[
settingsStore.settings.pageCountProperty
],
color: randomColor(),
design: randomDesign(),
orientation: randomOrientation(),

View File

@ -41,7 +41,7 @@
onClick,
}: BookProps = $props();
function widthCheck(input: number | undefined) {
function normalizeWidth(input: number | undefined) {
if (input) {
if (input <= 150) {
return BOOK_SIZE_MIN;
@ -57,7 +57,7 @@
: Color.fromCSSColor(colorRaw),
);
const verifiedWidth = $derived(widthCheck(width));
const verifiedWidth = $derived(normalizeWidth(width));
</script>
{#if orientation}