Skip to content

Commit b4219ef

Browse files
committed
Merge branch 'master' of https://github.com/prysmex/ember-eui
2 parents 626ef04 + d89983c commit b4219ef

File tree

11 files changed

+204
-94
lines changed

11 files changed

+204
-94
lines changed

addon/components/eui-callout/index.hbs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@
77
...attributes
88
>
99
{{#if @title}}
10-
{{#let (element (arg-or-default @heading "span")) as |H|}}
11-
<div class="euiCallOutHeader">
12-
{{#if @iconType}}
13-
<EuiIcon
14-
class="euiCallOutHeader__icon"
15-
@type={{@iconType}}
16-
@size="m"
17-
aria-hidden="true"
18-
/>
19-
{{/if}}
20-
<H class="euiCallOutHeader__title">
10+
<div class="euiCallOutHeader">
11+
{{#if @iconType}}
12+
<EuiIcon class="euiCallOutHeader__icon" @type={{@iconType}} @size="m" aria-hidden="true" />
13+
{{/if}}
14+
{{#if @heading}}
15+
<Text @tagName={{@heading}} class="euiCallOutHeader__title">
2116
{{@title}}
22-
</H>
23-
</div>
24-
{{/let}}
17+
</Text>
18+
{{else}}
19+
<span class="euiCallOutHeader__title">
20+
{{@title}}
21+
</span>
22+
{{/if}}
23+
</div>
2524
{{/if}}
2625
{{#if hasBlock}}
2726
<EuiText @size={{if (eq @size "s") "xs" "s"}}>
Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,31 @@
1-
{{#let (element (arg-or-default @tagName "div")) as |Element|}}
2-
<Element
3-
class={{class-names
4-
(unless (eq @responsive false) "euiFlexGrid--responsive")
5-
componentName="EuiFlexGrid"
6-
gutterSize=(arg-or-default @gutterSize "l")
7-
direction=(arg-or-default @direction "row")
8-
columns=(arg-or-default @columns 0)
9-
}}
10-
...attributes
11-
>
12-
{{yield}}
13-
</Element>
1+
{{#let (arg-or-default @tagName "div") as |tagName|}}
2+
{{#if (eq tagName "div")}}
3+
<div
4+
class={{class-names
5+
(unless (eq @responsive false) "euiFlexGrid--responsive")
6+
componentName="EuiFlexGrid"
7+
gutterSize=(arg-or-default @gutterSize "l")
8+
direction=(arg-or-default @direction "row")
9+
columns=(arg-or-default @columns 0)
10+
}}
11+
...attributes
12+
>
13+
{{yield}}
14+
</div>
15+
{{else}}
16+
{{#let (element tagName) as |Element|}}
17+
<Element
18+
class={{class-names
19+
(unless (eq @responsive false) "euiFlexGrid--responsive")
20+
componentName="EuiFlexGrid"
21+
gutterSize=(arg-or-default @gutterSize "l")
22+
direction=(arg-or-default @direction "row")
23+
columns=(arg-or-default @columns 0)
24+
}}
25+
...attributes
26+
>
27+
{{yield}}
28+
</Element>
29+
{{/let}}
30+
{{/if}}
1431
{{/let}}
Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
{{#let (element (arg-or-default @tagName "div")) as |Element|}}
2-
<Element
3-
class={{class-names
4-
componentName="EuiFlexItem"
5-
grow=@grow
6-
}}
7-
...attributes
8-
>
9-
{{yield}}
10-
</Element>
1+
{{#let (arg-or-default @tagName "div") as |tagName|}}
2+
{{#if (eq tagName "div")}}
3+
<div class={{class-names componentName="EuiFlexItem" grow=@grow}} ...attributes>
4+
{{yield}}
5+
</div>
6+
{{else if (eq tagName "span")}}
7+
<span class={{class-names componentName="EuiFlexItem" grow=@grow}} ...attributes>
8+
{{yield}}
9+
</span>
10+
{{else}}
11+
{{#let (element tagName) as |Element|}}
12+
<Element class={{class-names componentName="EuiFlexItem" grow=@grow}} ...attributes>
13+
{{yield}}
14+
</Element>
15+
{{/let}}
16+
{{/if}}
1117
{{/let}}
Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
{{! TODO: restrictWidth Prop}}
2-
{{#let (element (arg-or-default @tagName "div")) as |Tag|}}
3-
<Tag class="euiPageBody" ...attributes>
4-
{{yield
5-
(hash
6-
Header=(component "eui-page-header")
7-
Content=(component "eui-page-content")
8-
)
9-
}}
10-
</Tag>
2+
{{#let (arg-or-default @tagName "div") as |tagName|}}
3+
{{#if (eq tagName "div")}}
4+
<div class="euiPageBody" ...attributes>
5+
{{yield (hash Header=(component "eui-page-header") Content=(component "eui-page-content"))}}
6+
</div>
7+
{{else}}
8+
{{#let (element tagName) as |Tag|}}
9+
<Tag class="euiPageBody" ...attributes>
10+
{{yield (hash Header=(component "eui-page-header") Content=(component "eui-page-content"))}}
11+
</Tag>
12+
{{/let}}
13+
{{/if}}
1114
{{/let}}
Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
{{#let (element (arg-or-default @tagName "span")) as |Tag|}}
2-
<Tag
3-
class={{class-names
4-
componentName="EuiTextColor"
5-
color=(arg-or-default @color "default")
6-
}}
1+
{{#if (eq @tagName "div")}}
2+
<div
3+
class={{class-names componentName="EuiTextColor" color=(arg-or-default @color "default")}}
74
...attributes
85
>
96
{{yield}}
10-
</Tag>
11-
{{/let}}
7+
</div>
8+
{{else}}
9+
<span
10+
class={{class-names componentName="EuiTextColor" color=(arg-or-default @color "default")}}
11+
...attributes
12+
>
13+
{{yield}}
14+
</span>
15+
{{/if}}

addon/components/eui-text/index.hbs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,29 @@
66
}}
77
...attributes
88
>
9-
{{#let (if @textAlign (component "eui-text-align") (element "")) as |Align|}}
10-
{{#let (if @color (component "eui-text-color") (element "")) as |Color|}}
9+
{{#if (and @textAlign @color)}}
10+
{{#let (component "eui-text-align") as |Align|}}
11+
{{#let (component "eui-text-color") as |Color|}}
12+
<Align @textAlign={{@textAlign}}>
13+
<Color @color={{@color}} @tagName="div">
14+
{{yield}}
15+
</Color>
16+
</Align>
17+
{{/let}}
18+
{{/let}}
19+
{{else if (and @textAlign (not @color))}}
20+
{{#let (component "eui-text-align") as |Align|}}
1121
<Align @textAlign={{@textAlign}}>
12-
<Color @color={{@color}} @tagName="div">
13-
{{yield}}
14-
</Color>
22+
{{yield}}
1523
</Align>
1624
{{/let}}
17-
{{/let}}
25+
{{else if (and (not @textAlign) @color)}}
26+
{{#let (component "eui-text-color") as |Color|}}
27+
<Color @color={{@color}} @tagName="div">
28+
{{yield}}
29+
</Color>
30+
{{/let}}
31+
{{else}}
32+
{{yield}}
33+
{{/if}}
1834
</div>
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
{{#let (element (arg-or-default @tagName "h2")) as |Tag|}}
2-
<Tag
3-
class={{class-names
4-
componentName="EuiTitle"
5-
size=(arg-or-default @size "m")
6-
textTransform=@textTransform
7-
}}
8-
...attributes
9-
>
10-
{{yield}}
11-
</Tag>
12-
{{/let}}
1+
<Text
2+
@tagName={{arg-or-default @tagName "h2"}}
3+
class={{class-names
4+
componentName="EuiTitle"
5+
size=(arg-or-default @size "m")
6+
textTransform=@textTransform
7+
}}
8+
...attributes
9+
>
10+
{{yield}}
11+
</Text>

addon/components/text/index.hbs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{{#if (eq @tagName "h1")}}
2+
<h1 ...attributes>
3+
{{yield}}
4+
</h1>
5+
{{else if (eq @tagName "h2")}}
6+
<h2 ...attributes>
7+
{{yield}}
8+
</h2>
9+
{{else if (eq @tagName "h3")}}
10+
<h3 ...attributes>
11+
{{yield}}
12+
</h3>
13+
{{else if (eq @tagName "h4")}}
14+
<h4 ...attributes>
15+
{{yield}}
16+
</h4>
17+
{{else if (eq @tagName "h5")}}
18+
<h5 ...attributes>
19+
{{yield}}
20+
</h5>
21+
{{else if (eq @tagName "h6")}}
22+
<h6 ...attributes>
23+
{{yield}}
24+
</h6>
25+
{{else if (eq @tagName "p")}}
26+
<p ...attributes>
27+
{{yield}}
28+
</p>
29+
{{/if}}

app/components/text/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from 'ember-eui/components/text';

tests/dummy/app/templates/demo/text.hbs

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,41 @@
5151
</p>
5252
<EuiTextAlign @textAlign="left">
5353
<ul>
54-
<EuiTextColor @tagName="li">
55-
Default color
56-
</EuiTextColor>
57-
<EuiTextColor @color="subdued" @tagName="li">
58-
Subdued color
59-
</EuiTextColor>
60-
<EuiTextColor @color="secondary" @tagName="li">
61-
Secondary color
62-
</EuiTextColor>
63-
<EuiTextColor @color="accent" @tagName="li">
64-
Accent color
65-
</EuiTextColor>
66-
<EuiTextColor @color="danger" @tagName="li">
67-
Danger color
68-
</EuiTextColor>
69-
<EuiTextColor @color="warning" @tagName="li">
70-
Warning color
71-
</EuiTextColor>
72-
<EuiTextColor @color="ghost" @tagName="li">
73-
Ghost color
74-
</EuiTextColor>
54+
<li>
55+
<EuiTextColor>
56+
Default color
57+
</EuiTextColor>
58+
</li>
59+
<li>
60+
<EuiTextColor @color="subdued">
61+
Subdued color
62+
</EuiTextColor>
63+
</li>
64+
<li>
65+
<EuiTextColor @color="secondary">
66+
Secondary color
67+
</EuiTextColor>
68+
</li>
69+
<li>
70+
<EuiTextColor @color="accent">
71+
Accent color
72+
</EuiTextColor>
73+
</li>
74+
<li>
75+
<EuiTextColor @color="danger">
76+
Danger color
77+
</EuiTextColor>
78+
</li>
79+
<li>
80+
<EuiTextColor @color="warning">
81+
Warning color
82+
</EuiTextColor>
83+
</li>
84+
<li>
85+
<EuiTextColor @color="ghost">
86+
Ghost color
87+
</EuiTextColor>
88+
</li>
7589
</ul>
7690
</EuiTextAlign>
7791
<p>

0 commit comments

Comments
 (0)