storybook
This commit is contained in:
parent
af97f17a2c
commit
d1f84e06e9
8 changed files with 11612 additions and 9 deletions
22
.storybook/main.ts
Normal file
22
.storybook/main.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import type { StorybookConfig } from "@storybook/react-vite";
|
||||
|
||||
const config: StorybookConfig = {
|
||||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
||||
addons: [
|
||||
"@storybook/addon-links",
|
||||
"@storybook/addon-essentials",
|
||||
"@storybook/addon-onboarding",
|
||||
"@storybook/addon-interactions",
|
||||
],
|
||||
framework: {
|
||||
name: "@storybook/react-vite",
|
||||
options: {},
|
||||
},
|
||||
docs: {
|
||||
autodocs: "tag",
|
||||
},
|
||||
core: {
|
||||
disableTelemetry: true,
|
||||
},
|
||||
};
|
||||
export default config;
|
17
.storybook/preview.ts
Normal file
17
.storybook/preview.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import type { Preview } from "@storybook/react";
|
||||
|
||||
import "../src/global.scss";
|
||||
|
||||
const preview: Preview = {
|
||||
parameters: {
|
||||
actions: { argTypesRegex: "^on[A-Z].*" },
|
||||
controls: {
|
||||
matchers: {
|
||||
color: /(background|color)$/i,
|
||||
date: /Date$/,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default preview;
|
|
@ -48,9 +48,8 @@ function ScrollContainer<T>({
|
|||
);
|
||||
|
||||
// Viewport state
|
||||
const { viewportWidth, viewportHeight, setViewportSize } = useContext(
|
||||
CalendarContext
|
||||
);
|
||||
const { viewportWidth, viewportHeight, setViewportSize } =
|
||||
useContext(CalendarContext);
|
||||
const viewportMetric =
|
||||
direction === "horizontal" ? viewportWidth : viewportHeight;
|
||||
|
||||
|
@ -140,9 +139,7 @@ function ScrollContainer<T>({
|
|||
};
|
||||
setResetScrollToEl(newResetScrollToEl);
|
||||
|
||||
setTimeout(() => {
|
||||
generateNextObject(lastChild);
|
||||
}, 1000);
|
||||
generateNextObject(lastChild);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
11523
package-lock.json
generated
11523
package-lock.json
generated
File diff suppressed because it is too large
Load diff
13
package.json
13
package.json
|
@ -8,14 +8,25 @@
|
|||
"scripts": {
|
||||
"dev": "vite",
|
||||
"watch": "vite build --watch",
|
||||
"build": "vite build"
|
||||
"build": "vite build",
|
||||
"storybook": "storybook dev -p 6006",
|
||||
"build-storybook": "storybook build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@logseq/libs": "^0.0.1-alpha.29",
|
||||
"@storybook/addon-essentials": "^7.3.2",
|
||||
"@storybook/addon-interactions": "^7.3.2",
|
||||
"@storybook/addon-links": "^7.3.2",
|
||||
"@storybook/addon-onboarding": "^1.0.8",
|
||||
"@storybook/blocks": "^7.3.2",
|
||||
"@storybook/react": "^7.3.2",
|
||||
"@storybook/react-vite": "^7.3.2",
|
||||
"@storybook/testing-library": "^0.2.0",
|
||||
"@types/react": "^18.2.21",
|
||||
"@types/react-dom": "^18.2.7",
|
||||
"@vitejs/plugin-react": "^4.0.4",
|
||||
"sass": "^1.66.1",
|
||||
"storybook": "^7.3.2",
|
||||
"typescript": "^5.1.6",
|
||||
"vite": "^4.4.9",
|
||||
"vite-tsconfig-paths": "^4.2.0"
|
||||
|
|
|
@ -21,11 +21,16 @@
|
|||
}
|
||||
|
||||
.dateNumber {
|
||||
cursor: default;
|
||||
cursor: pointer;
|
||||
text-align: right;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 4px;
|
||||
transition: background-color 0.1s ease-out;
|
||||
|
||||
&:hover {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
span {
|
||||
padding: 8px;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.toggleSwitch {
|
||||
display: flex;
|
||||
display: inline-flex;
|
||||
gap: 1px;
|
||||
|
||||
border-radius: var(--border-radius);
|
||||
|
|
28
src/widgets/ToggleSwitch.stories.ts
Normal file
28
src/widgets/ToggleSwitch.stories.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
import type { Meta, StoryObj } from "@storybook/react";
|
||||
|
||||
import ToggleSwitch from "./ToggleSwitch";
|
||||
import { createElement } from "react";
|
||||
|
||||
const meta: Meta<typeof ToggleSwitch> = {
|
||||
component: ToggleSwitch,
|
||||
argTypes: { setValue: { action: "changedTo" } },
|
||||
};
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof ToggleSwitch>;
|
||||
|
||||
export const Primary: Story = {
|
||||
args: {
|
||||
options: ["Hello", "World"],
|
||||
renderValue: (x) => createElement("div", null, x),
|
||||
},
|
||||
parameters: {
|
||||
backgrounds: {
|
||||
values: [
|
||||
{ name: "red", value: "#f00" },
|
||||
{ name: "green", value: "#0f0" },
|
||||
{ name: "blue", value: "#00f" },
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
Loading…
Reference in a new issue