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

@tallis/react-mui-scroll-view

v0.0.7

Published

Scroll horizontally elements in a list in to view. Requires react, mui and mui icons.

Downloads

4

Readme

react-mui-scroll-pages

React Component is based on the Scroll View Horizontal idea of React Native, used in combination with Material UI

Notes

Only should be used in projects that have been built with React and Material-UI (MUI), if not, these installations are required.

Installing

Make sure you install React, MUI (material-ui) and MUI Icons (material-ui icons)

yarn add react-mui-scroll-pages

Example

import React, { useState, useEffect } from 'react';

import {
    Container, Grid,
    IconButton, Stack
} from '@mui/material';

import ArrowBackIcon from '@mui/icons-material/ArrowBack';
import ArrowForwardIcon from '@mui/icons-material/ArrowForward';

import ScrollPaper from 'react-mui-scroll-pages';

import EachChild = ({item, sizes}) => <div>Hello {sizes.width}x{sizes.height}</div>

const MyCarousel = () => {
    // other code ...
    const [items, setItems] = useState([...Array(10).keys()]);
    const [itemsSizes, setItemsSizes] = useState({ width: 0, height: 0 });

    const config = {
        mui: {
            Grid,             // required
            Container,        // required
            IconButton,       // required
            Stack,            // required
            ArrowBackIcon,    // required
            ArrowForwardIcon, // required
        },
        buttonStyle: {
            backgroundColor: 'grey',
        },
        getElementSizes: (data) => {
            if (JSON.stringify(sizes) !== JSON.stringify(data)) {
                setItemsSizes(data); // get Item Sizes if needed
            }
        },
        React,              // required
    }

    return <ScrollPaper {...config}>
        {items?.length > 0 && items.map((item, index) => (
              <EachChild
                  key={`render-item-list-${index}`}
                  item={item}
                  sizes={itemsSizes}
             />
       ))}
   </ScrollPaper>

}

Props & Function

| Name | Type | Required | Default | Note | | :-------------: | :---------------------: | :------: | :---------------------------: | :-------------------------------------------------------------------------------------------------: | | children | React Element | true | | Pass an array of elements | | debounceTime | Number | false | 250 | Delay time for the list to auto-scroll | | elementStyle | Object | false | | Style of Element container | | buttonStyle | Object | false | | Style of Scroll Back and Forward button | | buttonIconStyle | Object | false | | Style of Scroll Back and Forward icon button | | iconStyle | Object | false | | Style for SVG/Icon (MUI icons) | | gridItemSize | Object | false | {xs: 12, sm: 6, md: 4, xs: 3} | Number of cols each element takes on different screen sizes. Example: {xs: 12, sm: 6, md: 4, xs: 3} | | mui | Object of React Element | true | | You should pass the object such as from the example above for this prop | | getElementSizes | Function | false | | Used to get the sizes of Element if needed | | React | React | true | | Obligatory: React={React} | | showScrollbar | Boolean | | false | Show scrollbar or not, default to false |