refactor: replace hardcoded colours with semantic tokens

This commit is contained in:
2026-08-11 20:08:53 -04:00
parent f36aa14463
commit f68a233dca
7 changed files with 26 additions and 23 deletions
@@ -31,8 +31,8 @@
selectedState.toggleSelection(book);
}}
class="{selectedState.isSelected(book.id)
? 'scale-110 text-yellow-300'
: 'scale-75 text-white'} transition-all hover:scale-110 hover:cursor-pointer hover:text-yellow-300"
? 'scale-110 text-star'
: 'scale-75 text-white'} transition-all hover:scale-110 hover:cursor-pointer hover:text-star"
/>
</div>
{#if selectedState.isSelected(book.id)}
@@ -42,7 +42,7 @@
: 'opacity-0'} transition-opacity group-hover:opacity-100"
>
<Circle
class="yellow-300 scale-50 fill-yellow-300 text-yellow-300 transition-all hover:scale-75 hover:cursor-pointer hover:text-yellow-300"
class="scale-50 fill-star text-star transition-all hover:scale-75 hover:cursor-pointer hover:text-star"
/>
</div>
{/if}
@@ -54,7 +54,7 @@
<DropdownMenu.Root>
<DropdownMenu.Trigger>
<EllipsisVertical
class="scale-75 text-white transition-all hover:scale-110 hover:cursor-pointer hover:text-yellow-300"
class="scale-75 text-white transition-all hover:scale-110 hover:cursor-pointer hover:text-star"
/>
</DropdownMenu.Trigger>
<DropdownMenu.Content>
@@ -89,7 +89,7 @@
class="absolute right-2 bottom-20 z-50 inline-flex items-center opacity-0 transition-opacity group-hover:opacity-100"
>
<Pencil
class="scale-75 text-white transition-all hover:scale-110 hover:cursor-pointer hover:text-yellow-300"
class="scale-75 text-white transition-all hover:scale-110 hover:cursor-pointer hover:text-star"
onclick={() => {
bookOps.bookToEdit = book;
bookOps.editDialogOpen = true;
@@ -25,31 +25,33 @@
<!-- Book Cover -->
<a
href="/book/{book.id}"
class="group relative aspect-9/12 w-full overflow-hidden rounded shadow-lg drop-shadow-lg transition-all duration-200 {selected
? 'ring-2 ring-yellow-300'
class="group relative aspect-9/12 w-full overflow-hidden rounded-sm shadow-lg drop-shadow-lg transition-all duration-200 {selected
? 'ring-2 ring-star'
: ''}"
onclick={handleClick}
>
<BookImage
src="/api/{book.cover_image}"
class="h-full w-full rounded object-cover transition-all duration-200 group-hover:brightness-50 {selected ||
class="h-full w-full rounded-sm object-cover transition-all duration-200 group-hover:brightness-50 {selected ||
darkened
? 'brightness-50'
: ''}"
/>
<!-- Inside the anchor, which already clips to rounded-sm, so the bar
follows the cover's corners instead of floating below it -->
{#if book.progress?.percentage && !selected && !darkened}
<span class="absolute inset-x-0 bottom-0 h-1 bg-black/30">
<span
class="block h-full {book.progress.completed ? 'bg-success' : 'bg-flag'}"
style="width: {Math.min(100, Math.round(book.progress.percentage * 100))}%;"
></span>
</span>
{/if}
</a>
{#if book.progress?.percentage && !selected && !darkened}
<Progress
value={book.progress.percentage}
max={1}
class="mt-[-8px] h-1 rounded {book.progress.completed
? '[&>div]:bg-green-600'
: '[&>div]:bg-yellow-500'}"
/>
{/if}
<!-- Book Title -->
<a href="/book/{book.id}" class="text-base-content mt-1 line-clamp-2 w-full text-sm hover:underline"
<a href="/book/{book.id}" class="text-base-content mt-1 line-clamp-2 w-full font-serif text-sm hover:underline"
>{book.title}</a
>
@@ -20,7 +20,7 @@
>
<Funnel />
{#if bookCollection.hasActiveFilters}
<div class="absolute top-[5px] right-[5px] h-1.5 w-1.5 rounded-full bg-yellow-500"></div>
<div class="absolute top-[5px] right-[5px] h-1.5 w-1.5 rounded-full bg-flag"></div>
{/if}
</Tooltip.Trigger>
<Tooltip.Content>
@@ -19,7 +19,7 @@
<Collapsible.Trigger {...props}>
{filter.name}
{#if bookCollection.filters[filter.value].length !== 0}
<div class="ml-2 h-[6px] w-[6px] rounded-full bg-yellow-500"></div>
<div class="ml-2 h-[6px] w-[6px] rounded-full bg-flag"></div>
{/if}
<ChevronRightIcon
class="ml-auto transition-transform group-data-[state=open]/collapsible:rotate-90"
@@ -20,7 +20,7 @@
>
{#if bookCollection.hasActiveSort}
<div
class="absolute top-[5px] right-[5px] h-1.5 w-1.5 rounded-full bg-yellow-500"
class="absolute top-[5px] right-[5px] h-1.5 w-1.5 rounded-full bg-flag"
></div>
{/if}
<ArrowUpDown />