Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
interface UserWidgetsProps {
user: {
currentlyListening?: string;
currentlyReading?: {
title?: string;
author?: string;
coverImage?: string;
};
currentlyWatching?: {
title?: string;
platform?: string;
posterImage?: string;
};
};
}
export default function UserWidgets({ user }: UserWidgetsProps) {
return (
<div>
{user.currentlyListening && (
<div className="mb-4">
<iframe
src={`${user.currentlyListening}`}
width="100%"
height="80"
frameBorder="0"
allowTransparency="true"
allow="encrypted-media"
></iframe>
</div>
)}
{user.currentlyReading && (
<div className="mb-4 bg-orange-300 rounded-lg p-4">
<div className="flex items-center">
<img
src={user.currentlyReading.coverImage}
alt={user.currentlyReading.title}
className="w-20 h-28 mr-4"
/>
<div>
<p className="text-lg font-semibold">{user.currentlyReading.title}</p>
<p className="text-sm text-gray-500">{user.currentlyReading.author}</p>
</div>
</div>
</div>
)}
{user.currentlyWatching && (
<div className="mb-4 bg-white rounded-lg p-4">
<div className="flex items-center">
<img
src={user.currentlyWatching.posterImage}
alt={user.currentlyWatching.title}
className="w-20 h-28 mr-4"
/>
<div>
<p className="text-lg font-semibold">{user.currentlyWatching.title}</p>
<p className="text-sm text-gray-500">on {user.currentlyWatching.platform}</p>
</div>
</div>
</div>
)}
</div>
);
}
May 22, 2024