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

chahouat-table-component

v1.2.4

Published

this package was created for the Pass a jQuery library to React projct. In this component you will have a customizable array with your data, and 3 different color theme (possibility to add themes in higher versions).

Downloads

3

Readme

React Table Component

this package was created for the Pass a jQuery library to React projct. In this component you will have a customizable array with your data, and 3 different color theme (possibility to add themes in higher versions).

Author

Chahouat Taoufik

installation

npm i chahouat-table-component --save

usage


import React from "react";
import Table from 'chahouat-table-component';;

function myComponent() {
  
return (
    <div className='table-container'>
        <Table 
            arrayValuesTh={arrayValuesTh}
            updatePage={updatePagePagination} 
            dataEmployees={dataEmployees.users}
            dataEmployeeFiltered={dataEmployees.filteredusers} 
            pageIndex={dataEmployees.pageIndex}
            setDataEmployeesFiltered={dataFiltered}
            valueSelect1={5} 
            valueSelect2={10} 
            valueSelect3={15} 
            changePage={startGo} 
            pBack={'Go To Home'}
            cssThemes={'theme1'}
        />
    </div>
    );
}

export default myComponent;

explanation of all the properties of the component

  • arrayValuesTh this will be an array that contains the contents of our table, for example
const arrayValuesTh = ["First Name", 
                           "Last Name", 
                           "Start Date", 
                           "Departement", 
                           "Date of Birth", 
                           "Street", 
                           "City", 
                           "State", 
                           "Zip Code"]; 
  • updatePage will be a function that updates the page index so the page where we are because in this table we have a pagination system. ca will be for example a usestate that stores the page number, or as in this example we store the page number in the redux store
const updatePagePagination = (event, index) => {
		event.preventDefault()
		dispatch(setPageIndex(index))
	}
 
  • dataEmployees will be an array that contains the list of the data to be displayed in our table, of course each object must have the same key of our heads th, for exemple
const dataEmployees = {
    users : {
        firstname: "john",
        lastname: "Doe",
        StartDate: "27/01/2022",
        DateofBirth: "21/08/1998",
        Street: "Rue de Paris",
        City: "Paris",
        State: "France",
        ZipCode: "75000" 
    }
}
  • dataEmployeeFiltered here we will have the list of the filtered data in relation to the search input by key words

  • pageIndex here we retrieve from the state or redux or other, the page where we are at the pagination level of our table

  • setDataEmployeesFiltered here we fill in the table that contains the list of our data sorted according to the keyword search in the search input. In my case it is a function that stores the data in the redux store

const dataFiltered = (data) => {
    dispatch(setFilteredEmployees(data))
}
  • valueselect 1-2-3 here we choose how many lines of our data display in each page of our table

  • changePage this property is not required. We can use it just if we want to display for example our table after rendering another component false. here by exeple I display my table only when the state start is true, and then I hide the other component

const [ start, setStart ] = useState(false);
    function startGo() {
        setStart(!start);
    }
  • pback property to choose the keyword to use to go back so leave the table. this property is also not required and can be left empty

  • csstheme this property allows us to choose the css color theme of our table. we have for the moment 3 possible choices: theme1 , theme2 and theme3. In future versions of the packgage, other themes will be available.

theme1

theme2

theme3