Skip to content

Commit 1c13a4f

Browse files
authored
Merge pull request #162 from uidotdev/lf/reference-tables
Mobile reference tables
2 parents 61874a9 + ab43afe commit 1c13a4f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+255
-83
lines changed

usehooks.com/src/content/hooks/useBattery.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ import StaticCodeContainer from "../../components/StaticCodeContainer.astro";
2525

2626
<div class="reference">
2727
### Return Values
28-
2928
The hook returns an object containing the following properties:
3029

30+
<div class="table-container">
3131
| Name | Type | Description |
3232
| ---------------- | ------- | ----------- |
3333
| supported | boolean | Indicates whether the Battery Status API is supported in the user's browser. |
@@ -36,6 +36,7 @@ import StaticCodeContainer from "../../components/StaticCodeContainer.astro";
3636
| charging | boolean | Represents whether the system's battery is charging. `true` means the battery is charging, `false` means it's not. |
3737
| chargingTime | number | Represents the time remaining in seconds until the system's battery is fully charged. |
3838
| dischargingTime | number | Represents the time remaining in seconds until the system's battery is completely discharged and the system is about to be suspended. |
39+
</div>
3940
</div>
4041

4142

usehooks.com/src/content/hooks/useClickAway.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,19 @@ import StaticCodeContainer from "../../components/StaticCodeContainer.astro";
2727
<div class="reference">
2828
### Parameters
2929

30+
<div class="table-container">
3031
| Name | Type | Description |
3132
| ---- | -------- | ----------- |
3233
| callback | function | The callback function that is provided as an argument to `useClickAway`. This function is invoked whenever a click event is detected outside of the referenced element. The event object from the click is passed to this callback function. |
34+
</div>
3335

3436
### Return Values
3537

38+
<div class="table-container">
3639
| Name | Type | Description |
3740
| ---- | ------------ | ----------- |
38-
| ref | React Ref | This is a ref object returned by the hook. It should be attached to a React element to monitor click events. The ref provides a way to access the properties of the element it is attached to. |
41+
| ref | React ref | This is a ref object returned by the hook. It should be attached to a React element to monitor click events. The ref provides a way to access the properties of the element it is attached to. |
42+
</div>
3943
</div>
4044

4145

usehooks.com/src/content/hooks/useContinuousRetry.mdx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,20 @@ import StaticCodeContainer from "../../components/StaticCodeContainer.astro";
2626
<div class="reference">
2727
### Parameters
2828

29+
<div class="table-container">
2930
| Name | Type | Description |
3031
| -------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
31-
| callback | Function | The callback function to be executed repeatedly until it returns a truthy value. |
32-
| interval | Number | (Optional) The interval in milliseconds at which the callback function is executed. Default value is 100 milliseconds. |
32+
| callback | function | The callback function to be executed repeatedly until it returns a truthy value. |
33+
| interval | number | (Optional) The interval in milliseconds at which the callback function is executed. Default value is 100 milliseconds. |
34+
</div>
3335

3436
### Return Value
3537

38+
<div class="table-container">
3639
| Type | Description |
3740
| ------- | ------------------------------------------------------------------------------------------ |
38-
| Boolean | `true` if the callback function has resolved (returned a truthy value), `false` otherwise. |
41+
| boolean | `true` if the callback function has resolved (returned a truthy value), `false` otherwise. |
42+
</div>
3943
</div>
4044

4145
<CodePreview

usehooks.com/src/content/hooks/useCopyToClipboard.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,22 @@ import StaticCodeContainer from "../../components/StaticCodeContainer.astro";
2525
<div class="reference">
2626
### Parameters
2727

28+
<div class="table-container">
2829
| Name | Type | Description |
2930
| ----- | ------ | ---------------------------------------- |
3031
| value | string | The value to be copied to the clipboard. |
32+
</div>
3133

3234
### Return Value
3335

3436
The `useCopyToClipboard` hook returns an array with the following elements:
3537

38+
<div class="table-container">
3639
| Index | Type | Description |
3740
| ----- | -------- | ------------------------------------------------------ |
3841
| 0 | string | The value that was last copied to the clipboard. |
3942
| 1 | function | A function to copy a specified value to the clipboard. |
43+
</div>
4044
</div>
4145

4246
<CodePreview

usehooks.com/src/content/hooks/useCountdown.mdx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,20 @@ import StaticCodeContainer from "../../components/StaticCodeContainer.astro";
2525
<div class="reference">
2626
### Parameters
2727

28+
<div class="table-container">
2829
| Name | Type | Description |
2930
| ------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
30-
| endTime | Number | The end time of the countdown in milliseconds since the Unix epoch. |
31-
| options | Object | An object containing the following options:<ul><li>`interval`: The interval in milliseconds at which the countdown should tick.</li><li>`onComplete`: A callback function to be called when the countdown reaches zero.</li><li>`onTick`: A callback function to be called on each tick of the countdown.</li></ul> |
31+
| endTime | number | The end time of the countdown in milliseconds since the Unix epoch. |
32+
| options | object | An object containing the following options:<ul><li>`interval`: The interval in milliseconds at which the countdown should tick.</li><li>`onComplete`: A callback function to be called when the countdown reaches zero.</li><li>`onTick`: A callback function to be called on each tick of the countdown.</li></ul> |
33+
</div>
3234

3335
### Return Value
3436

