diff --git a/src/ui/code-blocks/BookshelfCodeBlockView.svelte b/src/ui/code-blocks/BookshelfCodeBlockView.svelte index cc2e81e..5e0fd9a 100644 --- a/src/ui/code-blocks/BookshelfCodeBlockView.svelte +++ b/src/ui/code-blocks/BookshelfCodeBlockView.svelte @@ -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(), diff --git a/src/ui/components/bookshelf/Book.svelte b/src/ui/components/bookshelf/Book.svelte index 71bbd9e..285f5cd 100644 --- a/src/ui/components/bookshelf/Book.svelte +++ b/src/ui/components/bookshelf/Book.svelte @@ -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)); {#if orientation}