Giter Club home page Giter Club logo

fredkeemhaus-react-library's Introduction

TOC

  1. Installaction
  2. Functions

Installation

The package can be installed via npm:

npm i fredkeemhaus-react-library

Or via yarn:

yarn add fredkeemhaus-react-library

Functions

Calendar

It is based on react-date picker. Therefore, the usage is the same.

Usage

Single Calendar

import React from "react";
import { Calendar } from "fredkeemhaus-react-library";

function App() {
  const [startDate, setStartDate] = React.useState(() => new Date());

  const startRef = React.useRef(null);
  return (
    <div>
      <Calendar
        selected={startDate}
        startDate={startDate}
        setStartDate={setStartDate}
        ref={startRef}
        dateFormat={"yyyy-MM-dd"}
        minDate={new Date()}
      />
    </div>
  );
}

export default App;

Multiple Calendar

import React from "react";
import { Calendar } from "fredkeemhaus-react-library";

function App() {
  const [startDate, setStartDate] = React.useState(() => new Date());
  const [endDate, setEndDate] = React.useState(startDate);

  const startRef = React.useRef(null);
  const endRef = React.useRef(null);

  return (
    <div>
      <Calendar
        selected={startDate}
        startDate={startDate}
        setStartDate={setStartDate}
        ref={startRef}
        dateFormat={"yyyy-MM-dd"}
        minDate={new Date()}
      />
      <Calendar
        selected={endDate}
        startDate={startDate}
        endDate={endDate}
        setEndDate={setEndDate}
        ref={endRef}
        dateFormat={"yyyy-MM-dd"}
        minDate={startDate}
      />
    </div>
  );
}

export default App;

Download to CSV

It is based on ReactCSV. Therefore, the usage is the same.

Usage

import React from "react";
import { DownloadToCSV } from "fredkeemhaus-react-library";

function App() {
  const headers = [
    { label: "First Name", key: "firstname" },
    { label: "Last Name", key: "lastname" },
    { label: "Email", key: "email" },
  ];

  const data = [
    { firstname: "Ahmed", lastname: "Tomi", email: "[email protected]" },
    { firstname: "Raed", lastname: "Labes", email: "[email protected]" },
    { firstname: "Yezzi", lastname: "Min l3b", email: "[email protected]" },
  ];

  return (
    <DownloadToCSV
      buttonName={"Download me"}
      filename={"random.csv"}
      headers={headers}
      data={data}
    />
  );
}

export default App;

fredkeemhaus-react-library's People

Contributors

fredkeemhaus avatar

Watchers

James Cloos avatar  avatar

fredkeemhaus-react-library's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.