refactor(web-player): let TrackTable declare its own columns
Every one of the seven tables repeated the same header markup and hand written grid templates, always in the same shape: an optional index, the title, optional desktop-only meta columns, the duration and an optional action. TrackTable now takes that shape as props and builds both grid templates and the headers itself.
This commit is contained in:
@@ -30,19 +30,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<TrackTable
|
||||
columns={isOwner ? '32px 1fr 64px 36px' : '32px 1fr 64px'}
|
||||
columnsMobile={isOwner ? '28px 1fr 52px 32px' : '28px 1fr 52px'}
|
||||
class="mt-6 sm:mt-8"
|
||||
>
|
||||
{#snippet headers()}
|
||||
<span class="text-center">#</span>
|
||||
<span>Título</span>
|
||||
<span class="hidden text-center sm:block">Duración</span>
|
||||
{#if isOwner}
|
||||
<span></span>
|
||||
{/if}
|
||||
{/snippet}
|
||||
<TrackTable index action={isOwner} class="mt-6 sm:mt-8">
|
||||
{#each tracks as track, i (track.id)}
|
||||
<TrackRow>
|
||||
<TrackIndexCell
|
||||
|
||||
Reference in New Issue
Block a user