Skip to content

Commit

Permalink
gradient playlist page
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrixer committed Dec 14, 2021
1 parent ee5d710 commit e0a066a
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion pages/playlist/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,37 @@
import GradientLayout from '../../components/gradientLayout'
import { validateToken } from '../../lib/auth'
import prisma from '../../lib/prisma'

const getBGColor = (id) => {
const colors = [
'red',
'green',
'blue',
'orange',
'purple',
'gray',
'teal',
'yellow',
]

return colors[id - 1] || colors[Math.floor(Math.random() * colors.length)]
}

const Playlist = ({ playlist }) => {
return <div>{playlist.name}</div>
const color = getBGColor(playlist.id)

return (
<GradientLayout
color={color}
roundImage={false}
title={playlist.name}
subtitle="playlist"
description={`${playlist.songs.length} songs`}
image={`https://picsum.photos/400?random=${playlist.id}`}
>
<div>dfd</div>
</GradientLayout>
)
}

export const getServerSideProps = async ({ query, req }) => {
Expand Down

0 comments on commit e0a066a

Please sign in to comment.