From 335cf1752270cb6fcf1ef858a64828f189ba77d5 Mon Sep 17 00:00:00 2001 From: Denis Borovikov Date: Fri, 22 Jun 2018 20:43:22 +0800 Subject: [PATCH 1/3] Update Set documentation --- docs/components/Set.md | 52 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/docs/components/Set.md b/docs/components/Set.md index a6d8700a..f7954db6 100644 --- a/docs/components/Set.md +++ b/docs/components/Set.md @@ -1,5 +1,53 @@ # Set -// TODO: :disappointed_relieved: +The Set component is. -Send us a PR if you want to collaborate! :green_heart: +```js +import { Set } from 'react-powerplug' +``` + +```jsx + + {({ values, remove, add }) => ( + + + {values.map(tag => ( + remove(tag)}>{tag} + ))} + + )} + +``` + +## Set Props + +**initial = []** _(optional)_ +Specifies the initial values state, must be an array. Duplicate items will be removed. +By default, the initial values state is an empty array. + +**onChange** _(optional)_ +The onChange event of the Set is called whenever the values state changes. + +## Set Children Props + +TL;DR: `{ values, add, clear, remove, has }` + +**values** +`array` +Your values state, contains only unique items + +**add** +`(value: any) => void` +Add a unique `value` to your values array. Does nothing if values array already includes a `value`. + +**clear** +`() => any` +Reset values state to an empty array + +**remove** +`(value: any) => void` +Remove a `value` from your values array + +**has** +`(value: any) => boolean` +True if values array includes a `value` \ No newline at end of file From 91dfe588d8069dac69a32823ae36656fbf00d338 Mon Sep 17 00:00:00 2001 From: Denis Borovikov Date: Fri, 22 Jun 2018 20:45:44 +0800 Subject: [PATCH 2/3] Update --- docs/components/Set.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/components/Set.md b/docs/components/Set.md index f7954db6..0b3944f3 100644 --- a/docs/components/Set.md +++ b/docs/components/Set.md @@ -1,6 +1,6 @@ # Set -The Set component is. +The Set component. ```js import { Set } from 'react-powerplug' From 0cd21ef8ccd99faa66c046589741e879b4cd6770 Mon Sep 17 00:00:00 2001 From: Denis Borovikov Date: Fri, 22 Jun 2018 21:24:20 +0800 Subject: [PATCH 3/3] Update Set component description --- docs/components/Set.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/components/Set.md b/docs/components/Set.md index 0b3944f3..17b29f91 100644 --- a/docs/components/Set.md +++ b/docs/components/Set.md @@ -1,6 +1,6 @@ # Set -The Set component. +The Set component is used to work with an array of unique values. ```js import { Set } from 'react-powerplug'