Initial Commit
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
/* istanbul ignore file -- story-only fixtures */
|
||||
import type { Meta, StoryObj } from "@storybook/react";
|
||||
import { AudioProvider } from "../../provider/audio-provider.js";
|
||||
import { makeFakeAudioContext, makeFakePlugin } from "../../test-utils.js";
|
||||
import { PluginLoader } from "./plugin-loader.js";
|
||||
|
||||
const meta = {
|
||||
title: "react-audio/PluginLoader",
|
||||
component: PluginLoader,
|
||||
} satisfies Meta<typeof PluginLoader>;
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
function Frame(props: { readonly children: React.ReactNode }) {
|
||||
return (
|
||||
<AudioProvider
|
||||
options={{
|
||||
adapter: { context: makeFakeAudioContext() as never },
|
||||
plugins: [
|
||||
{
|
||||
pluginType: "demo-alpha",
|
||||
factory: () => makeFakePlugin({ id: "demo-alpha" }),
|
||||
},
|
||||
{
|
||||
pluginType: "demo-beta",
|
||||
factory: () => makeFakePlugin({ id: "demo-beta" }),
|
||||
},
|
||||
],
|
||||
}}
|
||||
>
|
||||
<div style={{ padding: 24 }}>{props.children}</div>
|
||||
</AudioProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export const Default: Story = {
|
||||
render: () => (
|
||||
<Frame>
|
||||
<PluginLoader />
|
||||
</Frame>
|
||||
),
|
||||
};
|
||||
export const Interactive: Story = {
|
||||
render: () => (
|
||||
<Frame>
|
||||
<PluginLoader onCreated={(_p, t) => console.log("created", t)} />
|
||||
</Frame>
|
||||
),
|
||||
};
|
||||
export const EdgeEmpty: Story = {
|
||||
render: () => (
|
||||
<AudioProvider
|
||||
options={{
|
||||
adapter: { context: makeFakeAudioContext() as never },
|
||||
}}
|
||||
>
|
||||
<div style={{ padding: 24 }}>
|
||||
<PluginLoader />
|
||||
</div>
|
||||
</AudioProvider>
|
||||
),
|
||||
};
|
||||
Reference in New Issue
Block a user