Component to display messages on top right corner
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cli/build
entry
src/respo_message
.gitattributes
.gitignore
README.md
calcit.edn
meyvn.edn
package.json
shadow-cljs.edn
yarn.lock

README.md

Respo Message

Message component for Respo apps.

Demo http://repo.respo-mvc.org/message/

Usage

Clojars Project

[respo/message "0.3.4"]

You will need:

respo-message.action/message-action?
respo-message.action/create
respo-message.action/clear
respo-message.action/remove-one
respo-message.action/dict
respo-message.updater/update-messages
respo-message.comp.messages/comp-messages

To mount component and show a message, by default it shows for 4 seconds:

(comp-messages (:messages store) {:bottom? true}
               (fn [info d! m!] (d! action/remove-one info)))
(dispatch! action/create {:text (lorem-ipsum), :token "xxx"}))

(dispatch! action/remove-one {:token "xxx"})

Messages can be removed with :id or :token, where :token is what you can generate.

Sorry but the component gets even harder to setup:

(defn dispatch! [op op-data]
  (let [op-id (.generate shortid),
        op-time (.now js/Date), store @*store]
    (reset! *store
            (cond
              (= op :states) (update store :states (mutate op-data))
              (action/message-action? op)
                (update store
                        :messages
                        #(update-messages % op op-data op-id op-time))
              :else (do (println "Unhandled operation:" op) store)))))

Develop

Workflow https://github.com/mvc-works/calcit-workflow

License

MIT