mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-20 05:02:37 +08:00
Added support for named exports with function declaration in source-loader, in order to fix that the story's source code doesn't show up in Docs mode's code preview. The changes in generate-helpers.js is necessary because we can't wrap named export functions: ``` export function foo() {} // turns into this if we just wrapped it export wrapper(function foo() {}) // syntax error! ```
30 lines
611 B
Plaintext
30 lines
611 B
Plaintext
import React from "react";
|
|
import { action } from "@storybook/addon-actions";
|
|
import { Button } from "@storybook/react/demo";
|
|
|
|
export default {
|
|
title: "Button"
|
|
};
|
|
|
|
export const text = () => (
|
|
<Button onClick={action("clicked")}>Hello Button</Button>
|
|
);
|
|
|
|
export const emoji = () => (
|
|
<Button onClick={action("clicked")}>
|
|
<span role="img" aria-label="so cool">
|
|
😀 😎 👍 💯
|
|
</span>
|
|
</Button>
|
|
);
|
|
|
|
export function emojiFn() {
|
|
return (
|
|
<Button onClick={action("clicked")}>
|
|
<span role="img" aria-label="so cool">
|
|
😀 😎 👍 💯
|
|
</span>
|
|
</Button>
|
|
)
|
|
};
|