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

vendor eve-button as temp fix for flashing styles as text #753

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions www/components/banner/banner.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css, html, LitElement, unsafeCSS } from 'lit';
import bannerCss from './banner.css?type=css';
import buttonCss from './button.css?type=css';
import '@evergreen-wc/eve-button';
import './eve-button.js';
import '@evergreen-wc/eve-container';

class Banner extends LitElement {
Expand All @@ -22,7 +22,6 @@ class Banner extends LitElement {

static get styles() {
return css`
${unsafeCSS(buttonCss)}
${unsafeCSS(bannerCss)}
`;
}
Expand Down
1 change: 1 addition & 0 deletions www/components/banner/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
background-color: #201e2e;
border: 1px solid white;
transition: 0.3s;
text-decoration: none;
}

:host .btn:hover,
Expand Down
37 changes: 37 additions & 0 deletions www/components/banner/eve-button.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* stylelint-disable */
:host {
& .btn {
margin: 2px;
border: 1px solid var(--btn-border-color, var(--primary-color, green));
color: var(--btn-text-color, var(--primary-color, green));
background-color: var(--btn-background, var(--secondary-color, white) );
text-decoration:none;
position:relative;
display: inline-block;
border-radius: var(--btn-border-radius, 0px);

&:hover {
background-color: var(--btn-hover-background-color, var(--primary-color, green));
color: var(--btn-hover-text-color, var(--secondary-color, white));
border: 1px solid var(--btn-hover-border-color, var(--primary-color, green));
}
}
& .btn-xs {
padding:5px;
font-size:12px;
}

& .btn-sm {
padding:5px;
font-size:16px;
}

& .btn-md {
padding:10px;
font-size:20px;
}
& .btn-lg {
padding:15px;
font-size:25px;
}
}
64 changes: 64 additions & 0 deletions www/components/banner/eve-button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { css, html, LitElement, unsafeCSS } from 'lit';
import eveButtonCss from './eve-button.css';

class Button extends LitElement {

static get properties() {
return {
href: {
type: String
},
onClick: {
type: Function
},
size: {
type: String
},
style: {
type: String
}
};
}

get styles() {
return css`
${unsafeCSS(eveButtonCss)}
`;
}

updated() {
const shadow = this.shadowRoot;
const childNodes = Array.from(shadow.childNodes);

childNodes.forEach(childNode => {
if (childNode.nodeName === 'STYLE') {
childNode.textContent += this.style;
} else if (childNode.nodeName === 'A') {
childNode.style = this.style;
}
});
}

/* eslint-disable indent */
render() {
const { size, href, onClick } = this;

return html`
<style>
</style>
${href
? html`
<a class="btn btn-${size}" href="${href}">
<slot></slot>
</a>
`
: html `
<a class="btn btn-${size}" href="#" @click="${onClick}">
<slot></slot>
</a>
`}
`;
}
}

customElements.define('eve-button', Button);