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,11 +1,11 @@
import type { Meta, StoryObj } from '@storybook/react';
import type { Meta, StoryObj } from "@storybook/react";
import { Switch } from './Switch';
import { Switch } from "./Switch";
const meta: Meta<typeof Switch> = {
title: 'Components/Switch',
title: "Components/Switch",
component: Switch,
tags: ['v2'],
tags: ["v2"],
argTypes: {}
};
@@ -15,20 +15,20 @@ type Story = StoryObj<typeof Switch>;
// More on writing stories with args: https://storybook.js.org/docs/7.0/react/writing-stories/args
export const Simple: Story = {
args: {
children: 'Dark mode'
children: "Dark mode"
}
};
export const Disabled: Story = {
args: {
children: 'Dark mode',
children: "Dark mode",
isDisabled: true
}
};
export const Required: Story = {
args: {
children: 'Dark mode',
children: "Dark mode",
isRequired: true
}
};
+6 -6
View File
@@ -1,8 +1,8 @@
import { ReactNode } from 'react';
import * as SwitchPrimitive from '@radix-ui/react-switch';
import { twMerge } from 'tailwind-merge';
import { ReactNode } from "react";
import * as SwitchPrimitive from "@radix-ui/react-switch";
import { twMerge } from "tailwind-merge";
export type SwitchProps = Omit<SwitchPrimitive.SwitchProps, 'checked' | 'disabled' | 'required'> & {
export type SwitchProps = Omit<SwitchPrimitive.SwitchProps, "checked" | "disabled" | "required"> & {
children: ReactNode;
id: string;
isChecked?: boolean;
@@ -30,8 +30,8 @@ export const Switch = ({
checked={isChecked}
disabled={isDisabled}
className={twMerge(
'ml-3 h-5 w-9 rounded-full bg-bunker-300 transition-all data-[state=checked]:bg-primary',
isDisabled && 'bg-bunker-400 hover:bg-bunker-400',
"ml-3 h-5 w-9 rounded-full bg-bunker-300 transition-all data-[state=checked]:bg-primary",
isDisabled && "bg-bunker-400 hover:bg-bunker-400",
className
)}
id={id}
+2 -2
View File
@@ -1,2 +1,2 @@
export type { SwitchProps } from './Switch';
export { Switch } from './Switch';
export type { SwitchProps } from "./Switch";
export { Switch } from "./Switch";