UNPKG

@primer/react-brand

Version:

Primer Brand is a GitHub's design system for creating React-based marketing websites and digital experiences.

66 lines (65 loc) 2.34 kB
import e from "../node_modules/clsx/dist/clsx.js"; import { useAnimation as t } from "../animation/useAnimation.js"; import { Text as n } from "../Text/Text.js"; import { TextCursorAnimation as r } from "../TextCursorAnimation/TextCursorAnimation.js"; import { Heading as i, defaultHeadingTag as a } from "../Heading/Heading.js"; import { Link as o } from "../Link/Link.js"; import s from "./SectionIntro.module.js"; import c, { forwardRef as l, useCallback as u, useMemo as d } from "react"; import { jsx as f, jsxs as p } from "react/jsx-runtime"; //#region src/SectionIntro/SectionIntro.tsx var m = l(({ align: n = "start", animate: r, className: i, children: a, fullWidth: o = !1, leadingComponent: c, style: l, ...u }, d) => { let { classes: m, styles: h } = t(r); return /* @__PURE__ */ p("header", { ref: d, className: e(s.SectionIntro, s[`SectionIntro--align-${n}`], o && s["SectionIntro--full-width"], m, i), ...u, style: { ...h, ...l }, children: [c && /* @__PURE__ */ f(c, {}), a] }); }), h = "4", g = l(({ as: t = a, size: n = h, className: r, children: o, ...l }, p) => { let m = d(() => c.Children.toArray(o), [o]), g = u(() => m.some((e) => c.isValidElement(e) && (e.type === "b" || e.type === "em")) ? "muted" : "default", [m]), _ = m.length === 1 ? "default" : g(); return /* @__PURE__ */ f(i, { ref: p, className: e(s["SectionIntro-heading"], _ === "muted" && s["SectionIntro-heading--muted"], r), size: n, as: t, ...l, children: o }); }), _ = l(({ className: t, children: r, ...i }, a) => /* @__PURE__ */ f(n, { as: "p", className: e(s["SectionIntro-description"], t), ref: a, variant: "muted", ...i, children: r })), v = l(({ children: t, className: n, variant: i = "muted", animate: a = !1, animationDelay: o = 1e3, ...c }, l) => /* @__PURE__ */ f("span", { ref: l, className: e(s["SectionIntro-label"], n), ...c, children: /* @__PURE__ */ f(r, { variant: i, animate: a, delay: o, children: t }) })), y = l(({ className: t, children: n, variant: r = "accent", ...i }, a) => /* @__PURE__ */ f(o, { ref: a, className: e(s["SectionIntro-link"], t), size: "medium", variant: r, ...i, children: n })), b = Object.assign(m, { Heading: g, Description: _, Link: y, Label: v }); //#endregion export { b as SectionIntro }; //# sourceMappingURL=SectionIntro.js.map