blob: 5b1ef27213ec5b6a83b6891b9da48b1add7da570 (
plain)
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
|
import { useEffect, useState } from "preact/hooks"
import { Signal } from "@preact/signals";
import { memo } from "preact/compat";
const Iframe = memo(function Iframe() {
return <iframe style="border: 0; height: 30em" src="https://bandcamp.com/EmbeddedPlayer/album=3374731395/size=large/bgcol=000000/linkcol=ff0047/transparent=true/" seamless><a href="https://sunnexo.bandcamp.com/album/netpunk">Netpunk by Sunnexo</a></iframe>
})
export const Music = memo(function Music({ title }: Music.Props) {
const [userApproves, setUserApproves] = useState(false);
useEffect(() => {
title.value = "Stream on BandCamp"
}, [])
if (userApproves) {
return <Iframe />
} else {
return <div class="external_warning">
<div>Click here to load player from <a href="https://bandcamp.com">https://bandcamp.com</a></div>
<button onClick={() => setUserApproves(true)}>
Load player
</button>
</div>
}
})
namespace Music {
export type Props = {
title: Signal<string | undefined>,
}
}
|