37+
<div class="table-container">
3538
| Name | Type | Description |
3639
| ----- | ------ | ----------------------------------- |
37-
| count | Number | The current count of the countdown. |
40+
| count | number | The current count of the countdown. |
41+
</div>
3842
</div>
3943

4044
<CodePreview

usehooks.com/src/content/hooks/useCounter.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,28 @@ import StaticCodeContainer from "../../components/StaticCodeContainer.astro";
2626
<div class="reference">
2727
### Parameters
2828

29+
<div class="table-container">
2930
| Name | Type | Description |
3031
| ------------- | ------ | -------------------------------------------------- |
3132
| startingValue | number | The initial value for the counter. Default is `0`. |
3233
| options | object | Additional options for the counter. |
3334
| options.min | number | The minimum value allowed for the counter. |
3435
| options.max | number | The maximum value allowed for the counter. |
36+
</div>
3537

3638
### Return Value
3739

3840
The `useCounter` hook returns an array with two elements:
3941

42+
<div class="table-container">
4043
| Name | Parameters | Description |
4144
| --------------- | ----------------- | ---------------------------------------------------- |
4245
| `[0]` | | The current value of the counter. |
4346
| `[1].increment` | | Increments the counter by 1. |
4447
| `[1].decrement` | | Decrements the counter by 1. |
4548
| `[1].set` | nextCount: number | Sets the counter to the specified `nextCount` value. |
4649
| `[1].reset` | | Resets the counter to the initial `startingValue`. |
50+
</div>
4751
</div>
4852

4953
<CodePreview

usehooks.com/src/content/hooks/useDebounce.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,20 @@ import StaticCodeContainer from "../../components/StaticCodeContainer.astro";
2525
<div class="reference">
2626
### Parameters
2727

28+
<div class="table-container">
2829
| Name | Type | Description |
2930
| ----- | ------ | ----------- |
3031
| value | any | The value that you want to debounce. This can be of any type. |
3132
| delay | number | The delay time in milliseconds. After this amount of time, the latest value is used. |
33+
</div>
3234

3335
### Return Values
3436

37+
<div class="table-container">
3538
| Name | Type | Description |
3639
| ------------- | ---- | ----------- |
3740
| debouncedValue| any | The debounced value. After the delay time has passed without the `value` changing, this will be updated to the latest `value`. |
41+
</div>
3842
</div>
3943

4044
<CodePreview

usehooks.com/src/content/hooks/useDefault.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,21 @@ import StaticCodeContainer from "../../components/StaticCodeContainer.astro";
2525
<div class="reference">
2626
### Parameters
2727

28+
<div class="table-container">
2829
| Name | Type | Description |
2930
| ------------ | -------- | ----------- |
3031
| initialValue | any | This is the initial state value provided when calling `useDefault`. |
3132
| defaultValue | any | The default value to be used if the state is `undefined` or `null`. |
33+
</div>
3234

3335
### Return Values
3436

37+
<div class="table-container">
3538
| Name | Type | Description |
3639
| -------- | --------------- | ----------- |
3740
| state | any | The current state. If the state is `undefined` or `null`, `defaultValue` is returned instead. |
3841
| setState | function | The state setter function returned from `React.useState()`. This can be called to update the state. |
42+
</div>
3943
</div>
4044

4145
<CodePreview

usehooks.com/src/content/hooks/useDocumentTitle.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ import StaticCodeContainer from "../../components/StaticCodeContainer.astro";
2323
<div class="reference">
2424
### Parameters
2525

26+
<div class="table-container">
2627
| Name | Type | Description |
2728
| ----- | ------ | ------------------------------------- |
2829
| title | string | The title to be set for the document. |
30+
</div>
2931
</div>
3032

3133
<CodePreview

usehooks.com/src/content/hooks/useEventListener.mdx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@ import StaticCodeContainer from "../../components/StaticCodeContainer.astro";
2525
<div class="reference">
2626
### Parameters
2727

28+
<div class="table-container">
2829
| Name | Type | Description |
2930
| --------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------- |
30-
| target | Ref or DOM element | The target element to attach the event listener to. It can be either a ref object (`ref.current`) or a DOM element. |
31-
| eventName | String | The name of the event to listen for. |
32-
| handler | Function | The event handler function to be executed when the event is triggered. |
33-
| options | Object | (Optional) Additional options for the event listener. |
34-
| options.capture | Boolean | Specifies whether the event should be captured during the capturing phase. Default is `false`. |
35-
| options.passive | Boolean | Specifies whether the event listener will not call `preventDefault()`. Default is `false`. |
36-
| options.once | Boolean | Specifies whether the event listener should only be invoked once. Default is `false`. |
31+
| target | ref or DOM element | The target element to attach the event listener to. It can be either a ref object (`ref.current`) or a DOM element. |
32+
| eventName | string | The name of the event to listen for. |
33+
| handler | function | The event handler function to be executed when the event is triggered. |
34+
| options | object | (Optional) Additional options for the event listener. |
35+
| options.capture | boolean | Specifies whether the event should be captured during the capturing phase. Default is `false`. |
36+
| options.passive | boolean | Specifies whether the event listener will not call `preventDefault()`. Default is `false`. |
37+
| options.once | boolean | Specifies whether the event listener should only be invoked once. Default is `false`. |
38+
</div>
3739
</div>
3840

3941
<CodePreview

0 commit comments

Comments
 (0)