import { useTranslation } from "@termix/plugin-sdk/frontend"; import { Input, Switch } from "@termix/plugin-sdk/ui"; import type { ServiceLinkConfig, WidgetEditFormProps } from "../types.js"; function getAccentColor(): string { return ( getComputedStyle(document.documentElement) .getPropertyValue("--accent-brand") .trim() || "#f59145" ); } export function ServiceLinkEditForm({ config, onChange, }: WidgetEditFormProps) { const { t } = useTranslation(); const accent = getAccentColor(); const showImage = config.showImage ?? true; return (
onChange({ ...config, url: e.target.value })} placeholder="https://example.com" className="h-8 text-sm" />
onChange({ ...config, description: e.target.value })} placeholder={t("homepage.serviceNamePlaceholder")} className="h-8 text-sm" />
onChange({ ...config, showImage: v })} />
{showImage && (
onChange({ ...config, imageUrl: e.target.value || undefined }) } placeholder="https://example.com/logo.png" className="h-8 text-sm" /> {t("homepage.imageUrlHint")}
)}
onChange({ ...config, accentColor: e.target.value }) } className="w-8 h-8 border border-border cursor-pointer" /> onChange({ ...config, accentColor: e.target.value || undefined }) } placeholder={accent} className="h-8 text-sm flex-1" />
); }