spectatr-player-sdk
Version:
A custom video player built with Stencil with Shaka Player integration
21 lines (20 loc) • 1.21 kB
JavaScript
import { h } from "@stencil/core";
export const QuizNotification = ({ nearbyQuiz, onClick, pollPosition }) => {
if (!nearbyQuiz)
return null;
const position = !nearbyQuiz.position || nearbyQuiz.position === 'top-center'
? !!pollPosition && pollPosition === 'top-right'
? 'left'
: 'right'
: (nearbyQuiz.position ?? '').replace('top-', '');
const bgColor = getComputedStyle(document.documentElement).getPropertyValue('--vp-video-text').trim();
function triggerQuiz() {
onClick();
}
if (nearbyQuiz.autoTrigger && !nearbyQuiz?.triggered) {
triggerQuiz();
return null;
}
return (h("div", { class: "quiz-notification-container", style: { [position]: '16px' }, onClick: triggerQuiz }, h("div", { class: "quiz-info-icon" }, h("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: bgColor }, h("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" }))), !nearbyQuiz?.triggered && (h("div", { class: "quiz-alert-strip", style: { [position]: '40px' } }, "Quiz available! Click to participate."))));
};
//# sourceMappingURL=QuizNotification.js.map