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

zp-ui-effect

v1.0.10

Published

ZaloPay effective UI for React apps development includes modals, toast,...)

Downloads

13

Readme

ZP-UI Effect

Build Status

ZaloPay UI Effect is a common's Reat components library to serve some features like: Loading, show Toast, etc,....

Repositories:

Private repository is located at the Webapps project

Tech

ZP Ui Effect uses a number of open source projects to work properly:

  • Webpack - use to run a development server as a local styleguild
  • Styleguidist - Isolated React component development environment with a living style guide
  • React - Main library technology
  • Sass/Css - Stylesheet language
  • PostCss - a tool for transforming css with javascript
  • Rollup - a module bundler to build library's distrubuted files
  • Babel - Javascript converter for running script on old browsers ....

Installation

Install the dependencies and devDependencies and start the server.

$ npm install --save zp-ui-effect

or

$ yarn add zp-ui-effect

Components

1. ZPLoading:

A Loading component with ZaloPay Logo inside | Props | Type | Description | InitialValue| | ------ | ------ | ------ | ------ | | className | string | React className for container div | '' | | onClick | function | function that will be triggered on click loading component | ()=>{} |

Example: You will want to change your isLoading variable to show or hide ZPLoading component.

import {ZPLoading} from 'zp-ui-effect';
...
{isLoading &&  (<ZPLoading />)}

2. MessageToast:

A Message Toast with Check icon uppon by default | Props | Type | Description | InitialValue| | ------ | ------ | ------ | ------ | | toggle | bool | a trigger variable to show toast, when it true, set it false and reverse | false | | message | string | content of displayed message on toast | '' | | icon | any | Upper icon of toast, by default it is a Check icon | <span className="check-icon"/> | | duration | number | duration while a toast show (miliseconds) | 2000 | | onShow | function | a callback function when a toast show | ()=>{} | | onHide | function | a callback function when a toast hide | ()=>{} | | onVisibleChange | function | a callback function when a toast hide or show | ()=>{} |

Example: Call showToast function to trigger show the MessageToast

import {MessageToast} from 'zp-ui-effect';
...
const [toggle, setToggle]=useState(false);

function showToast() {
    setToggle(prev=> !prev);
}
...
<MessageToast message="Le Hoang Nam" toggle={toggle}/>

3. Spinner:

Three bouncing dots | Props | Type | Description | InitialValue| | ------ | ------ | ------ | ------ | |className| string | style for container of three animating dots | '' | Example: Call showToast function to trigger show the MessageToast

import {Spinner} from 'zp-ui-effect'; 
<Spinner/>

2. BottomModal:

A Modal that have animation sliding up from bottom | Props | Type | Description | InitialValue| | ------ | ------ | ------ | ------ | | children | any | content of the modals |null | | className | string | className of Content 's container | '' | | isOpen | bool | a variable rules modal'state is open or not | false | | duration | number | duration while a toast show (miliseconds) | 2000 | | onOpen | function | a callback function when a modal open | ()=>{} | | onClose | function | a callback function when a modal 's backdrop | ()=>{} | | ...otherProps | props |other props that pass again to content's container| ()=>{} |

Example: Call showToast function to trigger show the MessageToast

import {BottomModal} from 'zp-ui-effect';
...
const [open,setOpen]=useState(false);
 
<button onClick={()=> setState({isOpen:true})}>Click here to open Modal</button>
<BottomModal  isOpen={state.isOpen}
              onClose={()=>setOpen(false)}
              style={{backgroundColor:'yellow'}}>
        <button onClick={()=> setOpen(false)}>Close Modal</button>
        <p>This is a bottom modal</p> 
</BottomModal>

Usage with Redux and other middlewares

Add to reducer

import {ZPEffectReducer} from 'zp-ui-effect'

combineReducers({
     ...other reducer,
     uiEffectReducer: ZPEffectReducer, 
   });

** Add Components to Views **

import {ZPLoading, MessageToast, BottomModal,openModal} from 'zp-ui-effect'
const { isLoading, toast, isOpenModal } = useSelector(state => state.uiEffectReducer);
 
<BottomModal isOpen={isOpenModal} handlClose={()=>dispatch(openModal())}>
    <SomeContent/>
</BottomModal>
<MessageToast {...toast} /> 
{isLoading && <ZPLoading />}

*** Usage ***

import {showLoading, hideLoading, triggerToastWithMessage} from "zp-ui-effect"; 
...
dispatch(showLoading()); 
dispatch(hideLoading());
dispatch(triggerToastWithMessage("Toast here"));

Usage with Saga

yield put(showLoading())
yield put(triggerToastWithMessage("Toast from Saga"))

Development

  • Config build script at rollup.config.js
  • Config styleguide server as styleguide.config.js
  • Build files located at ./build To show styleguide, run:
$ yarn start

To build files, run:

$ yarn prePublishOnly

To publish project, run:

$ yarn publish

Todos

  • Create more components

License

MIT

Free Software, Hell Yeah!