URL Bar CTA
A browser window with a landing page where the cursor clicks the Get started button.
Source
components/kuchi/url-bar-cta.tsx
1"use client";23import { loadFont as loadGeist } from "@remotion/google-fonts/Geist";4import { loadFont as loadMono } from "@remotion/google-fonts/GeistMono";5import { loadFont as loadManrope } from "@remotion/google-fonts/Manrope";6import type React from "react";7import {8 AbsoluteFill,9 Easing,10 Img,11 interpolate,12 spring,13 useCurrentFrame,14 useVideoConfig,15} from "remotion";16import type { GradientParams } from "@/lib/kuchi/gsh/gradient-engine";17import { GshGround } from "@/lib/kuchi/gsh/gsh-ground";18import type { GshPresetId } from "@/lib/kuchi/gsh/presets";1920const geist = loadGeist("normal", {21 weights: ["300", "400"],22 subsets: ["latin"],23});24const mono = loadMono("normal", { weights: ["400"], subsets: ["latin"] });25const manrope = loadManrope("normal", {26 weights: ["600"],27 subsets: ["latin"],28});2930export interface UrlBarCtaProps {31 url?: string;32 children?: React.ReactNode;33 typingSpeed?: number;34 showCursor?: boolean;35 suggestionTitle?: string;36 headline?: string;37 body?: string;38 cta?: string;39 command?: string;40 image?: string;41 clipName?: string;42 /** Links in the built-in page's nav bar. */43 navLinks?: string[];44 /** Button at the right of the built-in page's nav bar. */45 navCta?: string;46 theme?: "light" | "dark";47 accent?: string;48 /** Text color of the typed URL and the headline; overrides the theme. */49 ink?: string;50 /** Solid fill in place of the gradient ground; "transparent" drops it. */51 background?: string;52 /** Typeface for the copy. Load it yourself; Geist by default. */53 fontFamily?: string;54 /** Replaces the placeholder wordmark in the built-in page's nav bar. */55 logo?: React.ReactNode;56 /** Size of the foreground around the frame's center. */57 scale?: number;58 /** Frames to hold the first frame before anything moves. */59 delay?: number;60 speed?: number;61 ground?: GshPresetId;62 groundParams?: Partial<GradientParams>;63}6465const CLAMP = {66 extrapolateLeft: "clamp",67 extrapolateRight: "clamp",68} as const;6970const CARD = { mass: 0.8, damping: 18, stiffness: 160 };71const CHIP = { mass: 0.5, damping: 12, stiffness: 200 };72const MORPH = { damping: 200 };73const TYPE_IN = Easing.bezier(0.32, 0.72, 0, 1);74const EXIT = Easing.bezier(0.55, 0, 1, 0.45);75const MOVE = Easing.bezier(0.65, 0, 0.35, 1);767778function KuchiLogo({ fontSize, color }: { fontSize: number; color: string }) {79 return (80 <div81 style={{82 display: "flex",83 alignItems: "baseline",84 color,85 fontFamily: manrope.fontFamily,86 fontWeight: 600,87 fontSize,88 letterSpacing: "-0.025em",89 lineHeight: 1,90 }}91 >92 <span>Acme</span>93 </div>94 );95}9697function hash(n: number) {98 const x = Math.sin(n * 91.7 + 17.3) * 43758.5453;99 return x - Math.floor(x);100}101102function withAlpha(hex: string, alpha: number) {103 const h = hex.replace("#", "");104 const full = h.length === 3 ? h.replace(/./g, (c) => c + c) : h.slice(0, 6);105 const n = Number.parseInt(full, 16);106 return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`;107}108109const lerp = (a: number, b: number, t: number) => a + (b - a) * t;110111function keyTimes(text: string, start: number, typingSpeed: number) {112 const times: number[] = [];113 let t = start;114 for (let i = 0; i < text.length; i++) {115 const prev = text[i - 1];116 let gap = 2.1 + (hash(i) - 0.4) * 2.2;117 if (prev === "." || prev === "/") gap += 3;118 if (i === 0) gap = 0;119 t += Math.max(0.8, gap) / typingSpeed;120 times.push(t);121 }122 return times;123}124125interface Pal {126 dark: boolean;127 window: string;128 chrome: string;129 bar: string;130 docked: string;131 text: string;132 muted: string;133 faint: string;134 line: string;135 rowSel: string;136 keyTop: string;137 keyEdge: string;138 elevated: string;139 float: string;140 imageEdge: string;141 ground: { preset?: GshPresetId; params?: Partial<GradientParams> };142 groundOffset: number;143}144145function palette(theme: "light" | "dark"): Pal {146 return theme === "dark"147 ? {148 dark: true,149 window: "#0f1013",150 chrome: "#0b0c0e",151 bar: "#16171b",152 docked: "#1b1c21",153 text: "#f2f2f3",154 muted: "#9a9ca5",155 faint: "#62646c",156 line: "rgba(255,255,255,0.07)",157 rowSel: "rgba(255,255,255,0.06)",158 keyTop: "#202127",159 keyEdge: "#08090b",160 elevated:161 "inset 0 1px 0 rgba(255,255,255,0.06), 0 0 0 1px rgba(255,255,255,0.09), 0 8px 20px -6px rgba(0,0,0,0.5), 0 32px 80px -16px rgba(0,0,0,0.75)",162 float:163 "inset 0 1px 0 rgba(255,255,255,0.07), 0 0 0 1px rgba(255,255,255,0.1), 0 6px 16px -4px rgba(0,0,0,0.5), 0 24px 60px -12px rgba(0,0,0,0.65)",164 imageEdge: "inset 0 0 0 1px rgba(255,255,255,0.1)",165 ground: { preset: "earthshine" },166 groundOffset: 3,167 }168 : {169 dark: false,170 window: "#ffffff",171 chrome: "#f6f6f4",172 bar: "#ffffff",173 docked: "#ebebe8",174 text: "#16171b",175 muted: "#5f616b",176 faint: "#9a9ca4",177 line: "rgba(20,20,30,0.08)",178 rowSel: "rgba(20,20,30,0.05)",179 keyTop: "#ffffff",180 keyEdge: "#cfd0d4",181 elevated:182 "0 0 0 1px rgba(20,20,30,0.07), 0 2px 4px rgba(20,20,30,0.05), 0 28px 64px -18px rgba(30,30,60,0.28)",183 float:184 "0 0 0 1px rgba(20,20,30,0.08), 0 2px 6px rgba(20,20,30,0.06), 0 22px 50px -14px rgba(30,30,60,0.26)",185 imageEdge: "inset 0 0 0 1px rgba(0,0,0,0.1)",186 ground: { preset: "glasswork" },187 groundOffset: 2,188 };189}190191function Glyph({ d, size, color }: { d: string; size: number; color: string }) {192 return (193 <svg194 width={size}195 height={size}196 viewBox="0 0 24 24"197 style={{ flexShrink: 0, display: "block" }}198 aria-hidden199 >200 <path201 d={d}202 fill="none"203 stroke={color}204 strokeWidth={1.5}205 strokeLinecap="round"206 strokeLinejoin="round"207 />208 </svg>209 );210}211212const ICON = {213 search: "M11 18a7 7 0 100-14 7 7 0 000 14zM20 20l-4-4",214 lock: "M7.5 10.5V8a4.5 4.5 0 019 0v2.5M6.5 10.5h11v9h-11z",215 clock: "M12 20.5a8.5 8.5 0 100-17 8.5 8.5 0 000 17zM12 7.5V12l3 2",216 arrowL: "M14.5 6l-6 6 6 6",217 arrowR: "M9.5 6l6 6-6 6",218 reload: "M19.5 12a7.5 7.5 0 11-2.2-5.3M19.5 4.5v4.5H15",219 share: "M12 3.5v11M8.5 7L12 3.5 15.5 7M6 12.5v7h12v-7",220 enter: "M19 5.5v6a3 3 0 01-3 3H5.5M9 10.5l-4 4 4 4",221};222223function Favicon({ size, accent }: { size: number; accent: string }) {224 return (225 <div226 style={{227 width: size,228 height: size,229 borderRadius: size * 0.26,230 background: accent,231 display: "flex",232 alignItems: "center",233 justifyContent: "center",234 flexShrink: 0,235 }}236 >237 <svg238 viewBox="0 0 124.06 134.26"239 style={{ height: size * 0.5, width: "auto" }}240 aria-hidden241 >242 <circle cx="62.03" cy="67.13" r="56" fill="#ffffff" />243 </svg>244 </div>245 );246}247248function Keycap({249 label,250 pal,251 size,252}: {253 label: string;254 pal: Pal;255 size: number;256}) {257 return (258 <span259 style={{260 fontFamily: mono.fontFamily,261 fontSize: size,262 lineHeight: 1,263 color: pal.muted,264 padding: `${size * 0.28}px ${size * 0.45}px`,265 borderRadius: size * 0.36,266 boxShadow: `0 0 0 1px ${pal.line}`,267 background: pal.dark ? "rgba(255,255,255,0.03)" : "#ffffff",268 whiteSpace: "nowrap",269 }}270 >271 {label}272 </span>273 );274}275276function BuiltInHero({277 pal,278 accent,279 frame,280 start,281 fps,282 u,283 portrait,284 headline,285 body,286 cta,287 command,288 image,289 clipName,290 navLinks,291 navCta,292 ink,293 fontFamily,294 logo,295}: {296 pal: Pal;297 accent: string;298 frame: number;299 start: number;300 fps: number;301 u: number;302 portrait: boolean;303 headline: string;304 body: string;305 cta: string;306 command: string;307 image: string;308 clipName: string;309 navLinks: string[];310 navCta: string;311 ink: string;312 fontFamily: string;313 logo: React.ReactNode;314}) {315 const textIn = (i: number) =>316 interpolate(frame, [start + i * 3, start + i * 3 + 14], [0, 1], {317 ...CLAMP,318 easing: TYPE_IN,319 });320 const rise = (i: number) => {321 const p = textIn(i);322 return { opacity: p, transform: `translateY(${(1 - p) * 14 * u}px)` };323 };324 const card = spring({ frame: frame - start - 6, fps, config: CARD });325 const cardOpacity = interpolate(frame, [start + 6, start + 14], [0, 1], {326 ...CLAMP,327 easing: TYPE_IN,328 });329 const playhead = interpolate(frame, [start, start + 120], [0.18, 0.86], {330 ...CLAMP,331 });332 const clipSeconds = 6;333 const now = playhead * clipSeconds;334 const stamp = `0:${String(Math.floor(now)).padStart(2, "0")}`;335 const pad = (portrait ? 34 : 44) * u;336337 const player = (338 <div339 style={{340 opacity: cardOpacity,341 transform: `translateY(${(1 - card) * 36 * u}px) scale(${0.96 + 0.04 * card})`,342 transformOrigin: "50% 100%",343 width: portrait ? "100%" : 430 * u,344 flexShrink: 0,345 }}346 >347 <div348 style={{349 position: "relative",350 width: "100%",351 aspectRatio: portrait ? "16 / 10.5" : "4 / 3.15",352 borderRadius: 12 * u,353 overflow: "hidden",354 background: pal.chrome,355 }}356 >357 <Img358 src={image}359 style={{360 width: "100%",361 height: "100%",362 objectFit: "cover",363 transform: `scale(${1.08 - 0.06 * playhead})`,364 }}365 />366 <div367 style={{368 position: "absolute",369 inset: 0,370 borderRadius: "inherit",371 boxShadow: pal.imageEdge,372 }}373 />374 <div375 style={{376 position: "absolute",377 left: 14 * u,378 right: 14 * u,379 bottom: 14 * u,380 height: 3 * u,381 borderRadius: 3 * u,382 background: "rgba(255,255,255,0.28)",383 }}384 >385 <div386 style={{387 width: `${playhead * 100}%`,388 height: "100%",389 borderRadius: "inherit",390 background: "#ffffff",391 }}392 />393 </div>394 </div>395 <div396 style={{397 display: "flex",398 justifyContent: "space-between",399 alignItems: "baseline",400 marginTop: 14 * u,401 fontSize: 17 * u,402 color: pal.text,403 }}404 >405 <span>{clipName}</span>406 <span407 style={{408 fontFamily: mono.fontFamily,409 fontSize: 16 * u,410 color: pal.faint,411 fontVariantNumeric: "tabular-nums",412 }}413 >414 {stamp} / 0:{String(clipSeconds).padStart(2, "0")}415 </span>416 </div>417 </div>418 );419420 return (421 <AbsoluteFill422 style={{423 background: pal.window,424 overflow: "hidden",425 fontFamily,426 fontWeight: 400,427 }}428 >429 <div430 style={{431 ...rise(0),432 height: 58 * u,433 padding: `0 ${pad}px`,434 display: "flex",435 alignItems: "center",436 gap: 30 * u,437 boxShadow: `inset 0 -1px 0 ${pal.line}`,438 fontSize: 16 * u,439 color: pal.muted,440 }}441 >442 {logo ?? <KuchiLogo fontSize={19 * u} color={pal.text} />}443 {portrait ? null : navLinks.map((l) => <span key={l}>{l}</span>)}444 <span445 style={{446 marginLeft: "auto",447 height: 34 * u,448 padding: `0 ${14 * u}px`,449 borderRadius: 8 * u,450 display: "inline-flex",451 alignItems: "center",452 background: pal.text,453 color: pal.window,454 }}455 >456 {navCta}457 </span>458 </div>459 <div460 style={{461 display: "flex",462 flexDirection: portrait ? "column" : "row",463 alignItems: portrait ? "stretch" : "center",464 gap: (portrait ? 44 : 40) * u,465 padding: `${(portrait ? 48 : 44) * u}px ${pad}px 0`,466 }}467 >468 <div style={{ flex: 1, minWidth: 0 }}>469 <div470 style={{471 ...rise(1),472 fontSize: (portrait ? 52 : 50) * u,473 fontWeight: 300,474 letterSpacing: "-0.04em",475 lineHeight: 1.04,476 color: ink,477 textWrap: "balance",478 maxWidth: portrait ? "none" : 440 * u,479 }}480 >481 {headline}482 </div>483 <div484 style={{485 ...rise(2),486 fontSize: 18 * u,487 lineHeight: 1.45,488 color: pal.muted,489 marginTop: 18 * u,490 maxWidth: 380 * u,491 textWrap: "pretty",492 }}493 >494 {body}495 </div>496 <div497 style={{498 ...rise(3),499 display: "flex",500 alignItems: "center",501 gap: 16 * u,502 marginTop: 28 * u,503 flexWrap: "wrap",504 }}505 >506 <span507 style={{508 height: 42 * u,509 padding: `0 ${18 * u}px`,510 borderRadius: 9 * u,511 display: "inline-flex",512 alignItems: "center",513 gap: 8 * u,514 fontSize: 17 * u,515 background: accent,516 color: "#ffffff",517 boxShadow: `inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 2px ${withAlpha("#000000", 0.2)}`,518 }}519 >520 {cta}521 <Glyph522 d="M5 12h14M13.5 6.5L19 12l-5.5 5.5"523 size={16 * u}524 color="#ffffff"525 />526 </span>527 </div>528 <div529 style={{530 ...rise(4),531 marginTop: 18 * u,532 fontFamily: mono.fontFamily,533 fontSize: 16 * u,534 color: pal.faint,535 whiteSpace: "nowrap",536 }}537 >538 <span style={{ color: pal.muted }}>$</span> {command}539 </div>540 </div>541 {player}542 </div>543 </AbsoluteFill>544 );545}546547/** The foreground at `scale`, around the frame's center; nothing extra at 1. */548function ScaleLayer({549 scale,550 children,551}: {552 scale: number;553 children: React.ReactNode;554}) {555 if (scale === 1) return children;556 return (557 <AbsoluteFill style={{ transform: `scale(${scale})` }}>558 {children}559 </AbsoluteFill>560 );561}562563const NAV_LINKS = ["Components", "Templates", "Docs"];564565export function UrlBarCta({566 url = "acme.dev",567 children,568 typingSpeed = 1,569 showCursor = true,570 suggestionTitle = "Launch videos from components",571 headline = "Ship your launch video this afternoon.",572 body = "Remotion components you install with one command and own the code.",573 cta = "Browse components",574 command = "npm create acme@latest",575 image,576 clipName = "Zoom Blur",577 navLinks = NAV_LINKS,578 navCta = "Get started",579 theme = "light",580 accent = "#3B5BFD",581 ink,582 background,583 fontFamily = geist.fontFamily,584 logo,585 scale = 1,586 delay = 0,587 speed = 1,588 ground,589 groundParams,590}: UrlBarCtaProps) {591 const frame = Math.max(0, useCurrentFrame() - delay) * speed;592 const { width: W, height: H, fps } = useVideoConfig();593 const portrait = H > W;594 const u = portrait ? W / 760 : Math.min(W / 1280, H / 720);595 const pal = palette(theme);596 const fg = ink ?? pal.text;597 const src = image ?? "https://kuchi-media.kalarislabs.com/components/art/art-05.svg";598599 const typeStart = 8;600 const times = keyTimes(url, typeStart, typingSpeed);601 const typeEnd = times[times.length - 1] ?? typeStart;602 const keyIn = typeEnd - 6;603 const enter = typeEnd + 6;604 const dock = enter + 5;605 const heroStart = dock + 1;606607 const typed = times.filter((t) => frame >= t).length;608 const typedText = url.slice(0, typed);609 const completion = typed >= 3 && typed < url.length ? url.slice(typed) : "";610611 const appear = spring({ frame: frame + 2, fps, config: CARD });612 const appearO = interpolate(frame, [-2, 8], [0, 1], {613 ...CLAMP,614 easing: TYPE_IN,615 });616 const suggestOpen = spring({617 frame: frame - (times[1] ?? typeStart),618 fps,619 config: CARD,620 });621 const suggestClose = interpolate(frame, [enter + 1, dock + 3], [0, 1], {622 ...CLAMP,623 easing: EXIT,624 });625 const suggest = Math.max(0, suggestOpen * (1 - suggestClose));626627 const pressDown = spring({ frame: frame - enter, fps, config: CHIP });628 const pressUp = spring({ frame: frame - enter - 4, fps, config: CHIP });629 const press = Math.max(0, pressDown - pressUp);630 const keyShow = spring({ frame: frame - keyIn, fps, config: CHIP });631 const keyHide = interpolate(frame, [enter + 3, enter + 9], [0, 1], {632 ...CLAMP,633 easing: EXIT,634 });635636 const d = spring({637 frame: frame - dock,638 fps,639 config: MORPH,640 durationInFrames: 22,641 });642 const load = interpolate(frame, [dock, dock + 24], [0, 1], {643 ...CLAMP,644 easing: MOVE,645 });646 const loadFade = interpolate(frame, [dock + 24, dock + 30], [1, 0], {647 ...CLAMP,648 easing: EXIT,649 });650 const push = interpolate(frame, [0, 120], [1, 1.03], CLAMP);651652 const barW0 = Math.min(640 * u, W * 0.86);653 const barH0 = 62 * u;654 const barX0 = (W - barW0) / 2;655 const barY0 = H * (portrait ? 0.34 : 0.3) - barH0 / 2;656657 const winW = W * (portrait ? 0.86 : 0.76);658 const winX = (W - winW) / 2;659 const winY = H * (portrait ? 0.17 : 0.11);660 const winH = H * (portrait ? 0.9 : 0.98);661 const toolbarH = 46 * u;662663 const barX1 = winX + 112 * u;664 const barW1 = winW - 112 * u * 2;665 const barH1 = 30 * u;666 const barY1 = winY + (toolbarH - barH1) / 2;667668 const bx = lerp(barX0, barX1, d);669 const by = lerp(barY0, barY1, d);670 const bw = lerp(barW0, barW1, d);671 const bh = lerp(barH0, barH1, d);672 const fontSize = lerp(26 * u, 16 * u, d);673 const radius = lerp(16 * u, 8 * u, d);674675 const wx = lerp(barX0, winX, d);676 const wy = lerp(barY0, winY, d);677 const ww = lerp(barW0, winW, d);678 const wh = lerp(barH0, winH, d);679 const winOpacity = interpolate(d, [0, 0.12], [0, 1], CLAMP);680681 const rowH = 48 * u;682 const listPad = 6 * u;683 const rows = 3;684 const popupExtra = (rowH * rows + listPad * 2 + 1) * suggest;685686 const caretOn =687 showCursor &&688 (frame < typeEnd + 2 || Math.floor((frame - typeEnd) / 9) % 2 === 1);689 const caretVisible = caretOn && d < 0.4;690691 const suggestions = [692 { icon: "fav", main: url, sub: suggestionTitle, hint: "Enter" },693 {694 icon: "search",695 main: `${url.split(".")[0]} transitions`,696 sub: "",697 hint: "Search",698 },699 {700 icon: "clock",701 main: `${url}/docs/zoom-blur`,702 sub: "",703 hint: "2d ago",704 },705 ];706707 const preset = ground ?? (groundParams ? undefined : pal.ground.preset);708 const gParams = groundParams ?? (ground ? undefined : pal.ground.params);709710 return (711 <AbsoluteFill style={{ fontFamily, overflow: "hidden" }}>712 {background === undefined ? (713 <GshGround714 preset={preset}715 params={gParams}716 timeOffset={pal.groundOffset}717 timeScale={0.5}718 />719 ) : (720 <AbsoluteFill721 style={{722 background: background === "transparent" ? undefined : background,723 }}724 />725 )}726 <ScaleLayer scale={scale}>727 <AbsoluteFill728 style={{ transform: `scale(${push})`, transformOrigin: "50% 40%" }}729 >730 <div731 style={{732 position: "absolute",733 left: wx,734 top: wy,735 width: ww,736 height: wh,737 opacity: winOpacity,738 borderRadius: lerp(16 * u, 14 * u, d),739 background: pal.window,740 overflow: "hidden",741 boxShadow: pal.elevated,742 }}743 >744 <div745 style={{746 height: toolbarH,747 background: pal.chrome,748 boxShadow: `inset 0 -1px 0 ${pal.line}`,749 display: "flex",750 alignItems: "center",751 padding: `0 ${16 * u}px`,752 gap: 7 * u,753 position: "relative",754 opacity: interpolate(d, [0.3, 0.8], [0, 1], CLAMP),755 }}756 >757 {[0, 1, 2].map((k) => (758 <span759 key={k}760 style={{761 width: 11 * u,762 height: 11 * u,763 borderRadius: 99,764 background: pal.dark765 ? "rgba(255,255,255,0.14)"766 : "rgba(20,20,30,0.14)",767 }}768 />769 ))}770 <span style={{ width: 12 * u }} />771 <Glyph d={ICON.arrowL} size={17 * u} color={pal.muted} />772 <Glyph d={ICON.arrowR} size={17 * u} color={pal.faint} />773 <div style={{ marginLeft: "auto", display: "flex", gap: 14 * u }}>774 <Glyph d={ICON.reload} size={16 * u} color={pal.muted} />775 <Glyph d={ICON.share} size={16 * u} color={pal.muted} />776 </div>777 <div778 style={{779 position: "absolute",780 left: 0,781 bottom: 0,782 height: 2 * u,783 width: `${load * 100}%`,784 background: accent,785 opacity: loadFade * (load > 0 ? 1 : 0),786 }}787 />788 </div>789 <div790 style={{791 position: "absolute",792 left: (ww - winW) / 2,793 width: winW,794 top: toolbarH,795 height: winH - toolbarH,796 opacity: interpolate(d, [0.15, 0.45], [0, 1], CLAMP),797 }}798 >799 {children ?? (800 <BuiltInHero801 pal={pal}802 accent={accent}803 frame={frame}804 start={heroStart}805 fps={fps}806 u={u}807 portrait={portrait}808 headline={headline}809 body={body}810 cta={cta}811 command={command}812 image={src}813 clipName={clipName}814 navLinks={navLinks}815 navCta={navCta}816 ink={fg}817 fontFamily={fontFamily}818 logo={logo}819 />820 )}821 </div>822 </div>823824 <div825 style={{826 position: "absolute",827 left: bx,828 top: by,829 width: bw,830 height: bh + popupExtra,831 borderRadius: radius,832 background: d > 0.6 ? pal.docked : pal.bar,833 boxShadow: d > 0.6 ? "none" : pal.float,834 overflow: "hidden",835 opacity: appearO,836 transform: `translateY(${(1 - appear) * 18 * u}px) scale(${0.97 + 0.03 * appear})`,837 transformOrigin: "50% 0%",838 }}839 >840 <div841 style={{842 height: bh,843 display: "flex",844 alignItems: "center",845 gap: lerp(14, 8, d) * u,846 padding: `0 ${lerp(20, 12, d) * u}px`,847 fontSize,848 color: fg,849 letterSpacing: "-0.015em",850 }}851 >852 <Glyph853 d={d > 0.5 ? ICON.lock : ICON.search}854 size={lerp(22, 14, d) * u}855 color={pal.faint}856 />857 <span858 style={{859 whiteSpace: "nowrap",860 display: "flex",861 alignItems: "center",862 }}863 >864 <span>{typedText}</span>865 <span866 style={{867 width: 2 * u,868 height: fontSize * 1.1,869 background: accent,870 marginLeft: 1,871 opacity: caretVisible ? 1 : 0,872 }}873 />874 {completion ? (875 <span876 style={{877 background: withAlpha(accent, pal.dark ? 0.38 : 0.2),878 borderRadius: 3 * u,879 }}880 >881 {completion}882 </span>883 ) : null}884 </span>885 </div>886 <div887 style={{ height: 1, background: pal.line, opacity: suggest }}888 />889 <div style={{ padding: listPad, opacity: suggest }}>890 {suggestions.map((s, i) => {891 const a = interpolate(892 suggestOpen * 3 - i * 0.6,893 [0, 1],894 [0, 1],895 CLAMP,896 );897 return (898 <div899 key={s.main}900 style={{901 height: rowH,902 borderRadius: radius - listPad,903 display: "flex",904 alignItems: "center",905 gap: 14 * u,906 padding: `0 ${14 * u}px`,907 background: i === 0 ? pal.rowSel : "transparent",908 fontSize: 17 * u,909 opacity: a,910 transform: `translateY(${(1 - a) * -6 * u}px)`,911 whiteSpace: "nowrap",912 }}913 >914 {s.icon === "fav" ? (915 <Favicon size={20 * u} accent={accent} />916 ) : (917 <span style={{ width: 20 * u, display: "flex" }}>918 <Glyph919 d={s.icon === "search" ? ICON.search : ICON.clock}920 size={18 * u}921 color={pal.faint}922 />923 </span>924 )}925 <span style={{ color: pal.text }}>{s.main}</span>926 {s.sub ? (927 <span928 style={{929 color: pal.muted,930 overflow: "hidden",931 textOverflow: "ellipsis",932 minWidth: 0,933 }}934 >935 {s.sub}936 </span>937 ) : null}938 <span style={{ marginLeft: "auto", display: "flex" }}>939 {i === 0 ? (940 <Keycap label={s.hint} pal={pal} size={14 * u} />941 ) : (942 <span943 style={{944 fontFamily: mono.fontFamily,945 fontSize: 15 * u,946 color: pal.faint,947 }}948 >949 {s.hint}950 </span>951 )}952 </span>953 </div>954 );955 })}956 </div>957 </div>958959 <div960 style={{961 position: "absolute",962 left: W / 2 - 70 * u,963 top: H * (portrait ? 0.66 : 0.78) - 30 * u,964 width: 140 * u,965 height: 60 * u,966 opacity: Math.min(1, keyShow * 1.4) * (1 - keyHide),967 transform: `translateY(${(1 - keyShow) * 20 * u + press * 5 * u + keyHide * 14 * u}px) scale(${(0.9 + 0.1 * keyShow) * (1 - 0.04 * press)})`,968 }}969 >970 <div971 style={{972 position: "absolute",973 inset: 0,974 borderRadius: 14 * u,975 background: pal.keyTop,976 boxShadow: `inset 0 1px 0 ${pal.dark ? "rgba(255,255,255,0.08)" : "#ffffff"}, 0 0 0 1px ${pal.line}, 0 ${(6 - 5 * press) * u}px 0 ${pal.keyEdge}, 0 ${(18 - 10 * press) * u}px ${(34 - 16 * press) * u}px rgba(0,0,0,${pal.dark ? 0.5 : 0.16})`,977 display: "flex",978 alignItems: "center",979 justifyContent: "center",980 gap: 10 * u,981 color: pal.text,982 fontSize: 19 * u,983 }}984 >985 <Glyph986 d={ICON.enter}987 size={22 * u}988 color={press > 0.2 ? accent : pal.muted}989 />990 Enter991 </div>992 </div>993 </AbsoluteFill>994 </ScaleLayer>995 </AbsoluteFill>996 );997}









