/
Alex_Ural
/
opencode
Обзор
Документация
Войти
/
Alex_Ural
/
opencode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
packages/tui/src/ui/link.tsx
34 строки
746 B
Dax
refactor(server): canonicalize service API (#31049)
07 июн 2026, 06:27
Не верифицирован
07 июн 2026, 06:27
fe0c4f8
Код
Авторство
О чём код?
import type { JSX } from "solid-js" import type { RGBA } from "@opentui/core" import open from "open" export interface LinkProps { href: string children?: JSX.Element | string fg?: RGBA bg?: RGBA width?: number | "auto" | `${number}%` wrapMode?: "word" | "none" } /** * Link component that renders clickable hyperlinks. * Clicking anywhere on the link text opens the URL in the default browser. */ export function Link(props: LinkProps) { const displayText = props.children ?? props.href return ( <text fg={props.fg} bg={props.bg} width={props.width} wrapMode={props.wrapMode} onMouseUp={() => { open(props.href).catch(() => {}) }} > {displayText} </text> ) }