Skip to content

Commit

Permalink
added readme.md for phonebook
Browse files Browse the repository at this point in the history
  • Loading branch information
opensrc0 committed Mar 26, 2024
1 parent 2d753c7 commit 7046fb1
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 6 deletions.
12 changes: 6 additions & 6 deletions __app/component/CopyToClipboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<div>
`}
>
Click Me to Copy
Pass Copy Icon here
</CopyToClipboard>
```

Expand All @@ -49,9 +49,9 @@ const successCb = ({ msgType, msg, data }) => {

```js
<CopyToClipboard
elementToBeCopy={`Fe-pilot library offers component like scanner, voice search, autofill otp, phonebook, share`}
successCb={successCb}
successMsg="Copied Successfully"
elementToBeCopy={`Fe-pilot library offers component like scanner, voice search, autofill otp, phonebook, share`}
/>
```
> [!Note]
Expand All @@ -71,12 +71,12 @@ const failureCb = ({ msgType, msg }) => {
```
```js
<CopyToClipboard
elementToBeCopy={`Fe-pilot library offers component like scanner, voice search, autofill otp, phonebook, share`}
failureCb={failureCb}
failureMsg={{
unSupported: 'Your device is not supporting Copy feature',
error: 'Unable to copy the text',
}}
elementToBeCopy={`Fe-pilot library offers component like scanner, voice search, autofill otp, phonebook, share`}
/>
```
> [!Note]
Expand All @@ -88,13 +88,13 @@ Failure can happend due to multiple reasons, due to that reason ```failureMsg```
## 4. Failure: Device don't support the feature and you want to hide the feauture from User
```js
<CopyToClipboard
elementToBeCopy={`Fe-pilot library offers component like scanner, voice search, autofill otp, phonebook, share`}
failureCb={failureCb}
failureMsg={{
unSupported: 'Your device is not supporting Copy feature',
error: 'Unable to copy the text',
}}
showForever={false}
elementToBeCopy={`Fe-pilot library offers component like scanner, voice search, autofill otp, phonebook, share`}
/>
```
> [!Note]
Expand All @@ -103,7 +103,6 @@ Failure can happend due to multiple reasons, due to that reason ```failureMsg```
## 5. Combine with all props
```js
<CopyToClipboard
elementToBeCopy={`Fe-pilot library offers component like scanner, voice search, autofill otp, phonebook, share`}
successCb={successCb}
successMsg="Copied Successfully"
failureCb={failureCb}
Expand All @@ -112,7 +111,8 @@ Failure can happend due to multiple reasons, due to that reason ```failureMsg```
error: 'Unable to copy the text',
}}
showForever={false}
elementToBeCopy={`Fe-pilot library offers component like scanner, voice search, autofill otp, phonebook, share`}
>
Pass Copy Icon to Copy Element/String
Pass Copy Icon here
</CopyToClipboard>
```
128 changes: 128 additions & 0 deletions __app/component/PhoneBook/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,133 @@
## 1. Happy Flow

#### a) Including PhoneBook Component
```js
<PhoneBook />
```

#### b) Passing contactProperty pros to the PhoneBook Component
```js
<PhoneBook
contactProperty={['name', 'email', 'tel', 'address', 'icon']},
/>
```
> [!Note]
> Prop contactProperty will be an array and it can contains 5 value. These 5 value are optional, you can pass either the single/two/three/four/five values.
#### c) Passing isSelectMultiple pros to the PhoneBook Component
```js
<PhoneBook
isSelectMultiple={true}
/>
```
> [!Note]
> You can select multiple phone numbers from phonebook directory.

#### d) Passing child

```js
<PhoneBook>
Pass PhoneBook Icon here
</PhoneBook>
```

## 2. Success: successCb callBack Fn along with success msg

```js
const successCb = ({ msgType, msg, data }) => {
console.log(msgType); // Success
console.log(msg); // Copied Successfully
console.log(data); // data will be an array of object
}
```
> [!Tip]
> <details>
> <summary>date</summary>
>
> ###
> [
> {
> 'name': 'fe-pilot',
> 'email': 'opensrc0',
> 'tel': "7204535372",
> 'address': "Dubai"
> }
> ]
```js
<PhoneBook
successCb={successCb}
successMsg="Details selected Successfully"
/>
```
> [!Note]
> Define **successCb** fn and your will get an object in param contains the property ```msgType```, ```msg```, ```data```
## 3. Failure: failureCb callBack Fn along with failure msg
```js
const failureCb = ({ msgType, msg }) => {
console.log(msgType); // UN_SUPPORTED_FEATURE
console.log(msg); // PhoneBook is not supporting in your device

OR

console.log(msgType); // CANCELLED
console.log(msg); // Feature Cancelled

OR

console.log(msgType); // ERROR
console.log(msg); // Unable to fetch details from PhoneBook
}
```
```js
<PhoneBook
failureCb={failureCb}
failureMsg={{
unSupported: 'PhoneBook is not supporting in your device',
cancelled: 'Feature Cancelled',
error: 'Unable to fetch details from PhoneBook',
}}
/>
```
> [!Note]
> Define **failureCb** fn and you will get an object in param contains the property ```msgType```, ```msg```
> [!Important]
Failure can happend due to multiple reasons, due to that reason ```failureMsg``` is an object having different kind of error property according to the error can occur in component

## 4. Failure: Device don't support the feature and you want to hide the feauture from User
```js
<PhoneBook
failureCb={failureCb}
failureMsg={{
unSupported: 'PhoneBook is not supporting in your device',
cancelled: 'Feature Cancelled',
error: 'Unable to fetch details from PhoneBook',
}}
showForever={false}
/>
```
> [!Note]
> ```showForever``` props will false, feature will be hidden in case of unSupported by the device

## 5. Combine with all props
```js
<PhoneBook
successCb={successCb}
successMsg="Details selected Successfully"
failureCb={failureCb}
failureMsg={{
unSupported: 'PhoneBook is not supporting in your device',
cancelled: 'Feature Cancelled',
error: 'Unable to fetch details from PhoneBook',
}}
showForever={false}
contactProperty={['name', 'email', 'tel', 'address', 'icon']},
isSelectMultiple={true},
>
Pass PhoneBook Icon here
</PhoneBook>
```

0 comments on commit 7046fb1

Please sign in to comment.