-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7344067
commit 57dcf63
Showing
4 changed files
with
437 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import React from "react"; | ||
import { render, fireEvent, cleanup } from "@testing-library/react"; | ||
import Carousel from "../index"; | ||
import { color, typography } from "../../../shared/styles"; | ||
|
||
describe("test Carousel component", () => { | ||
it(" ", () => {}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React from "react"; | ||
import Carousel from "./index"; | ||
import { | ||
withKnobs, | ||
text, | ||
boolean, | ||
color, | ||
select, | ||
number, | ||
} from "@storybook/addon-knobs"; | ||
|
||
export default { | ||
title: "数据展示 /Carousel", | ||
component: "Carousel", | ||
decorators: [withKnobs], | ||
}; | ||
|
||
const DivExample = (height: number, index: number) => { | ||
return ( | ||
<div | ||
style={{ | ||
background: "#364d79", | ||
}} | ||
key={index} | ||
> | ||
<span | ||
style={{ | ||
lineHeight: `${height}px`, | ||
color: "white", | ||
fontSize: "20px", | ||
fontWeight: 800, | ||
width: "100%", | ||
textAlign: "center", | ||
display: "inline-block", | ||
}} | ||
> | ||
{index + 1} | ||
</span> | ||
</div> | ||
); | ||
}; | ||
export const knobsCarousel = () => { | ||
const height = number("height", 300); | ||
const num = number("item number", 4); | ||
return ( | ||
<Carousel | ||
delay={number("delay", 300)} | ||
height={height} | ||
radioAppear={select( | ||
"radioAppear", | ||
Object.keys(color) as Array<keyof typeof color>, | ||
"primary" | ||
)} | ||
defaultIndex={number("defaultIndex", 0)} | ||
autoplay={boolean("autoplay", true)} | ||
viewportBoxshadow={text("viewportBoxshadow", "2px 2px 4px #d9d9d9")} | ||
autoplayReverse={boolean("autoplayReverse", false)} | ||
animationDelay={number("animationDelay", 500)} | ||
autoplayDelay={number("autoplayDelay", 5000)} | ||
> | ||
{new Array(num).fill(height).map((v, i) => DivExample(v, i))} | ||
</Carousel> | ||
); | ||
}; |
Oops, something went wrong.