ksylvest/tights

View on GitHub
src/textarea.tsx

Summary

Maintainability
B
4 hrs
Test Coverage
A
100%
import { clsx } from "clsx";
import type { ComponentProps, FC } from "react";

type Color = "primary" | "info" | "success" | "warning" | "danger";
type Size = "small" | "medium" | "large";

type Props = {
  color?: Color;
  size?: Size;
  rounded?: boolean;
};

export const Textarea: FC<
  Omit<ComponentProps<"textarea">, keyof Props> & Props
> = ({ color, size, rounded, className, ...props }) => (
  <textarea
    {...props}
    className={clsx(
      "textarea",
      color && `is-${color}`,
      size && `is-${size}`,
      rounded && "is-rounded",
      className,
    )}
  />
);