New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

react-tasks-calendar

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-tasks-calendar

A react tasks component

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

react-tasks-calendar ci npm version semantic-release Coverage Status

Calendar and tasks components for React

Getting started 🚀

If you are using yarn:

yarn add react-tasks-calendar styled-components

Or if you are using npm:

npm i react-tasks-calendar styled-components

Usage

Calendar component:

import Calendar from 'react-tasks-calendar';

function CalendarComponent() {
  function handleSelection(date) {
    alert(date);
  }

  return (
    <Calendar.Container onSelectionChanged={handleSelection}>
      <Calendar.Header text="Current period" />
      <Calendar.ColumnsContainer>
        <Calendar.Column weekDay="1" />
        <Calendar.Column weekDay="2" />
        <Calendar.Column weekDay="3" />
        <Calendar.Column weekDay="4" />
        <Calendar.Column weekDay="5" />
      </Calendar.ColumnsContainer>
      <Calendar.ItemsContainer
        startDate={new Date('2023-09-23')}
        endDate={new Date('2023-10-27')}
        fillEmptySlots={true}
      />
    </Calendar.Container>
  );
}

The code above will result in someting like:

image

Tasks list

import Task, { TasksContainer } from 'react-tasks-calendar';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {
  faCircleInfo,
  faSquareArrowUpRight,
  faPenSquare
} from '@fortawesome/free-solid-svg-icons';

function TasksList() {
  return (
    <TasksContainer>
      <Task.Container
        icon={() => (
          <FontAwesomeIcon
            icon={faCircleInfo}
            color="#ffffff"
            style={{ fontSize: '2.5rem' }}
          />
        )}
      >
        <Task.Content>
          <Task.Title>Task header</Task.Title>
          <Task.Message>Task content</Task.Message>
        </Task.Content>
        <Task.Actions>
          <Task.Action
            icon={() => (
              <FontAwesomeIcon
                icon={faPenSquare}
                color="#ffffff"
                style={{ fontSize: '2rem' }}
              />
            )}
            title="edit"
            onClick={() => alert('edit task')}
          />
          <Task.Action
            icon={() => (
              <FontAwesomeIcon
                icon={faSquareArrowUpRight}
                color="#ffffff"
                style={{ fontSize: '2rem' }}
              />
            )}
            title="Open"
            onClick={() => alert('open task')}
          />
        </Task.Actions>
      </Task.Container>
      <Task.Container>
        <Task.Content>
          <Task.Title>Task header</Task.Title>
          <Task.Message>Task content</Task.Message>
        </Task.Content>
        <Task.Actions>
          <Task.Action
            icon={() => (
              <FontAwesomeIcon
                icon={faSquareArrowUpRight}
                color="#ffffff"
                style={{ fontSize: '2rem' }}
              />
            )}
            title="Open"
            onClick={() => alert('open task')}
          />
        </Task.Actions>
      </Task.Container>
    </TasksContainer>
  );
}

The code above will result in someting like:

image

Calendar API

Calendar.Container

ParameterTypeDescription
childrenReactNodeA node of components to be rendered inside the calendar
initialSelectedDate (optional)DateThe initial date to be selected on the calendar
onSelectionChanged (optional)(selectedDate: Date | null) => voidA callback to be called every time the selected date changes

Calendar.Header

ParameterTypeDescription
textstringA string to be rendered on the header

Calendar.ColumnsContainer

ParameterTypeDescription
childrenReactNodeA ReactNode composed of Calendar.Column

Calendar.Column

ParameterTypeDescription
weekDayCalendarLabelsIndexThe index of the week day the column corresponds
renderText (optional)(weekDay: CalendarLabelsIndex) => string | ReactElementA function that renders the label of a column
type CalendarLabelsIndex = '0' | '1' | '2' | '3' | '4' | '5' | '6';

Calendar.ItemsContainer

ParameterTypeDescription
startDateDateThe start of the range of dates to be displayed
endDateDateThe end of the range of dates to be displayed
fillEmptySlots (optional)booleanDefines if the calendar will render dates outside of the defined
renderItem (optional)(itemData: CalendarItemProps, key: number | string) => ReactElementA function responsible for rendering the items within the calendar

Calendar.Item

ParameterTypeDescription
itemDateDateThe date of the item
disabledbooleanDefines if the user can interact with the item
status'normal' | 'pending' | 'alert' | 'done' | 'hidden'The status of the item. This change the style according the status
renderText(date: Date) => string | ReactElementA function responsible for rendering the item text

Tasks API

TasksContainer

ParameterTypeDescription
childrenReactNodeThe tasks to be rendered on the list

Task.Container

ParameterTypeDescription
childrenReactNodeA node of components to be rendered inside the task component
icon (optional)ElementTypeA icon element to be rendered on the left corner of the task

Task.Content

ParameterTypeDescription
childrenReactNodeA node of components to be rendered as the task content

Task.Title

ParameterTypeDescription
childrenReactNodeThe content to be rendered inside the title of the task

Task.Message

ParameterTypeDescription
childrenReactNodeThe content to be rendered inside the message of the task

Task.Actions

ParameterTypeDescription
childrenReactNodeThe actions of the task

Task.Action

This component also inherits from ButtonHTMLAttributes<HTMLButtonElement>

ParameterTypeDescription
iconElementTypeA icon to bee rendered inside the action button

FAQs

Package last updated on 11 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts