feat: opacity show
This commit is contained in:
parent
7d499e73ba
commit
fce8817541
2 changed files with 58 additions and 31 deletions
|
@ -11,8 +11,8 @@
|
|||
class={cn(
|
||||
'font-code group relative flex h-full w-full rounded-md bg-primary-700 transition-colors duration-150 ',
|
||||
{
|
||||
'cursor-not-allowed': !chapter.show,
|
||||
'hover:bg-primary-600': chapter.show,
|
||||
'opacity-50': !chapter.show,
|
||||
}
|
||||
)}
|
||||
>
|
||||
|
|
|
@ -13,43 +13,70 @@
|
|||
|
||||
<li
|
||||
class={cn(
|
||||
'font-code group relative flex h-full w-full rounded-md border-2 bg-primary-700 transition-colors duration-150 hover:bg-primary-600',
|
||||
'font-code group relative flex h-full w-full rounded-md border-2 bg-primary-700 transition-colors duration-150',
|
||||
{
|
||||
'border-green-600/30': puzzle.tags?.find((tag) => tag.name.toLowerCase() === 'easy'),
|
||||
'border-yellow-600/30': puzzle.tags?.find((tag) => tag.name.toLowerCase() === 'medium'),
|
||||
'border-red-600/30': puzzle.tags?.find((tag) => tag.name.toLowerCase() === 'hard'),
|
||||
'border-highlight-primary': !puzzle.tags?.length
|
||||
// 'cursor-not-allowed': !isStarted(chapter)
|
||||
'border-highlight-primary': !puzzle.tags?.length,
|
||||
'hover:bg-primary-600': puzzle.show,
|
||||
'opacity-50': !puzzle.show
|
||||
}
|
||||
)}
|
||||
>
|
||||
<a
|
||||
class="flex h-full w-full items-center gap-4 p-4"
|
||||
href="/dashboard/chapters/{chapterId}/puzzle/{puzzle.id}"
|
||||
>
|
||||
<div class="flex w-full flex-col justify-between gap-2 sm:flex-row">
|
||||
<h2 class="text-base font-semibold">
|
||||
{puzzle.name}
|
||||
<span class="text-sm text-highlight-secondary">
|
||||
({puzzle.score ? `${puzzle.score}` : '?'}/{puzzle.scoreMax} points)
|
||||
</span>
|
||||
</h2>
|
||||
<div class="flex items-center gap-x-6">
|
||||
{#if puzzle.tags?.length}
|
||||
<div class="flex gap-x-2 text-sm">
|
||||
{#each puzzle.tags as tag}
|
||||
<span
|
||||
class="inline-block rounded-md bg-primary-800 px-2 py-1 text-highlight-secondary"
|
||||
>
|
||||
{tag.name}
|
||||
</span>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
{#if puzzle.show}
|
||||
<a
|
||||
class="flex h-full w-full items-center gap-4 p-4"
|
||||
href="/dashboard/chapters/{chapterId}/puzzle/{puzzle.id}"
|
||||
>
|
||||
<div class="flex w-full flex-col justify-between gap-2 sm:flex-row">
|
||||
<h2 class="text-base font-semibold">
|
||||
{puzzle.name}
|
||||
<span class="text-sm text-highlight-secondary">
|
||||
({puzzle.score ? `${puzzle.score}` : '?'}/{puzzle.scoreMax} points)
|
||||
</span>
|
||||
</h2>
|
||||
<div class="flex items-center gap-x-6">
|
||||
{#if puzzle.tags?.length}
|
||||
<div class="flex gap-x-2 text-sm">
|
||||
{#each puzzle.tags as tag}
|
||||
<span
|
||||
class="inline-block rounded-md bg-primary-800 px-2 py-1 text-highlight-secondary"
|
||||
>
|
||||
{tag.name}
|
||||
</span>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<span class="translate-x-0 transform-gpu duration-300 group-hover:translate-x-2">
|
||||
<ChevronRight />
|
||||
</span>
|
||||
</a>
|
||||
{:else}
|
||||
<span class="flex h-full w-full items-center gap-4 p-4">
|
||||
<div class="flex w-full flex-col justify-between gap-2 sm:flex-row">
|
||||
<h2 class="text-base font-semibold">
|
||||
{puzzle.name}
|
||||
<span class="text-sm text-highlight-secondary">
|
||||
({puzzle.score ? `${puzzle.score}` : '?'}/{puzzle.scoreMax} points)
|
||||
</span>
|
||||
</h2>
|
||||
<div class="flex items-center gap-x-6">
|
||||
{#if puzzle.tags?.length}
|
||||
<div class="flex gap-x-2 text-sm">
|
||||
{#each puzzle.tags as tag}
|
||||
<span
|
||||
class="inline-block rounded-md bg-primary-800 px-2 py-1 text-highlight-secondary"
|
||||
>
|
||||
{tag.name}
|
||||
</span>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="translate-x-0 transform-gpu duration-300 group-hover:translate-x-2">
|
||||
<ChevronRight />
|
||||
</span>
|
||||
</a>
|
||||
{/if}
|
||||
</li>
|
||||
|
|
Loading…
Add table
Reference in a new issue