All files / src/components DemoBanner.tsx

100% Statements 7/7
100% Branches 2/2
100% Functions 4/4
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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        438x   438x 115x   114x       438x   1x                              
import { useEffect, useState } from "react";
import { api } from "../api";
 
export function DemoBanner() {
	const [isDemo, setIsDemo] = useState(false);
 
	useEffect(() => {
		api
			.demo()
			.then(({ demo }) => setIsDemo(demo))
			.catch(() => {});
	}, []);
 
	if (!isDemo) return null;
 
	return (
		<div className="bg-amber-500 text-amber-950 text-center text-sm font-medium py-1.5 px-4 flex-shrink-0">
			Read-only demo — data is sample content.{" "}
			<a
				href="https://github.com/paperkite-hq/stork"
				className="underline hover:no-underline font-semibold"
				target="_blank"
				rel="noopener noreferrer"
			>
				Get Stork
			</a>{" "}
			to run your own instance.
		</div>
	);
}