0.0.2 • Published 4 years ago

@intergas/intergas-menu-modal v0.0.2

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
4 years ago

Install

npm install @intergas/intergas-menu-modal

Usage

import '@intergas/intergas-menu-modal';

window.addEventListener('DOMContentLoaded', () => {
	const menuModal = document.querySelector('intergas-menu-modal');

	document.getElementById('menu-button').addEventListener('click', () => {
		menuModal.setAttribute(
			'is-open', ''
		);
	});
});

In your html/php

<intergas-menu-modal menu="<?php echo is_array( $menu_items ) ?
	htmlspecialchars( json_encode( array_map( function( $menu_item ) {
		return [
			'url' => $menu_item->url,
			'label' => $menu_item->title
		];
	}, $menu_items ) ) ) : '';
?>"></intergas-menu-modal>

Loading the app data

window.addEventListener('DOMContentLoaded', () => {
	document.querySelector('intergas-menu-modal').setAttribute('apps', JSON.stringify([
		{
			name: "Example",
			logoSrc: "path/to/image.png",
			homePageUrl: "https://example.com"
		}
	]));
});
0.0.2

4 years ago

0.0.1

4 years ago