Skip to content

Commit

Permalink
Create album card
Browse files Browse the repository at this point in the history
  • Loading branch information
agarun committed Jun 1, 2024
1 parent 545a474 commit 55244cd
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
48 changes: 48 additions & 0 deletions src/lib/globes/card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Album } from '@/types';
import React from 'react';

function randomInRange(min: number, max: number) {
return Math.random() * (max - min) + min;
}

export function AlbumCard({ album }: { album: Album }) {
const randomLeft = randomInRange(10, 80);
const randomTop = randomInRange(10, 50);

let tags = [album.description];
for (const location of album.locations) {
tags.push(location.description || '');
}
tags = tags.filter(Boolean) as string[];

return (
<aside
className={`p-4
absolute z-50
rounded-lg bg-gray-100 w-60 text-2xl opacity-50 flex flex-col
border border-gray-200
overflow-hidden`}
style={{
left: `calc(33% + ${randomLeft}px)`,
top: `calc(33% + ${randomTop}px)`
}}
>
<span className="blink rounded-lg">{album.title}</span>
<span className="text-base">{album.date}</span>
<div className="marquee py-4 text-xl">
<div className="marquee-content">
{tags.map(tag => (
<span key={`${tag}-1`}>{tag}</span>
))}
</div>
<div className="marquee-content" aria-hidden={true}>
{tags.map(tag => (
<span key={`${tag}-2`}>{tag}</span>
))}
</div>
</div>

<span>Click to enter &rarr;</span>
</aside>
);
}
2 changes: 1 addition & 1 deletion src/lib/globes/globe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function useRings(
function handleMouseLeave() {
setPointAltitude(0.002);

// setActiveAlbumTitle(undefined);
setActiveAlbumTitle(undefined);

globeElRef.pointOfView(
{
Expand Down

0 comments on commit 55244cd

Please sign in to comment.