0.0.1 • Published 3 years ago

memtive-list v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

memtive-list

Made with create-react-library

NPM JavaScript Style Guide

Example

Here's an example of the library

Install

npm install --save memtive-list

Usage

import React from 'react'

import {
  ListColor,
  ListContainer,
  ListElement,
  ListHeader,
  ListPill,
  ListPillContainer,
  ListSearch
} from 'memtive-list'

import 'memtive-list/dist/index.css'

import google from './assets/google.png';

class App extends React.Component {
  someClick() {
    alert("Clicked");
  }
  
  onChange(value) {
    console.log(value);
  }
  
  render() {
    return (
      <div className="App">
        <ListHeader
          text={"HISTORY"}
          filter={true}
          edit={true} />
        <ListContainer title={"SEARCH"}>
          <ListSearch onChange={this.onChange.bind(this)}/>
        </ListContainer>
        <ListPillContainer title={"SUBJECTS"}>
          <ListPill text={"Uncharacterized"}
                    onClick={this.someClick.bind(this)}/>
          <ListPill text={"Calculus"}
                    color={ListColor.BLUE}
                    onClick={this.someClick.bind(this)}/>
        </ListPillContainer>
        <ListContainer title={"TODAY"}>
          <ListElement
            favicon={google}
            title={"Roam Research"}
            subtitle={"Pricing Design Work & Creativity"}
            onClick={this.someClick.bind(this)}/>
          <ListElement
            favicon={google}
            title={"Roam Research"}
            subtitle={"Pricing Design Work & Creativity"}
            onClick={this.someClick.bind(this)}
            color={ListColor.BLUE}/>
        </ListContainer>
      </div>
    );
  }
}

export default App

Enums

ListColor

Here are the color types supported in the ListColor Enum

Values
BLUE
BROWN
CYAN
GREEN
INDIGO
MINT
ORANGE
PINK
PURPLE
RED
TEAL
YELLOW

Components

ListContainer

PropsRequiredTypeDefault ValueDescription
title:white_check_mark:String<none>The title of the list container

ListElement

PropsRequiredTypeDefault ValueDescription
faviconString<none>A source url for a favicon style image for the node
title:white_check_mark:String<none>The title of the list element
subtitleString<none>The subtitle of the list element
onClickFunction<none>The onClickHandler
colorListColor<none>The background color

ListHeader

PropsRequiredTypeDefault ValueDescription
editBooleanfalseEnable edit button
filterBooleanfalseEnable filter button
triggerEditFunction<none>The onClick handler for edit
triggerFilterFunction<none>The onClick handler for filter
text:white_check_mark:String<none>The text of the list header

ListPill

PropsRequiredTypeDefault ValueDescription
text:white_check_mark:String<none>The text of the list pill
colorListColor<none>The background color of the pill

ListPillContainer

PropsRequiredTypeDefault ValueDescription
title:white_check_mark:String<none>The title of the list container

ListSearch

PropsRequiredTypeDefault ValueDescription
onChangeFunction<none>The onChange handler for the text

License

MIT © abhishekpratapa