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

@etu/lib

v1.3.7

Published

react base ui library by etu fte team

Downloads

22

Readme

ETU-LIB

Build Status

Dependencies

  • react
  • antd
  • styled-components
  • react-lazyload
  • prop-types
  • react-dnd

Include

  • dnd (dnd.Sortable, dnd.generateSortable, dnd.sort, dnd.wrap)
  • EllipsisText
  • FielIcon
  • FullScreenModal
  • MediaList
  • SlideShow
  • View

Usage

  • View

    Normal

    <View row flex={1} align='center' justify='center'
      width={200} height={100} background='#cccccc'
      radius={5}
      color='#ff0000'
      onClick={console.log}
    >
      hello
    </View>

    View.Center

    <View.Center height={100} radius={10} color='#ff00ff'>
      some text
    </View.Center>
  • FileIcon

      import { FileIcon } from '@etu/lib'
      <FileIcon type={'pdf'} size={64} onClick={console.log} style={{}} />

    types

    2019-01-17 15 03 04

  • MediaList

    • 普通视图

    2018-11-23 17 32 21

    • 全铺视图

    2018-11-23 17 31 46

    • 带文件名视图

    2018-11-23 17 30 27

    Usage

    import { MediaList, SlideShow } from '@etu/lib'
    import APIS from 'conf/apis'
    
    const getFile = id => APIS.getFile.id(id)
    const getDownload = id => APIS.getDownload.id(id)
    const getThumbnail = (id, width, height) => APIS.SIZE_THUMBNAIL.id(id).width(width).height(height)
    
    // 需重载这几个静态方法
    MediaList.bindGetFileFunctions({ getThumbnail, getFile, getDownload })
    SlideShow.bindGetFileFunctions({ getThumbnail, getFile, getDownload })
    
    const items = [
      {
        "type": "pdf",
        "media_id": "E77SKH7F7HXQ06YNZAF64GFC76Q9SEZA",
        "id": "E77SKH7F7HXQ06YNZAF64GFC76Q9SEZA",
        "name": "LastOfUs2.pdf"
      },
      {
        "data": "YM0JXBCAA84DJ7WEZ20TY5D4HZV3DHW3",
        "id": 381,
        "name": "【中文版】ETU PBL Backwards Design Template.docx",
        "type": "word"
      },
      {
        "media_id": "67BD020K2E6JMGX9R00NZ8DQ8KBSSWPG",
        "type": "picture",
        "name": "1530871462174.jpg",
        "extra": {
          "attrs": {
            "file_name": "1530871462174.jpg"
          }
        }
      }
    ]
    
    const App = connect(state => ({ slideshow: state.slideshow }))(({ slideshow }) => {
      return (
        <View height={400} align={'center'} justify={'center'}>
          <MediaList
            items={items}
            background={'transparent'}
            fixed noName
            onClick={(items, current) => console.log}
            hasDeleteButton={false}
            onDelete={id => console.log(id)}
            width={160}
            height={120}
            onSort={func}
            sortOptions={{
              type: 'SORT_ITEM',
              overStyle: {},
              draggingStyle: {},
              overClassName: '',
              draggingClassName: ''
            }}
          />
          <SlideShow
            canDownload
            sidebar={true}
            onClose={() => dispatch({ type: 'slideshow/HIDE' })}
            visible={slideshow.visible}
            medias={slideshow.items}
            current={slideshow.current}
          />
        </View>
      )
    })
    ReactDom.render(<App />, document.getElementById('root'))
  • SlideShow 2018-11-23 17 49 20

  • FullScreenModal 全屏 Modal

  • dnd 拖动排序

Usage

import { dnd } from '@etu/lib'

const Sortable = dnd.generateSortable('CARD')
// or const Sortable = dnd.Sortable // default type: 'SORT_ITEM'

@dnd.wrap
class List extends React.Component {
  state = {
    items: [1, 2, 3, 4]
  }

  handleSort = (currentIndex, hoverIndex, dropped, dragged) => {
    this.setState({
      items: dnd.sort(currentIndex, hoverIndex, this.state.items)
    })
  }

  handleDrop = (currentIndex, hoverIndex, dropped, dragged) => {
    // saveToServer(this.stat.items)
  }

  render() {
    return (
      <ul>
        {this.state.items.map((v, index) => (
          <Sortable component={'li'} index={index} onSort={this.handleSort} onDrop={this.handleDrop}>
            {v}
          </Sortable>
        ))}
      </ul>
    )
  }
}

ReactDom.mount(<List />, document.getElementById('root'))
  • EllipsisText
  <EllipsisText height={20}>{text}</EllipsisText>