UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

47 lines (46 loc) 1.32 kB
import { jsx as e } from "react/jsx-runtime"; import { WideButton as a } from "../../styled/WideButton.js"; import { useInRouterContext as g, Link as C } from "react-router"; function p(t) { let n = ""; const { align: c = "", highlight: h = "" } = t, l = h === "true", r = c.toLowerCase(); r === "left" && (n += "floatleft "), r === "right" && (n += "floatright "); const i = r === "center", u = l ? "secondary" : "neutral", f = t.url?.startsWith("http://") || t.url?.startsWith("https://"), x = g(); let o = {}; f ? o = { href: t.url, target: "_blank", rel: "noopener noreferrer", component: "a" } : x ? o = { to: t.url, component: C } : o = { href: t.url, component: "a" }; const s = /* @__PURE__ */ e( a, { className: n, variant: "contained", color: u, ...o, sx: { "&:hover": { backgroundColor: l ? void 0 : "secondary.main", color: "white" }, ...!i && t.url && { margin: "20px 20px 20px 0px" } }, children: t.text } ); return i ? /* @__PURE__ */ e("span", { style: { display: "block", textAlign: "center" }, children: s }) : /* @__PURE__ */ e("span", { children: s }); } export { p as default }; //# sourceMappingURL=MarkdownButton.js.map