/cyclejs-modal

An easy way to open custom modals in a cyclejs app

Primary LanguageTypeScriptMIT LicenseMIT

cyclejs-modal

An easy way to open custom modals in a cyclejs app

Documentation is hosted on Github Pages

Use it

npm install --save cyclejs-modal

Example

You can find the examples in the examples/ folder

function main({ DOM }) {
    return {
        DOM: xs.of(button('.button', ['open modal'])),
        modal: DOM.select('.button').events('click')
            .mapTo({
                type: 'open',
                component: isolate(modal, 'myscope')
            } as ModalAction)
    };
}

function modal({ DOM }) {
    return {
        DOM: xs.of(div('.div', [
            span('.span', ['This is a modal. Yeah? :)']),
            button('.button', ['close'])
        ])),
        modal: DOM.select('.button').events('click')
            .mapTo({ type: 'close' } as ModalAction)
    };
}

Try it

Clone it, run npm i && npm run examples