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

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

	connectedCallback() {
		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';
		button.innerText = this.dataset.text;

		root.appendChild(button);
	}

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

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