Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
NgocNhi123 committed Jul 1, 2024
1 parent 1983e44 commit 66af09b
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 51 deletions.
16 changes: 2 additions & 14 deletions core/src/date-input/date-input.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactNode, useState } from "react";
import { useState } from "react";
import { DayPicker, Matcher } from "react-day-picker";
import "react-day-picker/dist/style.css";
import { Input, InputProps } from "../input/input";
Expand Down Expand Up @@ -57,18 +57,6 @@ interface Props {
icon?: InputProps["icon"];
}

interface DayPickerOverlayProps {
children: ReactNode;
selectedDay: Date;
month: Date;
input: null;
classNames: {
container: string; // input
overlay: string;
overlayWrapper: string;
};
}

const getValue = (props: Props): Date | undefined => {
console.log("get", props.value);

Expand All @@ -86,7 +74,7 @@ const getValue = (props: Props): Date | undefined => {

const getDisabledDays = (props: Props): Matcher | Matcher[] => {
const { minDate: min, maxDate: max } = props;
let days: Matcher[] = [];
const days: Matcher[] = [];
if (max) days.push({ after: max });
if (min) days.push({ before: min });
return days;
Expand Down
4 changes: 2 additions & 2 deletions docs/src/color/sample/sample.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Color from "color";
import { useEffect, useRef, useState } from "react";
import { HiCheckCircle } from "react-icons/hi";
import { CategoryColor, categoryColors, Icon, Tag } from "../../../../core/src";
import { CategoryColor, Icon, Tag, categoryColors } from "../../../../core/src";
import s from "./sample.module.css";

export type ColorSampleUsage = "text" | "icon" | "both";
Expand Down Expand Up @@ -50,7 +50,7 @@ export const ColorSample = (props: Props): JSX.Element => {
if (fore === null) throw Error("foreElm is null");
setContrast(getContrast(props, back, fore));
}, 0); // Wait for all styles are applied
}, [setContrast]);
}, [setContrast, props]);

return (
<div
Expand Down
6 changes: 1 addition & 5 deletions docs/src/color/static/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@ interface Props {
const Color =
(props: Props) =>
(row: number): JSX.Element => (
// eslint-disable-next-line react/prop-types
<ColorStaticSample name={`${props.name}-${row}`} />
);

const Name =
(props: Props) =>
(row: number): JSX.Element => (
// eslint-disable-next-line react/prop-types
<span children={`${props.name}-${row}`} />
);
(row: number): JSX.Element => <span children={`${props.name}-${row}`} />;

export const ColorStaticTable = (props: Props): JSX.Element => (
<div className={[s.container, border.weak].join(" ")}>
Expand Down
1 change: 1 addition & 0 deletions docs/src/components/radio-group.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { RadioOptionComponent } from "./radio-group-fake";
const meta: Meta = {
title: "Components/Radio Group",
component: RadioGroup,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
subcomponents: { RadioOption: RadioOptionComponent as any },
argTypes: {
row: Utils.arg("boolean"),
Expand Down
1 change: 1 addition & 0 deletions docs/src/components/select.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { SelectOptionComponent } from "./select-fake";
const meta: Meta = {
title: "Components/Select",
component: Select,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
subcomponents: { SelectOption: SelectOptionComponent as any },
argTypes: {
style: Utils.arg(Select.styles, "Visual"),
Expand Down
1 change: 1 addition & 0 deletions docs/src/components/switcher.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { SwitcherOptionComponent } from "./switcher-fake";
const meta: Meta = {
title: "Components/Switcher",
component: Switcher,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
subcomponents: { SwitcherOption: SwitcherOptionComponent as any },
argTypes: {
style: Utils.arg(Switcher.styles),
Expand Down
1 change: 1 addition & 0 deletions docs/src/components/tab.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { TabComponent } from "./tab-fake";
const meta: Meta = {
title: "Components/Tabs",
component: Tabs,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
subcomponents: { Tab: TabComponent as any },
argTypes: {
noPadding: Utils.arg("boolean", "Visual"),
Expand Down
2 changes: 2 additions & 0 deletions docs/src/components/table.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ const meta: Meta = {
title: "Components/Table",
component: Table,
subcomponents: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
TableColumn: TableColumnComponent as any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
TableExpandable: TableExpandableComponent as any,
},
argTypes: {
Expand Down
1 change: 1 addition & 0 deletions docs/src/components/toast.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ToastFunction } from "./toast-fake";
const meta: Meta = {
title: "Components/Toast",
component: ToastPane,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
subcomponents: { "toast function": ToastFunction as any },
};

Expand Down
2 changes: 2 additions & 0 deletions docs/src/utils/arg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const argOptions = (target: unknown): string[] | undefined => {
}

if (typeof target === "object") {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return Object.keys(target as any);
}
};
Expand Down Expand Up @@ -36,6 +37,7 @@ export const utilsArg = (
category?: string,
): Partial<ArgTypes<Args>> => {
const table = category ? { category } : undefined;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const control = argControl(target) as any;
const options = argOptions(target);
return { options, control, table };
Expand Down
62 changes: 32 additions & 30 deletions docs/src/utils/page/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,39 @@ interface Props {
primary: "sticky" | "none" | "default";
}

const ComponentPage = (props: Props): JSX.Element => (
<div className={props.primary === "sticky" ? s.sticky : ""}>
<Title />
<Description />
{props.shots.length > 0 && (
<>
<h3 id="props" className="sbdocs sbdocs-h3">
Gallery
</h3>
<div className={s.shots}>{props.shots}</div>
</>
)}
<Stories includePrimary={false} />
<div>
<h3 id="props" className="sbdocs sbdocs-h3">
All Props
</h3>
{props.primary !== "none" && (
<div className={[s.primary, background.strong].join(" ")}>
<Primary />
</div>
)}
<div className={s.table}>
<Controls />
</div>
</div>
</div>
);

export const utilsPageComponent = (meta: Meta, props: Props): void => {
meta.parameters ??= {};
meta.parameters.docs ??= {};
meta.parameters.docs.page = () => <ComponentPage {...props} />;
meta.parameters.docs.page = () => {
return (
<div className={props.primary === "sticky" ? s.sticky : ""}>
<Title />
<Description />
{props.shots.length > 0 && (
<>
<h3 id="props" className="sbdocs sbdocs-h3">
Gallery
</h3>
<div className={s.shots}>{props.shots}</div>
</>
)}
<Stories includePrimary={false} />
<div>
<h3 id="props" className="sbdocs sbdocs-h3">
All Props
</h3>
{props.primary !== "none" && (
<div
className={[s.primary, background.strong].join(" ")}
>
<Primary />
</div>
)}
<div className={s.table}>
<Controls />
</div>
</div>
</div>
);
};
};

0 comments on commit 66af09b

Please sign in to comment.