Skip to content

Commit

Permalink
Merge pull request #274 from bcc-code/263-alignTrackItem-Design
Browse files Browse the repository at this point in the history
263 align track item design
  • Loading branch information
SimonSimCity authored Jan 28, 2024
2 parents 7e6e43c + f84c2d6 commit dc21075
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 53 deletions.
16 changes: 10 additions & 6 deletions components/album/AlbumItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ defineProps<{
</script>

<template>
<li class="group relative mr-3 cursor-pointer py-3">
<li
class="group grid col-span-full relative grid-cols-subgrid cursor-pointer gap-3 py-3"
>
<NuxtLink
class="grid col-span-full grid-cols-subgrid"
:to="{
name: 'album-id',
params: { id: album.id },
Expand All @@ -17,24 +20,25 @@ defineProps<{
<div
class="absolute -inset-x-4 -inset-y-0 rounded-xl bg-background-2 opacity-0 group-hover:opacity-100"
></div>
<div class="relative flex items-center justify-between gap-3">
<div v-if="album.cover" class="w-10">
<div class="relative grid col-span-full grid-cols-subgrid">
<div>
<ProtectedImage
v-if="album.cover"
:src="album.cover"
alt=""
class="aspect-square w-10 rounded-xl bg-background-2"
/>
</div>
<div class="mr-auto w-1/3">
<div class="col-span-3 flex items-center">
<h4
class="overflow-hidden text-ellipsis whitespace-nowrap font-semibold"
:title="album.title || ''"
>
{{ album.title }}
</h4>
</div>
<div class="ml-auto flex items-center justify-center gap-1">
<button class="focus:bg-lime-400 rounded-lg px-2 py-0">
<div class="flex justify-end">
<button class="px-2">
<NuxtIcon name="icon.chevron.right" class="text-2xl" />
</button>
</div>
Expand Down
16 changes: 10 additions & 6 deletions components/contributor/ContributorListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ defineProps<{
</script>

<template>
<li class="group relative mr-3 cursor-pointer py-3">
<li
class="group grid col-span-full relative grid-cols-subgrid cursor-pointer gap-3 py-3"
>
<NuxtLink
class="grid col-span-full grid-cols-subgrid"
:to="{
name: 'playlist-contributor-id',
params: { id: contributor.id },
Expand All @@ -17,24 +20,25 @@ defineProps<{
<div
class="absolute -inset-x-4 -inset-y-0 rounded-xl bg-background-2 opacity-0 group-hover:opacity-100"
></div>
<div class="relative flex items-center justify-between gap-3">
<div v-if="contributor.cover" class="w-10">
<div class="relative grid col-span-full grid-cols-subgrid">
<div>
<ProtectedImage
v-if="contributor.cover"
:src="contributor.cover"
alt=""
class="aspect-square w-10 rounded-xl bg-background-2"
/>
</div>
<div class="mr-auto w-1/3">
<div class="col-span-3 flex items-center">
<h4
class="overflow-hidden text-ellipsis whitespace-nowrap font-semibold"
:title="contributor.name || ''"
>
{{ contributor.name }}
</h4>
</div>
<div class="ml-auto flex items-center justify-center gap-1">
<button class="focus:bg-lime-400 rounded-lg px-2 py-0">
<div class="flex justify-end">
<button class="px-2">
<NuxtIcon name="icon.chevron.right" class="text-2xl" />
</button>
</div>
Expand Down
16 changes: 10 additions & 6 deletions components/playlist/PlaylistItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ defineProps<{
</script>

<template>
<li class="group relative mr-3 cursor-pointer py-3">
<li
class="group grid col-span-full relative grid-cols-subgrid cursor-pointer gap-3 py-3"
>
<NuxtLink
class="grid col-span-full grid-cols-subgrid"
:to="{
name: 'playlist-curated-id',
params: { id: playlist.id },
Expand All @@ -17,24 +20,25 @@ defineProps<{
<div
class="absolute -inset-x-4 -inset-y-0 rounded-xl bg-background-2 opacity-0 group-hover:opacity-100"
></div>
<div class="relative flex items-center justify-between gap-3">
<div v-if="playlist.cover" class="w-10">
<div class="relative grid col-span-full grid-cols-subgrid">
<div>
<ProtectedImage
v-if="playlist.cover"
:src="playlist.cover"
alt=""
class="aspect-square w-10 rounded-xl bg-background-2"
/>
</div>
<div class="mr-auto w-1/3">
<div class="col-span-3 flex items-center">
<h4
class="overflow-hidden text-ellipsis whitespace-nowrap font-semibold"
:title="playlist.title || ''"
>
{{ playlist.title }}
</h4>
</div>
<div class="ml-auto flex items-center justify-center gap-1">
<button class="focus:bg-lime-400 rounded-lg px-2 py-0">
<div class="flex justify-end">
<button class="px-2">
<NuxtIcon name="icon.chevron.right" class="text-2xl" />
</button>
</div>
Expand Down
16 changes: 10 additions & 6 deletions components/podcast/PodcastItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ defineProps<{
</script>

<template>
<li class="group relative mr-3 cursor-pointer py-3">
<li
class="group grid col-span-full relative grid-cols-subgrid cursor-pointer gap-3 py-3"
>
<NuxtLink
class="grid col-span-full grid-cols-subgrid"
:to="{
name: 'playlist-podcast-id',
params: { id: podcast.id },
Expand All @@ -17,24 +20,25 @@ defineProps<{
<div
class="absolute -inset-x-4 -inset-y-0 rounded-xl bg-background-2 opacity-0 group-hover:opacity-100"
></div>
<div class="relative flex items-center justify-between gap-3">
<div v-if="podcast.cover" class="w-10">
<div class="relative grid col-span-full grid-cols-subgrid">
<div>
<ProtectedImage
v-if="podcast.cover"
:src="podcast.cover"
alt=""
class="aspect-square w-10 rounded-xl bg-background-2"
/>
</div>
<div class="mr-auto w-1/3">
<div class="col-span-3 flex items-center">
<h4
class="overflow-hidden text-ellipsis whitespace-nowrap font-semibold"
:title="podcast.title || ''"
>
{{ podcast.title }}
</h4>
</div>
<div class="ml-auto flex items-center justify-center gap-1">
<button class="focus:bg-lime-400 rounded-lg px-2 py-0">
<div class="flex justify-end">
<button class="px-2">
<NuxtIcon name="icon.chevron.right" class="text-2xl" />
</button>
</div>
Expand Down
59 changes: 33 additions & 26 deletions components/track/TrackItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,61 +88,68 @@ function secondsToTime(totalSeconds: number | undefined) {
</script>

<template>
<li class="group relative mr-3 cursor-pointer py-3" @click.stop="playTrack">
<li
class="group grid col-span-full relative grid-cols-subgrid cursor-pointer gap-3 py-3"
@click.stop="playTrack"
>
<div
class="absolute -inset-x-4 -inset-y-0 rounded-xl bg-background-2 opacity-0 group-hover:opacity-100"
></div>
<div class="relative flex items-center justify-between gap-3">

<div class="relative grid col-span-full grid-cols-subgrid">
<div
v-if="track.meta?.attachedPicture && showThumbnail"
class="relative w-10"
class="flex items-center"
>
<ProtectedImage
:src="track.meta?.attachedPicture"
alt=""
class="aspect-square w-10 rounded-md bg-background-2"
/>
<div class="absolute inset-0 opacity-0 group-hover:opacity-100">
<div
class="absolute inset-0 h-full w-full rounded-md bg-black-1 opacity-50 dark:bg-white-1"
></div>
<NuxtIcon
name="play"
class="absolute inset-0 flex items-center justify-center text-2xl text-white-1 dark:text-black-1"
<div class="relative">
<ProtectedImage
:src="track.meta?.attachedPicture"
alt=""
class="aspect-square w-10 rounded-md bg-background-2"
/>
<div class="absolute inset-0 opacity-0 group-hover:opacity-100">
<div
class="absolute inset-0 h-full w-full rounded-md bg-black-1 opacity-50 dark:bg-white-1"
></div>
<NuxtIcon
name="play"
class="absolute inset-0 flex items-center justify-center text-2xl text-white-1 dark:text-black-1"
/>
</div>
</div>
</div>
<div class="mr-auto w-1/3">

<div
v-if="!(track.meta?.attachedPicture && showThumbnail)"
class="relative"
></div>
<div class="flex flex-col justify-center">
<h4
class="overflow-hidden text-ellipsis whitespace-nowrap font-semibold"
class="block overflow-hidden text-ellipsis font-semibold"
:title="track.meta?.title || ''"
>
{{ track.meta?.title }}
</h4>
<span
v-if="track.meta?.artist"
:title="track.meta?.artist"
class="block overflow-hidden text-ellipsis whitespace-nowrap text-label-1"
class="block overflow-hidden text-ellipsis text-label-1"
>
{{ track.meta?.artist }}
</span>
</div>
<div
v-if="!(track.meta?.attachedPicture && showThumbnail)"
class="block h-1 w-10"
></div>
<div v-if="!isTrackTypeKnown">
<div v-if="!isTrackTypeKnown" class="flex items-center">
<span class="text-label-2">{{ track.subtype }}</span>
</div>
<div v-if="isTrackTypeKnown">
<div v-if="isTrackTypeKnown" class="flex items-center">
<span class="text-label-2">{{ track.meta?.album }}</span>
</div>
<div class="ml-auto">
<div class="flex items-center">
<span class="text-label-2">{{
secondsToTime(track.media?.[0]?.files?.[0]?.duration)
}}</span>
</div>
<div class="ml-auto flex items-center justify-center gap-1">
<div class="flex items-center gap-1">
<button
class="px-2 py-0 opacity-0 hover:bg-[red] hover:opacity-100 focus:opacity-100 group-hover:opacity-100 group-focus:opacity-100"
:aria-label="t('track.a11y.download')"
Expand Down
4 changes: 3 additions & 1 deletion components/track/TrackList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ const isTrackTypeKnown = () => {
</script>

<template>
<ol class="w-full divide-y divide-label-separator">
<ol
class="grid grid-cols-tracklist grid-rows-1 gap-4 w-full divide-y divide-label-separator"
>
<template v-if="showSkeleton">
<li
v-for="skeleton in skeletonCount"
Expand Down
5 changes: 5 additions & 0 deletions modules/figma2tailwind/convertToTailwind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ const config: Partial<Config> = {
darkMode: "class",
theme: {
colors,
extend: {
gridTemplateColumns: {
tracklist: "3rem auto auto auto auto"
}
}
},
};
Expand Down
5 changes: 4 additions & 1 deletion pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ const isSmallScreen = breakpoints.smallerOrEqual("lg");
</div>
</template>
</div>
<ol v-else class="w-full divide-y divide-label-separator">
<ol
v-else
class="w-full divide-y divide-label-separator grid grid-cols-tracklist"
>
<template v-for="item in group.items" :key="item.id">
<TrackItem
v-if="item.type === 'track'"
Expand Down
4 changes: 3 additions & 1 deletion pages/search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ const playItem = (item: TrackModel, group: IDiscoverableGroup) => {
</div>
<div class="border-t border-label-4 p-4">
<div>
<ol class="w-full divide-y divide-label-separator">
<ol
class="grid grid-cols-tracklist grid-rows-1 w-full divide-y divide-label-separator gap-4"
>
<template v-for="item in results?.items" :key="item.id">
<TrackItem
v-if="item.type === 'track'"
Expand Down

0 comments on commit dc21075

Please sign in to comment.