Commit 34b73eaf authored by 张媛's avatar 张媛

story文件组织完善

parent 169b1da6
import '@storybook/addon-actions/register';
import '@storybook/addon-links/register';
import '@storybook/addon-notes/register';
import 'storybook-readme/register';
\ No newline at end of file
const path = require("path");
// your app's webpack.config.js
const custom = require('./webpack.config.js');
module.exports = {
stories: ['../src/stories/index.tsx'],
addons: [
{
"name": "@storybook/preset-create-react-app",
"options": {
"craOverrides": {
"fileLoaderExcludes": [".less"]
}
}
}
],
}
\ No newline at end of file
stories: ['../src/**/*.stories.tsx'],
};
\ No newline at end of file
This diff is collapsed.
import React from 'react';
import "./testSpan.less";
export const TestSpan = (obj)=>{
return <span className="testButton"><span className = "testButton-inner"></span>{obj.label}</span>
}
\ No newline at end of file
import React from 'react';
import { Button } from "@storybook/react/demo";
export default {
component: Button,
title: 'Components/Button',
};
//👇 We create a “template” of how args map to rendering
const Template = (args) => <Button {...args} />;
//👇 Each story then reuses that template
export const Primary = Template.bind({});
Primary.args = {
primary: true,
label: 'Button',
};
import React from 'react';
import { TestSpan } from "../components/testSpan/testSpan";
export default {
component: TestSpan,
title: 'Components/TestSpan',
};
//👇 We create a “template” of how args map to rendering
const Template = (args) => <TestSpan {...args} />;
//👇 Each story then reuses that template
export const Primary = Template.bind({});
Primary.args = {
primary: true,
label: 'TestSpan',
};
import React from "react";
import { storiesOf } from "@storybook/react";
import { Button } from "@storybook/react/demo";
import "./test"
import "./index.less"
storiesOf("Button", module)
.add("with text", () => <Button>Hello Button</Button>)
.add("with emoji", () => (
<Button>
<span role="img" aria-label="so cool">
</span>
</Button>
));
storiesOf("TestButton", module)
.add("with text", () => <span className="testButton"><span className = "testButton-inner"></span></span>)
\ No newline at end of file
const a = 1;
function add(b:number){
return b+a
}
console.log(add(3))
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment