import { css } from "../../styled-system/css"; import { useTargetUrl } from "../useTargetUrl"; type Props = { /** * The page whose link under the pointer it shows. Read here, so a hover * redraws only the bubble. */ view: HTMLWebViewElement | null; }; /** * Shows the address of the link under the pointer, like Chrome's status * bubble. The engine draws none; see `targetUrl` on ``. */ export const LinkTarget = ({ view }: Props) => { const url = useTargetUrl(view); return url === "" ? undefined : ( {url} ); }; // In the page's bottom left corner, as in Chrome. Ignores the pointer so it // never blocks the page. const bubbleStyles = css({ backgroundColor: "card", border: "1px solid {colors.border}", borderBlockEndWidth: 0, borderInlineStartWidth: 0, borderStartEndRadius: "md", color: "foreground", fontSize: "xs", insetBlockEnd: 0, insetInlineStart: 0, maxInlineSize: "50%", overflow: "hidden", paddingBlock: 0.5, paddingInline: 2, pointerEvents: "none", position: "absolute", textOverflow: "ellipsis", whiteSpace: "nowrap", });