2.1.2 • Published 2 years ago

pwnspinner v2.1.2

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

Pwnspinner - npm package

Simple loading spinner Pwnspinner for React.js/TypeScript installable via npm.
Version 2.1.0 is stable TypeScript parametrized version of spinner. Use ^2.1.0.

Available options

Use <Pwnspinner/> with some voluntary props color, thickness, speed.

    <>
      <Pwnspinner />
      <Pwnspinner color="red" />
      <Pwnspinner color="green" speed={1.9} />
      <Pwnspinner color="orange" thickness={10} />
      <Pwnspinner color="blue" speed={0.7} thickness={2} />
    </>

Code showing default spinner version, then some parametrized by props.

Usages

  • Waiting for fetched load to be displayed.
  • Waiting for POST/PUT request response message succ/err.

Usecase - waiting for API endpoint fetch

import React, { useEffect, useState } from 'react';
//Fetches
import FetchList from '../fetches/FetchList';
//Redux/RTK
import { setList } from '../redux-rtk/listSlice';
//Pwnspinner
import { Pwnspinner } from 'pwnspinner'; // <-- (!) import our Pwnspinner

function YourComponent() {
    const dispatch = useDispatch();
    const [spinner, setSpinner] = useState(true); // <-- (!) spinner visibility variable
    //Fetch downloaded list from Redux
    const list = useSelector(state=>state.list.list)
    useEffect(() => {
        const list = FetchList();
        Promise.resolve(list) // <-- (!) wait to fetch/resolve your stuff
            .then((result) => {
                dispatch(setList(result))
                setSpinner(false) // <-- (!) set Pwnspinner to not be visible anymore
            })
            .catch((e: any) => {
                console.log(e)
            })
    })
    return(
        <div>
            { spinner // <-- (!) spinner visibility variable
                ? <Pwnspinner/> // <-- (!) while 1 
                : <Displaylistcomp list={list} />  // <-- (!) after 0
            }
        <div/>
    )
}

Chainlog

  • 2.1.0 - release
  • 2.1.1 - console.log(params) - out
  • 2.1.2 - spinnerContainer set height:30px;

Future development

Hit us up about what functionality are you missing! https://github.com/KlosStepan/Pwnspinner

TODO list

  • Parametr boxing either small or medium (padding 0 vs normal).
2.1.2

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.9.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.13.0

2 years ago

0.12.0

2 years ago

0.11.0

2 years ago

0.10.0

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago