import "./index.scss";
import { Text as TaroText } from "@tarojs/components";
import classNames from "classnames";
import { TextProps } from "@tarojs/components/types/Text";

export type ILabelType =
  | "primary"
  | "secondary"
  | "default"
  | "danger"
  | "white"
  | "success"
  | "active";

interface ILabelProps extends TextProps {
  type?: ILabelType;
  size?: "default" | "sm" | "lg";
  bold?: boolean;
}

const Label: React.FC<ILabelProps> = (props) => {
  const { type = "default", size = "default", bold, ...textProps } = props;
  const _classNames = classNames("c-text", {
    ["c-text-" + type]: type !== "default",
    ["c-text-" + size]: size !== "default",
    ["c-text-bold"]: bold,
  });
  return (
    <TaroText {...textProps} className={`${_classNames} ${props.className}`}>
      {props.children}
    </TaroText>
  );
};

export default Label;
