-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Refactor cover controls into a separate component. #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| <link rel="import" href="../../bower_components/polymer/polymer.html"> | ||
| <link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html"> | ||
|
|
||
| <link rel="import" href="../util/cover-model.html"> | ||
|
|
||
| <dom-module id="ha-cover-controls"> | ||
| <template> | ||
| <style> | ||
| .state { | ||
| text-align: right; | ||
| white-space: nowrap; | ||
| width: 127px; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually both of those are not needed at all. Removing.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure, our cards can be pretty wide if you have only 1 column. In that case the controls should be right aligned which I don't think they are now.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The controls are right aligned because
If the |
||
| } | ||
| [invisible] { | ||
| visibility: hidden !important; | ||
| } | ||
| </style> | ||
|
|
||
| <div class='state'> | ||
| <paper-icon-button icon="mdi:arrow-up" on-tap='onOpenTap' | ||
| invisible$='[[!entityObj.supportsOpen]]' | ||
| disabled='[[entityObj.isFullyOpen]]'></paper-icon-button> | ||
| <paper-icon-button icon="mdi:stop" on-tap='onStopTap' | ||
| invisible$='[[!entityObj.supportsStop]]'></paper-icon-button> | ||
| <paper-icon-button icon="mdi:arrow-down" on-tap='onCloseTap' | ||
| invisible$='[[!entityObj.supportsClose]]' | ||
| disabled='[[entityObj.isFullyClosed]]'></paper-icon-button> | ||
| </div> | ||
| </template> | ||
| </dom-module> | ||
|
|
||
| <script> | ||
| Polymer({ | ||
| is: 'ha-cover-controls', | ||
| properties: { | ||
| hass: { | ||
| type: Object, | ||
| }, | ||
| stateObj: { | ||
| type: Object, | ||
| }, | ||
| entityObj: { | ||
| type: Object, | ||
| computed: 'computeEntityObj(hass, stateObj)', | ||
| }, | ||
| }, | ||
| computeEntityObj: function (hass, stateObj) { | ||
| return new window.CoverEntity(hass, stateObj); | ||
| }, | ||
| onOpenTap: function () { | ||
| this.entityObj.openCover(); | ||
| }, | ||
| onCloseTap: function () { | ||
| this.entityObj.closeCover(); | ||
| }, | ||
| onStopTap: function () { | ||
| this.entityObj.stopCover(); | ||
| }, | ||
| }); | ||
| </script> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be part of
state-card-cover.htmlas it's about how the component should be rendered.