kaas
This commit is contained in:
parent
fbc040c317
commit
826a30f95f
19 changed files with 430 additions and 170 deletions
|
@ -1,15 +1,23 @@
|
|||
import { Component, createMemo } from "solid-js";
|
||||
import { Component, Show } from "solid-js";
|
||||
import { useVideo } from "../context";
|
||||
import { FaSolidPause, FaSolidPlay } from "solid-icons/fa";
|
||||
import css from "./playState.module.css";
|
||||
|
||||
export const PlayState: Component<{}> = (props) => {
|
||||
const video = useVideo();
|
||||
|
||||
const icon = createMemo(() => {
|
||||
return {
|
||||
playing: "⏵",
|
||||
paused: "⏸",
|
||||
}[video.state()];
|
||||
});
|
||||
|
||||
return <button onclick={(e) => video.togglePlayState()}>{icon()}</button>;
|
||||
return (
|
||||
<button
|
||||
class={css.play}
|
||||
onclick={(e) =>
|
||||
video.state.setState((last) =>
|
||||
last === "playing" ? "paused" : "playing"
|
||||
)
|
||||
}
|
||||
>
|
||||
<Show when={video.state.state() === "playing"} fallback={<FaSolidPlay />}>
|
||||
<FaSolidPause />
|
||||
</Show>
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue