Skip to content

Instantly share code, notes, and snippets.

@jcdalton2201
Last active October 7, 2019 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcdalton2201/e3e0ab90a76f42e3fdbbaea41cca0f83 to your computer and use it in GitHub Desktop.
Save jcdalton2201/e3e0ab90a76f42e3fdbbaea41cca0f83 to your computer and use it in GitHub Desktop.
simple button
class SimpleButton extends HTMLElement {
constructor() {
super();this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
button {
align-items: center; display: flex; justify-content: center; position: relative; flex-flow: column; min-width: 88px;
box-sizing: border-box; cursor: pointer; font-size: 1.25rem; font-weight: 400; height: 2.25rem; line-height: 2.25rem;
text-align: center; white-space: nowrap; color: var(--color-white,white); border-radius: var(--radius-default,$radius-default);
text-transform: uppercase;text-decoration: none;margin:0;padding: 0 1rem;border-width: 0px;width: fit-content;
background-color: var(--color-primary,red);transition: all 0.4s ease 0s;
}
button:hover {
background: var(--color-green,green);letter-spacing: 1px;
box-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);
transition: all 0.4s ease 0s;
}
</style>
<button><slot></slot></button>
`
}
}
if (!customElements.get('simple-button') ){
customElements.define('simple-button', SimpleButton);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment