Socket
Socket
Sign inDemoInstall

@marinos33/react-week-time-range-picker

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @marinos33/react-week-time-range-picker

A React component for selecting a range of hours per day of the week


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
131 kB
Created
Weekly downloads
 

Readme

Source

react-week-time-range-picker

NPM Status

Introduction

It's a simple React component for selecting a range of hours per day of the week.

image

This component is a fork from https://github.com/lizhongzhen11/react-week-time-range-picker with various change such as:

  • Reworked completely in english rather than in chinese
  • Add customizable styles
  • Better architecture and code improvement
  • Added minimal storybook
  • Props name slightly changed to be more obvious
  • Switch from Webpack to Rollup
  • Some bug fixes

Get Started

To start using it do
npm install @marinos33/react-week-time-range-picker --save

And then you can import it like this:

import ReactWeekTimeRangePicker from '@marinos33/react-week-time-range-picker'

<ReactWeekTimeRangePicker />

Props

The available props for this components are the following.

PropDescriptionTypeDefault
hasHalfHourWheter to display the hour and is following half hourbooleanfalse
selectedDataThe data displayed in the componentSelectedDataProps[ ]
(more information below)
[ ]
outerCellColorThe color of the outer cellsstring#DDDEE1
innerCellColorThe color of the inner cell when inactivestring#f5f5f5
fontColorThe color of the textstring#000000
summaryColorThe background color of the summary at the bottom of the componentstring#ffffff
FunctionDescriptionReturn Type
selectTimeRangeFunction to get the selectedData and do whetever you want with.void

Example:

import ReactWeekTimeRangePicker from '@marinos33/react-week-time-range-picker'

const handleSelectTimeRange = (selectedData: SelectedDataProps[]) => {
    console.log(selectedData)
}
  
<ReactWeekTimeRangePicker hasHalfHour={true} selectTimeRange={handleSelectTimeRange} />

The structure of SelectedDataProps:

 {
    iden?: string; // the id of the day. eg: monday = 1, tuesday = 2, ... sunday = 7
    timeRanges?: string[][]; // the time from the selected box to the end box. eg: [['02:30', '03:00']]
    times?: string[]; //the time original clicked on. eg: ['02:30']
    dayName?: string; //the name of the day. eg: monday, tuesday, etc
 }

Known issues

  • The drag box is inaccurate following the mouse movement

Keywords

FAQs

Last updated on 24 Mar 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc