chore: finish frontend ESLint migration #18
Enable every plugin recommended preset and replace Biome with ESLint formatting. Preserve API contracts and JSX whitespace; verify source, tests, builds and tooling.
This commit is contained in:
@@ -1,36 +1,36 @@
|
||||
import { Button } from "@mantine/core";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import type { ComponentProps } from "react";
|
||||
|
||||
import { Button } from "@mantine/core";
|
||||
import { fn } from "storybook/test";
|
||||
|
||||
import { StateView } from "./StateView";
|
||||
|
||||
type StateStoryArgs = ComponentProps<typeof StateView> & {
|
||||
withAction: boolean;
|
||||
type StateStoryArguments = ComponentProps<typeof StateView> & {
|
||||
onAction: () => void;
|
||||
withAction: boolean;
|
||||
};
|
||||
|
||||
const meta = {
|
||||
title: "Design System/Components/StateView",
|
||||
component: StateView,
|
||||
tags: ["autodocs"],
|
||||
args: {
|
||||
title: "Нет учебных данных",
|
||||
text: "Синтетическое пустое состояние. Пользовательские данные не загружаются.",
|
||||
error: false,
|
||||
withAction: false,
|
||||
onAction: fn(),
|
||||
text: "Синтетическое пустое состояние. Пользовательские данные не загружаются.",
|
||||
title: "Нет учебных данных",
|
||||
withAction: false,
|
||||
},
|
||||
argTypes: {
|
||||
title: { control: "text" },
|
||||
text: { control: "text" },
|
||||
error: { control: "boolean" },
|
||||
action: { table: { disable: true } },
|
||||
error: { control: "boolean" },
|
||||
onAction: { control: false },
|
||||
text: { control: "text" },
|
||||
title: { control: "text" },
|
||||
withAction: {
|
||||
control: "boolean",
|
||||
description: "Показать необязательное действие StateView",
|
||||
},
|
||||
onAction: { control: false },
|
||||
},
|
||||
component: StateView,
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
@@ -39,40 +39,44 @@ const meta = {
|
||||
},
|
||||
},
|
||||
},
|
||||
render: (args) => {
|
||||
const { withAction, onAction, ...stateProps } = args;
|
||||
render: (arguments_) => {
|
||||
const { onAction, withAction, ...stateProps } = arguments_;
|
||||
return (
|
||||
<StateView
|
||||
{...stateProps}
|
||||
action={
|
||||
withAction ? (
|
||||
<Button onClick={onAction} variant="default">
|
||||
{args.error ? "Повторить локально" : "Выполнить пример"}
|
||||
</Button>
|
||||
) : undefined
|
||||
(withAction)
|
||||
? ((
|
||||
<Button onClick={onAction} variant="default">
|
||||
{arguments_.error ? "Повторить локально" : "Выполнить пример"}
|
||||
</Button>
|
||||
))
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
);
|
||||
},
|
||||
} satisfies Meta<StateStoryArgs>;
|
||||
tags: ["autodocs"],
|
||||
title: "Design System/Components/StateView",
|
||||
} satisfies Meta<StateStoryArguments>;
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof meta>;
|
||||
export const Empty: Story = { name: "Пустое состояние" };
|
||||
export const EmptyWithAction: Story = {
|
||||
name: "Пустое состояние с действием",
|
||||
args: { withAction: true },
|
||||
name: "Пустое состояние с действием",
|
||||
};
|
||||
export const Failed: Story = {
|
||||
name: "Ошибка",
|
||||
args: {
|
||||
error: true,
|
||||
title: "Учебная ошибка",
|
||||
text: "Демонстрация недоступных данных без вызова API.",
|
||||
title: "Учебная ошибка",
|
||||
},
|
||||
name: "Ошибка",
|
||||
};
|
||||
export const ErrorWithAction: Story = {
|
||||
name: "Ошибка с retry",
|
||||
args: { ...Failed.args, withAction: true },
|
||||
name: "Ошибка с retry",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user