@teamsparta/stack-text
Version:
stack text
48 lines (44 loc) • 1.01 kB
JavaScript
"use client";
import {
TextBase,
__objRest,
__spreadProps,
__spreadValues
} from "./chunk-QSHNUPQB.mjs";
// src/Text.tsx
import {
mapResponsive,
useBreakpointContext
} from "@teamsparta/stack-core";
import { forwardRef } from "react";
import { jsx } from "@emotion/react/jsx-runtime";
var Text = forwardRef(function TextBase2(_a, ref) {
var _b = _a, {
as,
children,
font,
style: styleFromProps,
align,
color
} = _b, restProps = __objRest(_b, [
"as",
"children",
"font",
"style",
"align",
"color"
]);
const breakpoints = useBreakpointContext("Text");
const fonts = mapResponsive(breakpoints, font, (breakpoint, font2) => ({
breakpoint,
font: font2
}));
const style = __spreadProps(__spreadValues({}, styleFromProps), {
"--text-color": color,
"--text-align": align
});
return /* @__PURE__ */ jsx(TextBase, __spreadProps(__spreadValues({ as, ref, style, fonts }, restProps), { children }));
});
export {
Text
};