0.1.33 • Published 5 years ago

@nappr/nappr-todolist v0.1.33

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

🍰 NAPPR TodoList

NPM version Build

Full Documentation

Install

yarn add @nappr/nappr-todolist

Required Dependencies

Usage

import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { v1 as uuidv1 } from 'uuid';
import NapprTodoList from '@nappr/nappr-todolist';

const ikea = require('ikea-name-generator');

function App({ items }) {
  const [tasks, updateTasks] = useState(items);
  return (
    <div className="app">
      <div style={{ height: 200 }}>
        <NapprTodoList
          onChange={(clickedTaskId, clickedtaskCheckValue) => {
            const next = tasks.map(obj => {
              if (obj.id !== clickedTaskId) return obj;
              return { ...obj, checked: clickedtaskCheckValue };
            });
            updateTasks(next);
          }}
          tasks={tasks}
        />
      </div>
    </div>
  );
}

App.defaultProps = {
  items: [...Array(10).keys()].map(() => ({
    checked: false,
    id: uuidv1(),
    label: ikea.getName(),
  })),
};

App.propTypes = {
  items: PropTypes.arrayOf(PropTypes.shape()),
};

export default App;
0.1.33

5 years ago

0.1.32

5 years ago

0.1.31

5 years ago

0.1.29

5 years ago

0.1.27

5 years ago

0.1.28

5 years ago

0.1.26

5 years ago

0.1.25

5 years ago

0.1.20

5 years ago

0.1.21

5 years ago

0.1.22

5 years ago

0.1.23

5 years ago

0.1.24

5 years ago

0.1.18

5 years ago

0.1.19

5 years ago

0.1.17

5 years ago

0.1.15

5 years ago