Add eslint rule and fix as many issues as possible

This commit is contained in:
Khoa Le
2023-06-19 23:42:04 -04:00
parent e9eacc445d
commit 9d33e4756b
689 changed files with 9446 additions and 21821 deletions
@@ -1,15 +1,15 @@
import type { Meta, StoryObj } from '@storybook/react';
import type { Meta, StoryObj } from "@storybook/react";
import { TextArea } from './TextArea';
import { TextArea } from "./TextArea";
const meta: Meta<typeof TextArea> = {
title: 'Components/TextArea',
title: "Components/TextArea",
component: TextArea,
tags: ['v2'],
tags: ["v2"],
argTypes: {
placeholder: {
defaultValue: 'Type anything',
type: 'string'
defaultValue: "Type anything",
type: "string"
}
}
};
@@ -24,13 +24,13 @@ export const Filled: Story = {
export const Outline: Story = {
args: {
variant: 'outline'
variant: "outline"
}
};
export const Plain: Story = {
args: {
variant: 'plain'
variant: "plain"
}
};
@@ -43,6 +43,6 @@ export const Error: Story = {
export const AutoWidth: Story = {
args: {
isFullWidth: false,
className: 'w-auto'
className: "w-auto"
}
};
@@ -1,50 +1,50 @@
import { forwardRef, TextareaHTMLAttributes } from 'react';
import { cva, VariantProps } from 'cva';
import { twMerge } from 'tailwind-merge';
import { forwardRef, TextareaHTMLAttributes } from "react";
import { cva, VariantProps } from "cva";
import { twMerge } from "tailwind-merge";
type Props = {
isDisabled?: boolean;
placeholder?: string;
isFullWidth?: boolean;
isRequired?: boolean;
reSize?: 'none' | 'both' | 'vertical' | 'horizontal';
reSize?: "none" | "both" | "vertical" | "horizontal";
};
const textAreaVariants = cva(
'textarea w-full p-2 focus:ring-2 ring-primary-800 outline-none border border-solid text-gray-400 font-inter placeholder-gray-500 placeholder-opacity-50',
"textarea w-full p-2 focus:ring-2 ring-primary-800 outline-none border border-solid text-gray-400 font-inter placeholder-gray-500 placeholder-opacity-50",
{
variants: {
size: {
xs: ['text-xs'],
sm: ['text-sm'],
md: ['text-md'],
lg: ['text-lg']
xs: ["text-xs"],
sm: ["text-sm"],
md: ["text-md"],
lg: ["text-lg"]
},
isRounded: {
true: ['rounded-md'],
false: ''
true: ["rounded-md"],
false: ""
},
variant: {
filled: ['bg-bunker-800', 'text-gray-400'],
outline: ['bg-transparent'],
plain: 'bg-transparent outline-none'
filled: ["bg-bunker-800", "text-gray-400"],
outline: ["bg-transparent"],
plain: "bg-transparent outline-none"
},
isError: {
true: 'focus:ring-red/50 placeholder-red-300 border-red',
false: 'focus:ring-primary/50 border-mineshaft-400'
true: "focus:ring-red/50 placeholder-red-300 border-red",
false: "focus:ring-primary/50 border-mineshaft-400"
}
},
compoundVariants: [
{
variant: 'plain',
variant: "plain",
isError: [true, false],
className: 'border-none'
className: "border-none"
}
]
}
);
export type TextAreaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'size' | 'disabled'> &
export type TextAreaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "disabled"> &
VariantProps<typeof textAreaVariants> &
Props;
@@ -56,9 +56,9 @@ export const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
isDisabled = false,
isError = false,
isRequired,
variant = 'filled',
size = 'md',
reSize = 'both',
variant = "filled",
size = "md",
reSize = "both",
...props
},
ref
@@ -74,4 +74,4 @@ export const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
)
);
TextArea.displayName = 'TextArea';
TextArea.displayName = "TextArea";
@@ -1,2 +1,2 @@
export type { TextAreaProps } from './TextArea';
export { TextArea } from './TextArea';
export type { TextAreaProps } from "./TextArea";
export { TextArea } from "./TextArea";