npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cov-message-box

v7.2.0

Published

COV Message Box component using Kendo React Dialog. Modelled after C# Message Box

Downloads

7

Readme

cov-message-box

COV Message Box component using Kendo React Dialog. Modelled after C# Message Box

NPM JavaScript Style Guide

Install

npm install --save cov-message-box

Properties

message

The message to be displayed. Can be plain text or formatted as HTML e.g. you can pass in

<h1>Are you sure?</h1>

title

The title displayed at the top of the message box

buttonsArray

An array of strings that are used to render the buttons

            buttonsArray={["Yes", "No", "Maybe", "Cancel"]}

onClose

The callback function to be called when the message box is closed

defaultButton

A string that must match one of the strings passed to buttonsArray. Will be rendered as a primary button

editorContentStyle

The message is displayed inside a kendo react editor component. This sets styles to the content element wrapper of the Editor.

editorStyle

Sets styles of the Editor.

dialogActionsBarStyle

Sets styles of the div around the DialogActionsBar For example to center all the buttons you can use this css

{ display: "flex", justifyContent: "center", alignContent: "center" }

width

The width of the message box

height

The height of the message box

Usage

import React, { useState } from "react";

import { MessageBox } from "cov-message-box";
import { Button } from "@progress/kendo-react-buttons";

function App() {
  const [displayMessageBox, setDisplayMessageBox] = useState(false);

  function onShowMessageBox(messageBoxResult) {
    setDisplayMessageBox(true);
  }
  function onMessageBoxClose(messageBoxResult) {
    setDisplayMessageBox(false);
    console.log(messageBoxResult);
    switch (messageBoxResult.toUpperCase()) {
      case "NO":
        //do your no logic
        alert("user picked NO");
        break;
      case "YES":
        //do your yes logic
        alert("user picked YES");
        break;

      default:
        alert(`ERROR. Not valid: ${messageBoxResult} `);
        break;
    }
  }

  return (
    <>
      <div>
        <Button id="cancel-btn" onClick={onShowMessageBox} className="ml-5 mt-5">
          Show Message Box
        </Button>
      </div>

      {displayMessageBox === true ? (
        <div>
          <MessageBox
            message={`Are you sure?`}
            title={"Confirm Your action"}
            buttonsArray={["Yes", "No", "Maybe", "Cancel"]}
            onClose={onMessageBoxClose}
            defaultButton={"Yes"}
            editorContentStyle={{ height: "100px" }}
            editorStyle={{ textAlign: "center" }}
          ></MessageBox>
        </div>
      ) : (
        ""
      )}
    </>
  );
}

export default App;

License

MIT © covnpmjs