diff --git a/.gitignore b/.gitignore index f885dc0..d3eb785 100644 --- a/.gitignore +++ b/.gitignore @@ -18,5 +18,4 @@ yarn-debug.log* yarn-error.log* .idea/ -/build/ /build-demo/ diff --git a/README.md b/README.md index 43010b0..096c157 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,15 @@ -# React RRule Generator +# React RRule Generator - VoiceFriend fork + +The following is a fork of `react-rrule-generator`, by VoiceFriend. Modified a bit for our use cases. + +Note running the project: you need Node v6+. It does not work on Node v14. + +Also be careful when using `npm link`, it might not correctly resolve this component dependency. You will have to `npm install react-datetime` on the repository where you want to include this component. This might be a problem with Node. + +The following is the content of the original README.md. + +## React RRule Generator + > Recurrence rules generator form built with React [![LICENSE](https://img.shields.io/npm/l/express.svg)](LICENSE) @@ -6,7 +17,6 @@ ### This project is no longer maintained by me. Thank you for all your past contributions. Let the forks rock it for you. - ![Screenshot](https://i.imgur.com/FU3aGlz.png) ## Description @@ -14,26 +24,29 @@ This is [ReactJS](http://facebook.github.io/react/index.html) project based on [Create React Library](https://github.com/UdiliaInc/create-react-library) and using [Bootstrap](https://github.com/twbs/bootstrap) styling. It's built with the help of a great [rrule.js](https://github.com/jakubroztocil/rrule) library. It also uses: -* [lodash](https://github.com/lodash/lodash) -* [moment](https://github.com/moment/moment) -* [react-datetime](https://github.com/YouCanBookMe/react-datetime) + +- [lodash](https://github.com/lodash/lodash) +- [moment](https://github.com/moment/moment) +- [react-datetime](https://github.com/YouCanBookMe/react-datetime) ## Demo + https://fafruch.github.io/react-rrule-generator ## Installation `npm install --save react-rrule-generator` -## Usage +## Usage In your CSS index file don't forget to import styles: + ```css -@import '~bootstrap/dist/css/bootstrap.css'; // this lib uses boostrap (v. 4.0.0-beta.2) +@import '~bootstrap/dist/css/bootstrap.css'; // this lib uses boostrap (v. 4.0.0-beta.2) @import '~react-rrule-generator/build/styles.css'; // react-rrule-generator's custom CSS ``` -Then you're good to go. +Then you're good to go. Just use it: ```js @@ -42,10 +55,11 @@ import RRuleGenerator from 'react-rrule-generator'; // render it as it is const SimpleRender = () => ( - console.log(`RRule changed, now it's ${rrule}`)} /> + console.log(`RRule changed, now it's ${rrule}`)} + /> ); - // or with your own forms configuration import MyCustomCalendar from './MyCustomCalendar'; @@ -65,12 +79,11 @@ const CustomizedRender = () => ( /> ); - // you can also use it as controlled input component and feed it with your own RRule! class ControlledRender extends Component { state = { - rrule: 'SOME REALLY COOL RRULE' + rrule: 'SOME REALLY COOL RRULE', }; render() { @@ -88,28 +101,31 @@ class ControlledRender extends Component { ### Props -| Name | Type | Description | -| ------------ | ------- | ----------- | -| **onChange** | `function` | REQUIRED. Callback trigger when the RRule changes. The callback receives newly generated RRule `string`. -| **value** | `string` | You can pass your own RRule value to RRuleGenerator and use it like controlled input component. -| **config** | `object` | Accepts object of what options will be rendered. This object's structure is described in [#config](#config) | -| **translations** | `function` or `object` | Accepts a function or an object with translations for all labels in the component. By default all labels are in English. You can pass your own translation object or function, which has the following signature: `(key: string, replacements: object) => string`. It receives key of the label in form of `'repeat.yearly.on_the'` and an object for placeholder replacements, e.g., `{ value: error.value }`. Example translation objects are placed in `/src/lib/translations/`. | -| **customCalendar** | `React Component` or `stateless function` | This accepts custom calendar / datepicker for choosing a date in EndOnDate view. It receives following props by default: