import styles from '!raw-loader!sass-loader!./styles/app-button.scss';

class AppButton extends HTMLElement {
	constructor () {
		super();

		const root = this.attachShadow({mode: 'open'});

		const style = document.createElement('style');
		style.textContent = styles;
		root.appendChild(style);

		const button = document.createElement('div');
		button.className='button';
		this.button = button
		root.appendChild(button);
	}

	connectedCallback() {
		this.button.innerText = this.dataset.text;
	}

	static get observedAttributes() {
		return ['data-text', 'onclick'];
	}
}

customElements.define('app-button', AppButton);