Skip to content

Commit 48fb263

Browse files
feat(addon/components/paper-tabs): converts to a glimmer component.
1 parent 71ca51b commit 48fb263

File tree

2 files changed

+385
-176
lines changed

2 files changed

+385
-176
lines changed

addon/components/paper-tabs.hbs

Lines changed: 74 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,76 @@
1-
{{! template-lint-disable no-action }}
2-
<md-tabs-wrapper class={{if this.shouldStretch "md-stretch-tabs"}}>
1+
<md-tabs
2+
class='md-no-tab-content md-default-theme
3+
{{~if @warn " md-warn"}}
4+
{{~if @accent " md-accent"}}
5+
{{~if @primary " md-primary"}}
6+
{{@class}}'
7+
md-border-bottom={{@borderBottom}}
8+
aria-label={{@ariaLabel}}
9+
{{did-insert this.didInsertNode}}
10+
{{did-update
11+
this.didUpdateNode
12+
this.children
13+
this.shouldCenter
14+
this.shouldStretch
15+
this.selected
16+
}}
17+
{{will-destroy this.willDestroyNode}}
18+
...attributes
19+
>
20+
<md-tabs-wrapper class={{if this.shouldStretch 'md-stretch-tabs'}}>
21+
{{#if this.shouldPaginate}}
22+
<md-prev-button
23+
role='button'
24+
class={{unless this.canPageBack 'md-disabled'}}
25+
{{on 'click' this.previousPage}}
26+
>
27+
<PaperIcon @icon='keyboard-arrow-left' />
28+
</md-prev-button>
29+
<md-next-button
30+
role='button'
31+
class={{unless this.canPageForward 'md-disabled'}}
32+
{{on 'click' this.nextPage}}
33+
>
34+
{{!
35+
md-next-button has a css rule that transforms the icon 180 degrees
36+
to point the right way
37+
}}
38+
<PaperIcon @icon='keyboard-arrow-left' />
39+
</md-next-button>
40+
{{/if}}
341

4-
{{#if this.shouldPaginate}}
5-
<md-prev-button role="button" class={{unless this.canPageBack "md-disabled"}} onclick={{action "previousPage"}}>
6-
{{paper-icon "keyboard-arrow-left"}}
7-
</md-prev-button>
8-
<md-next-button role="button" class={{unless this.canPageForward "md-disabled"}} onclick={{action "nextPage"}}>
9-
{{paper-icon "keyboard-arrow-left"}}
10-
</md-next-button>
11-
{{/if}}
42+
<md-tabs-canvas
43+
class='{{if this.shouldPaginate "md-paginated"}}
44+
{{~if this.shouldCenter " md-center-tabs"}}'
45+
tabindex='-1'
46+
role='tablist'
47+
>
48+
<md-pagination-wrapper
49+
class={{if this.shouldCenter 'md-center-tabs'}}
50+
style={{if this.shouldPaginate this.paginationStyle}}
51+
>
52+
{{yield
53+
(hash
54+
tab=(component
55+
'paper-tab'
56+
noInk=this.noInk
57+
parentComponent=this
58+
selected=this.selected
59+
onSelect=this.localOnChange
60+
)
61+
)
62+
}}
1263

13-
<md-tabs-canvas class="{{if this.shouldPaginate "md-paginated"}}{{if this.shouldCenter "md-center-tabs"}}" tabindex="-1" role="tablist">
14-
<md-pagination-wrapper class={{if this.shouldCenter "md-center-tabs"}} style={{if this.shouldPaginate this.paginationStyle}}>
15-
16-
{{yield (hash
17-
tab=(component "paper-tab"
18-
noInk=this.noInk
19-
selected=this.selected
20-
onSelect=(action "localOnChange")
21-
)
22-
)}}
23-
24-
{{#if this.inkBar}}
25-
<PaperInkBar @movingRight={{this.movingRight}} @left={{this.inkBar.left}} @right={{this.inkBar.right}} />
26-
{{/if}}
27-
28-
</md-pagination-wrapper>
29-
</md-tabs-canvas>
30-
31-
</md-tabs-wrapper>
64+
{{#if this.inkBar}}
65+
{{#let this.inkBar as |inkBar|}}
66+
<PaperInkBar
67+
@movingRight={{this.movingRight}}
68+
@left={{inkBar.left}}
69+
@right={{inkBar.right}}
70+
/>
71+
{{/let}}
72+
{{/if}}
73+
</md-pagination-wrapper>
74+
</md-tabs-canvas>
75+
</md-tabs-wrapper>
76+
</md-tabs>

0 commit comments

Comments
 (0)