Open History to see the last commit
1import { ScanEye } from "lucide-react";
2import type { ReactNode } from "react";
3
4import { useShowSpotlight } from "@/components/spotlight/spotlight";
5import { SPOTLIGHT_TARGETS } from "@/components/spotlight/spotlight-targets";
6import type { SpotlightTarget } from "@/components/spotlight/spotlight-targets";
7
8/**
9 * An inline "look at this" button in the guide's copy: it brings a part of
10 * the app on screen and spotlights it. On phones it opens the app sheet
11 * first. The text says what's shown; the button's name adds where.
12 */
13export function ShowMe({ target, children }: { target: SpotlightTarget; children: ReactNode }) {
14 const show = useShowSpotlight();
15 return (
16 <button
17 type="button"
18 onClick={(event) => {
19 // Safari doesn't focus buttons on tap; focus it so closing the app returns here.
20 event.currentTarget.focus({ preventScroll: true });
21 void show(target);
22 }}
23 title={`Show the ${SPOTLIGHT_TARGETS[target].label.toLowerCase()} in the app`}
24 className="inline-flex items-baseline gap-1 rounded-md border border-guide-accent/35 bg-guide-accent-soft px-1.5 font-medium text-foreground decoration-guide-accent/60 transition-colors outline-none hover:border-guide-accent hover:bg-guide-accent/15 focus-visible:ring-3 focus-visible:ring-guide-accent/40"
25 >
26 <ScanEye className="size-[0.95em] shrink-0 self-center text-guide-accent" aria-hidden />
27 {children}
28 <span className="sr-only"> (show in the app)</span>
29 </button>
30 );
31}