Skip to content

magic-modules/messages

Repository files navigation

@magic-modules/messages

shows messages with arbitrary types. supports info, success, warning and error messages out of the box, and it's easy to add new message types.

NPM version Linux Build Status Windows Build Status Coverage Status Greenkeeper badge Known Vulnerabilities

install:

npm install --save-exact @magic-modules/messages

usage:

HOIST in config.mjs

export default {
  // ...other config
  HOIST: ['Messages'],
}

add message type:

export const View = () => {
  const msg = {
    type: 'newType',
    title: 'newType title',
    content: 'newType content',
    duration: 5,
  }

  return button({ onclick: [actions.messages.add, msg] })
}

// needed in the ssr step for now,
// gets overwritten by @magic-modules/messages with the correct actions.
export const actions = {
  messages: {},
}

export const style = vars => ({
  '.Messages': {
      '.Message.newType': {
        h3: {
          color: vars.colors.pink[900],
        },
      },
    },
  }
})

changelog

0.0.1 - unreleased

first release

0.0.2

bump required node version to 14.15.4

0.0.3

update dependencies (@magic-libraries/db)

0.0.4

update dependencies (@magic-libraries/db)

0.0.5 - unreleased

...

About

provides actions.messages.add to add messages, handles display and removal of those messages.

Resources

License

Stars

Watchers

Forks

Packages

No packages published