Skip to content

Commit f923e87

Browse files
committed
Merge branch 'master' into 1.0
2 parents 8c7cb3f + 3fd4f24 commit f923e87

24 files changed

+832
-13
lines changed

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
elements/*/*.umd.js -diff -merge
2+
elements/*/*.umd.js.map -diff -merge
3+
themes/*/*.umd.js -diff -merge
4+
themes/*/*.umd.js.map -diff -merge

.storybook/utils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This is a collection of functions to reuse within RHElements stories.
2+
3+
export function escapeHTML(html) {
4+
const div = document.createElement("div");
5+
const text = document.createTextNode(html);
6+
div.appendChild(text);
7+
return div.innerHTML;
8+
}

doc/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ <h1>RHElements demos</h1>
1313
<li><a href="../elements/rh-card/demo">rh-card</a></li>
1414
<li><a href="../elements/rh-cta/demo">rh-cta</a></li>
1515
<li><a href="../elements/rh-datetime/demo">rh-datetime</a></li>
16+
<li><a href="../elements/rh-health-index/demo">rh-health-index</a></li>
1617
<li><a href="../elements/rh-icon-panel/demo">rh-icon-panel</a></li>
1718
<li><a href="../elements/rh-icon/demo">rh-icon</a></li>
1819
<li><a href="../elements/rh-number/demo">rh-number</a></li>

elements/all/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"@rhelements/rh-card": "file:elements/rh-card",
1515
"@rhelements/rh-cta": "file:elements/rh-cta",
1616
"@rhelements/rh-datetime": "file:elements/rh-datetime",
17+
"@rhelements/rh-health-index": "file:elements/rh-health-index",
1718
"@rhelements/rh-icon": "file:elements/rh-icon",
1819
"@rhelements/rh-icon-panel": "file:elements/rh-icon-panel",
1920
"@rhelements/rh-number": "file:elements/rh-number",

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

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
import { storiesOf } from "@storybook/polymer";
2-
import { withKnobs, text, select } from "@storybook/addon-knobs/polymer";
2+
import {
3+
withKnobs,
4+
text,
5+
select,
6+
boolean
7+
} from "@storybook/addon-knobs/polymer";
38
import "./rh-card";
49
import cpTheme from "../../themes/cp-theme/cp-theme.js";
10+
import { escapeHTML } from "../../.storybook/utils.js";
511

612
const stories = storiesOf("Card", module);
713
stories.addDecorator(withKnobs);
814

915
stories.add("rh-card", () => {
1016
const colorLabel = "Color";
17+
const ctaLabel = "Call to Action";
18+
const ctaTypeLabel = "Priority";
19+
const colorDefault = "default";
20+
const ctaDefault = false;
21+
const ctaTypeDefault = "default";
22+
let ctaPriorityValue = "";
23+
let cardFooter = "";
24+
let cardFooterString = "";
25+
let valueAttr = "";
26+
let ctaOnDark = "";
27+
let colorAttr = "";
1128

1229
const colorOptions = {
1330
lightest: "lightest",
@@ -19,11 +36,30 @@ stories.add("rh-card", () => {
1936
accent: "accent"
2037
};
2138

22-
const colorDefault = "default";
39+
const ctaTypeOptions = {
40+
default: "default",
41+
primary: "primary",
42+
secondary: "secondary"
43+
};
2344

2445
const colorValue = select(colorLabel, colorOptions, colorDefault);
46+
const ctaValue = boolean(ctaLabel, ctaDefault);
2547

26-
let colorAttr = colorValue != "default" ? ` color="${colorValue}"` : "";
48+
if (ctaValue != false) {
49+
let ctaPriorityValue = select(ctaTypeLabel, ctaTypeOptions, ctaTypeDefault);
50+
valueAttr =
51+
ctaPriorityValue != "default" ? ` priority="${ctaPriorityValue}"` : "";
52+
if (
53+
colorValue != "lightest" &&
54+
colorValue != "light" &&
55+
colorValue != "default"
56+
) {
57+
ctaOnDark = ' on="dark"';
58+
}
59+
cardFooter = `\n <div slot="footer"><rh-cta${valueAttr}${ctaOnDark}><a href="#">Learn more</a></div>`;
60+
}
61+
62+
colorAttr = colorValue != "default" ? ` color="${colorValue}"` : "";
2763

2864
return `
2965
@@ -47,7 +83,7 @@ stories.add("rh-card", () => {
4783
<h2>Your RHElement</h2>
4884
<rh-card class="custom-card"${colorAttr}>
4985
<h2 slot="header">Card Heading</h2>
50-
<p>Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.</p>
86+
<p>Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.</p>${cardFooter}
5187
</rh-card>
5288
</section>
5389
<section>
@@ -56,9 +92,9 @@ stories.add("rh-card", () => {
5692
<code>&lt;rh-card${colorAttr}&gt;
5793
&lt;h2 slot="header"&gt;Card Heading&lt/h2&gt;
5894
&lt;p&gt;Become a Member&lt;/p&gt;
95+
${escapeHTML(cardFooter)}
5996
&lt;/rh-card&gt;</code>
6097
</pre>
61-
6298
</section>
6399
<section>
64100
<h2>At a glance</h2>
@@ -70,14 +106,8 @@ stories.add("rh-card", () => {
70106
</rh-card>
71107
<rh-card color="light">
72108
<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-
109+
<p>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.</p>
110+
<p>Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.</p>
81111
<div slot="footer"><rh-cta priority="secondary"><a href="#">Learn more</a></rh-cta></div>
82112
</rh-card>
83113
<rh-card>

elements/rh-health-index/.babelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"presets": [
3+
["env", { "modules": "umd" }]
4+
]
5+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# EditorConfig: http://EditorConfig.org
2+
3+
# Top-most EditorConfig file
4+
root = true
5+
6+
# Rules for JavaScript files:
7+
8+
[*.{js,py,json,sh,html}]
9+
# 4 space indentation
10+
indent_style = space
11+
indent_size = 2
12+
# No trailing spaces
13+
trim_trailing_whitespace = true
14+
# Unix-style newlines
15+
end_of_line = lf
16+
# Newline ending every file
17+
insert_final_newline = true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
language: node_js
2+
dist: trusty
3+
sudo: required
4+
addons:
5+
firefox: "latest"
6+
apt:
7+
sources:
8+
- google-chrome
9+
packages:
10+
- google-chrome-stable
11+
node_js: stable
12+
before_install:
13+
- npm install -g web-component-tester
14+
install:
15+
- npm install
16+
before_script:
17+
script:
18+
- xvfb-run npm run test
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright 2018 Red Hat, Inc.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

0 commit comments

Comments
 (0)