Skip to content
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

updating to support HA 0.88 #63

Merged
merged 4 commits into from Feb 23, 2019
Merged

updating to support HA 0.88 #63

merged 4 commits into from Feb 23, 2019

Conversation

ammmze
Copy link
Contributor

@ammmze ammmze commented Feb 22, 2019

Went through a few iterations discussed in #57 and #60. The gist of the changes are...

  1. get LitElement from home-assistant-main instead of hui-error-entity-row
  2. create an additional custom element named button-card-button which will be based on mwc-button if available, otherwise fallback to paper-button
  3. override a couple of the mwc-button's styles to allow for variable height and font color inheriting
  4. moved the styles to come from a static method, so they are no longer duplicated
  5. wrap everything in a closure to prevent polluting the window and avoid conflicts with window

The result looks like this...

home assistant 2019-02-21 19-55-27

prevent polluting the `window` and avoid conflicts with things in the `window` to resolve custom-cards#64
@ammmze
Copy link
Contributor Author

ammmze commented Feb 22, 2019

@ohadbenita you mentioned over here (just wanted to bring that conversation into the PR where we are addressing the home assistant 0.88.0 issues) that the styles are not being respected. Can you share what styles you are using that are no longer respected? Home assistant changed the underlying button we use and its styles are a bit more fixed. For example, the color and height were fixed and we had to specifically override them. I don't currently have any custom styles on my instances and not sure what custom styles everyone else is using. But based on the README, i guess it's safe to assume at least font-size and font-weight are common-ish ones

moving the styles to the inner div should allow us to override with custom `styles`
@ammmze
Copy link
Contributor Author

ammmze commented Feb 22, 2019

@ohadbenita I've just pushed an update that should allow the custom styles to work. Try it out and let us know how it works. I'll check in later...time for my day job :)

@kuuji
Copy link
Collaborator

kuuji commented Feb 22, 2019

That looks awesome @ammmze ! Thanks a lot.

Gonna try to look at this asap.

@ohadbenita
Copy link

ohadbenita commented Feb 22, 2019 via email

@jimz011
Copy link

jimz011 commented Feb 22, 2019

Hi, I’m not really great with merging code but I still wanted to ask this question.

Would it be possible to merge this with lopton’s code? His code is a fork of this project and I unfortunately rely on it.

Thanks for this fix though, my wife was getting crazy already that her buttons no longer worked :P.

Edit: link to repository/code here:
https://github.com/Lopton/button-card

@DavidFW1960
Copy link

So I am finding the button is smaller than previousle on mobile as well as on my desktop.
image
The 2 buttons on the left are the core button-card and the exit-enter one is this custom-button-card...

@DavidFW1960
Copy link

Loaded the new one... and now it's bigger lol
image

@iantrich
Copy link
Member

@DavidFW1960 if it's something small like that, I say we proceed with merging this and worry about small tweaks later so we can get everyone back up and running. I'll do some more testing tonight along with @kuuji

@DavidFW1960
Copy link

Yeah I agree Ian.... Great job here by all..

@DavidFW1960
Copy link

OK I changed the padding on line 41 to 4% instead of 8px and it is perfect on my ipad and chrome pc and my iPhone!!!

So I recommend changing to 4%

@peterhoe
Copy link

@DavidFW1960 how are you getting the font to display below your button in upper and lower case? Using css style?
I seem to get all upper case in a system style font below my buttons (and on some of my system generated buttons as well eg: check configuration button). Perhaps I haven't pulled the latest iteration?
01
02
03

@DavidFW1960
Copy link

Like I said they are the core button-card for those 2 on the left.

@peterhoe
Copy link

peterhoe commented Feb 22, 2019

@DavidFW1960 - doh, yep you're getting the same uppercase font as well, sorry my bad -
out of interest, is your check config button under configuration validation and links under configuration loading also displaying the same font style?

button-card.js Outdated Show resolved Hide resolved
Co-Authored-By: ammmze <ammmze@gmail.com>
@iantrich
Copy link
Member

I'm going to go ahead and merge/release this and we can do cleanup later.

@iantrich iantrich merged commit a46082c into custom-cards:master Feb 23, 2019
@ammmze
Copy link
Contributor Author

ammmze commented Feb 23, 2019

Phew ... got that change in just in time :)

@ammmze ammmze deleted the patch-2 branch February 23, 2019 00:18
@iantrich
Copy link
Member

I was waiting for it :)

We should cleanup the text to match the core buttons look/feel

@peterhoe
Copy link

@iantrich Thanks.
text-transform: none; fixed the upper lowercase text displayed
however, it still appears to be 'bold' when compared to hass lovelace generated

01
02

@iantrich
Copy link
Member

@peterhoe I don't care for this release. Not going for perfection, just up and running

@ammmze
Copy link
Contributor Author

ammmze commented Feb 23, 2019

It is slightly bolded. The mwc-button applies a font-weight: 500 which is just a tad bolder than normal which is 400. Also is it the font different from the core entity button? I don't currently have an entity button setup (still fairly new to home assistant)

@DavidFW1960
Copy link

style:
  - font-weight: 400

Cant make the bottom of the button align with the normal button though.... nothing I try helps..

@peterhoe
Copy link

Same font as mwc-button, for example used on the Configuration / Configuration validation pane.
This change to move everything to mwc-button was as per design with V88

https://github.com/home-assistant/home-assistant-polymer/pull/2744

@peterhoe
Copy link

peterhoe commented Feb 23, 2019

This got me back close enough to what i had before

style:
- text-transform: none
- font-weight: 400
- font-size: 12px

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants