-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(card): adds paddingSize prop to Card
- Loading branch information
Showing
4 changed files
with
62 additions
and
7 deletions.
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 |
---|---|---|
@@ -1,17 +1,46 @@ | ||
import * as React from "react"; | ||
import { storiesOf } from "@storybook/react"; | ||
import { withReadme } from "storybook-readme"; | ||
import { withKnobs, select } from "@storybook/addon-knobs"; | ||
import { Card } from "../index"; | ||
import { SpaceSize } from "../../shared/styles/styleUtils/modifiers/modifierUtils"; | ||
|
||
const readme = require("../README.md"); | ||
|
||
storiesOf("Card", module) | ||
.addDecorator(withReadme([readme])) | ||
.addDecorator(withKnobs) | ||
.add("default", () => <Card>default</Card>) | ||
.add("2:1 aspect ratio", () => { | ||
.add("paddingSize", () => { | ||
const sizes = { | ||
s: "s", | ||
m: "m", | ||
l: "l", | ||
xl: "xl" | ||
}; | ||
const size = select("paddingSize", sizes, "m"); | ||
|
||
return ( | ||
<div style={{ maxWidth: "400px" }}> | ||
<Card aspectRatio={[2, 1]}>I stay at a 2:1 aspect ratio</Card> | ||
</div> | ||
<Card paddingSize={size as SpaceSize}> | ||
Use the Knobs panel to change the padding | ||
</Card> | ||
); | ||
}); | ||
}) | ||
.add("responsive paddingSize", () => ( | ||
<Card | ||
paddingSize={{ | ||
default: "s", | ||
small: "m", | ||
medium: "l", | ||
large: "xl", | ||
jumbo: "xxl" | ||
}} | ||
> | ||
Resize the viewport to see the padding change | ||
</Card> | ||
)) | ||
.add("2:1 aspect ratio", () => ( | ||
<div style={{ maxWidth: "400px" }}> | ||
<Card aspectRatio={[2, 1]}>I stay at a 2:1 aspect ratio</Card> | ||
</div> | ||
)); |
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