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

fucking-react-table

v0.1.1

Published

[![npm version](https://badge.fury.io/js/fucking-react-table.svg)](https://badge.fury.io/js/fucking-react-table)

Downloads

3

Readme

npm version

Fucking React Table

A react table component with fucking difficult features, including

  • Virtualized rows with fucking native table elements
  • Sticky header
  • Freeze column
  • ~~Placeholder~~(WIP)
  • ~~Sticky horizontal scrollbar~~(WIP)
  • ~~Resizable column~~(WIP)

for both fit-content height table and fixed height table.

Playground

Storybook

Why

  • Why using native table element?

    Because it is fucking semantic and elegant.

  • Why reinventing the wheel?

    Considering sticky headers or freeze columns, I think reinventing is fucking more efficient than reusing.

  • Why the project is named fucking-react-table?

    I originally named it react-virtual-table, but this name was fucking registered. The package even seems like a fucking useless hello world project. So I just give a fucking name.

Installation

npm install --save fucking-react-table

Quick Start

import FuckTable from 'fucking-react-table'

const data = [
  { id: 'a', value: 'Apple' },
  { id: 'b', value: 'Banana' },
]
const Tr = FuckTable.Tr
const Th = FuckTable.Th
const Td = FuckTable.Td

return (
  <FuckTable
    data={data}
    headerRowHeight={60}
    rowHeight={80}
    renderHeader={() => (
      <Tr>
        <Th cellWidth={100}>ID</Th>
        <Th cellWidth={150}>Fruit</Th>
      </Tr>
    )}
    renderRow={row => (
      <Tr key={row.id}>
        <Td cellWidth={100}>{row.id}</Td>
        <Td cellWidth={150}>{row.value}</Td>
      </Tr>
    )}
  />
)

Custom Styling


import FuckTable from 'fucking-react-table'
import styled from 'styled-components'

const Table = styled(FuckTable)`
  background-color: #26282b;
`

const Tr = styled(FuckTable.Tr)`
  background-color: rgb(53, 55, 58);
`

const Th = styled(FuckTable.Th)`
  background-color: rgb(62, 63, 66);
  color: rgb(156, 157, 158);
`

const Td = styled(FuckTable.Td)`
  background-color: rgb(53, 55, 58);
  color: #ffffff;
`

Props

FuckTable

| prop name | type | required | default | description | | --------- | ---- | -------- | ------- | ----------- | | data | array | yes | - | Data source of table rows. Each row will be passed as argument into renderRow. | | headerRowHeight | number | yes | - | Fixed row height of table header. Table header is not virtualized and is always rendered. | | rowHeight | number | yes | - | Fixed row height of table row. | | columnCount | number | conditional | undefined | If your column count will change during runtime, you must pass current column count. This prop is only for detecting width changing and won't affect any other table behaviors. | | maxHeight | number | optional | -1 | Set a fixed max height value (in pixel). If maxHeight is negative (default to -1), the table will fit its height to contents. | | throttleWait | number | optional | 16 | Throttle wait interval in milliseconds for restoring virtualized table rows. Default to 16ms, which is about 60fps (1000ms / 60). | preRenderRowCount | number | optional | 0 | Set how many margin rows should be pre-render before they are displayed in viewport. | | globalStickyHeader | bool | optional | false | Toggle sticky header when global page scrolls | | localStickyHeader | bool | conditional | false | Required when rowHeight is set. Toggle sticky header when table container scrolls. | | enableStickyHeaderShadow | bool | optional | true | Toggle scroll shadow of sticky header. | | enableFreezeColumnShadow | bool | optional | true | Toggle scroll shadow of frozen column. | | freezeColumnShadowLeftOffset | number | conditional | null | Required when enableFreezeColumnShadow is true. This prop decides the x-axis position of shadow. | | renderHeader | func | optional | () => {} | A render function for table head section. | | renderRow | func | optional | () => {} | A render function for table body section. |

FuckTable.Tr

No props.

FuckTable.Th

| prop name | type | required | default | description | | --------- | ---- | -------- | ------- | ----------- | | cellWidth | number | yes | - | Fixed value in px to decide the width of current FuckTable.Th | | freezeLeftOffset | number | undefined | conditional | undefined | If you want to freeze columns, this prop sets the freeze left offset in px. You should set the same offset to FuckTable.Td for the same column. |

FuckTable.Td

| prop name | type | required | default | description | | --------- | ---- | -------- | ------- | ----------- | | cellWidth | number | yes | - | Fixed value in px to decide the width of current FuckTable.Td | | freezeLeftOffset | number | undefined | conditional | undefined | If you want to freeze columns, this prop sets the freeze left offset in px. You should set the same offset to FuckTable.Th for the same column. |

Development

npm start

Storybook

Launch local storybook

yarn storybook

Deploy to gh-pages

yarn deploy-storybook

Changelog

0.1.1

Reduce bundle size by removing unnecessary dependencies

0.1.0

Initial release with following features:

  • virtualized rows
  • sticky header
  • freeze column