Skip to content

Commit a526b51

Browse files
TylerMartin5kylebuch8
authored andcommitted
Rh card story (#164)
* update story format and add card examples * Initial rh-card story
1 parent 79b9fec commit a526b51

1 file changed

Lines changed: 108 additions & 8 deletions

File tree

elements/rh-card/rh-card.story.js

Lines changed: 108 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,111 @@
11
import { storiesOf } from "@storybook/polymer";
2+
import { withKnobs, text, select } from "@storybook/addon-knobs/polymer";
23
import "./rh-card";
4+
import cpTheme from "../../themes/cp-theme/cp-theme.js";
35

4-
storiesOf("Card", module).add(
5-
"rh-card",
6-
() => `
7-
<rh-card>
8-
Card
9-
</rh-card>
10-
`
11-
);
6+
const stories = storiesOf("Card", module);
7+
stories.addDecorator(withKnobs);
8+
9+
stories.add("rh-card", () => {
10+
const colorLabel = "Color";
11+
12+
const colorOptions = {
13+
lightest: "lightest",
14+
light: "light",
15+
default: "default",
16+
dark: "dark",
17+
darkest: "darkest",
18+
complement: "complement",
19+
accent: "accent"
20+
};
21+
22+
const colorDefault = "default";
23+
24+
const colorValue = select(colorLabel, colorOptions, colorDefault);
25+
26+
let colorAttr = colorValue != "default" ? ` color="${colorValue}"` : "";
27+
28+
return `
29+
30+
<style>
31+
.custom-card {
32+
width: 40%;
33+
}
34+
35+
.demo-cards {
36+
display: flex;
37+
flex-wrap: wrap;
38+
}
39+
40+
.demo-cards > rh-card {
41+
margin: 0 16px 32px;
42+
width: calc(35% - 32px);
43+
}
44+
</style>
45+
46+
<section>
47+
<h2>Your RHElement</h2>
48+
<rh-card class="custom-card"${colorAttr}>
49+
<h2 slot="header">Card Heading</h2>
50+
<p>Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.</p>
51+
</rh-card>
52+
</section>
53+
<section>
54+
<h2>Markup</h2>
55+
<pre style="margin-left:15px;">
56+
<code>&lt;rh-card${colorAttr}&gt;
57+
&lt;h2 slot="header"&gt;Card Heading&lt/h2&gt;
58+
&lt;p&gt;Become a Member&lt;/p&gt;
59+
&lt;/rh-card&gt;</code>
60+
</pre>
61+
62+
</section>
63+
<section>
64+
<h2>At a glance</h2>
65+
<div class="demo-cards">
66+
<rh-card color="lightest">
67+
<h2 slot="header">Lightest card</h2>
68+
<p>This is the lightest rh-card.</p>
69+
<div slot="footer"><rh-cta priority="primary"><a href="#">Learn more</a></rh-cta></div>
70+
</rh-card>
71+
<rh-card color="light">
72+
<h2 slot="header">Light card</h2>
73+
74+
<p>
75+
Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition.
76+
</p>
77+
<p>
78+
Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.
79+
</p>
80+
81+
<div slot="footer"><rh-cta priority="secondary"><a href="#">Learn more</a></rh-cta></div>
82+
</rh-card>
83+
<rh-card>
84+
<h2 slot="header">Default card</h2>
85+
Unwrapped item. This is the default rh-card.
86+
<div slot="footer"><rh-cta priority="secondary"><a href="#">Learn more</a></rh-cta></div>
87+
</rh-card>
88+
<rh-card color="dark">
89+
<h2 slot="header">Dark Card</h2>
90+
<p>This is the dark rh-card.</p>
91+
<div slot="footer"><rh-cta priority="secondary" on="dark"><a href="#">Learn more</a></rh-cta></div>
92+
</rh-card>
93+
<rh-card color="darkest">
94+
<h2 slot="header">Darkest Card</h2>
95+
<p>This is the darkest rh-card.</p>
96+
<div slot="footer"><rh-cta priority="secondary" on="dark"><a href="#">Learn more</a></rh-cta></div>
97+
</rh-card>
98+
<rh-card color="complement">
99+
<h2 slot="header">Complement Card</h2>
100+
<p>This is the complement rh-card.</p>
101+
<div slot="footer"><rh-cta priority="secondary" on="dark"><a href="#">Learn more</a></rh-cta></div>
102+
</rh-card>
103+
<rh-card color="accent">
104+
<h2 slot="header">Accent Card</h2>
105+
<p>This is the accent rh-card. Leverage agile frameworks to provide a robust synopsis for high level overviews.</p>
106+
</rh-card>
107+
</div>
108+
</section>
109+
110+
`;
111+
});

0 commit comments

Comments
 (0)