0.3.0 • Published 2 years ago

makeup-dialog-button v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

makeup-dialog-button

A JavaScript class representing a popup button for any kind of dialog. No CSS provided.

View Demo.

HTML

The following markup structure and classnames are required. Any SVG icons can be used.

<button data-makeup-for="dialog-lightbox" class="dialog-button" type="button" aria-haspopup="dialog">Lightbox</button>

<div class="lightbox-dialog" hidden id="dialog-lightbox" role="dialog" aria-labelledby="dialog-1-title" aria-modal="true">
    <!-- dialog internals -->
</div>

CSS

No CSS is provided. However, the class is fully compatible with eBay Skin.

JavaScript

import DialogButton from 'makeup-dialog-button';
import LightboxDialog from 'makeup-lightbox-dialog';

document.querySelectorAll('.dialog-button').forEach(function(el, i) {
    const dialogEl = document.getElementById(el.dataset.makeupFor);
    const dialogWidget = new LightboxDialog(dialogEl);
    const widget = new DialogButton(el, dialogWidget, config);

    dialogWidget._el.addEventListener('dialog-open', log);
    dialogWidget._el.addEventListener('dialog-close', log);
});

Config

The constructor takes a configuration object as its third parameter.

Events

None

0.3.0

2 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago