"use client";

import React, { forwardRef } from "react";
import { TextProps, TextVariant } from "./types";

export const Text = forwardRef<HTMLElement, TextProps>(
  ({ children, as, className = "", style, ...props }, ref) => {
    const elementType = as || "p";

    return React.createElement(
      elementType,
      {
        ref,
        className,
        style,
        ...props,
      },
      children
    );
  }
);

Text.displayName = "Text";

export type { TextProps, TextVariant };
