Skip to content

Commit 2064068

Browse files
committed
main 🧊 add new hooks
1 parent d44706a commit 2064068

12 files changed

Lines changed: 46 additions & 43 deletions

File tree

packages/newdocs/content/functions/hooks/useField.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ usage: medium
66
type: hook
77
isTest: true
88
isDemo: true
9-
lastModifiedTime: 1780662926000
9+
lastModifiedTime: 1783690580000
1010
---
1111

1212
import metadata from './useField.meta.json';

packages/newdocs/content/functions/hooks/useField.meta.json

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

packages/newdocs/content/functions/hooks/useForm.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ description: Hook to manage a form
44
category: state
55
usage: medium
66
type: hook
7-
isTest: false
7+
isTest: true
88
isDemo: true
9-
lastModifiedTime: 1783684565236
9+
lastModifiedTime: 1783690580000
1010
---
1111

1212
import metadata from './useForm.meta.json';

packages/newdocs/content/functions/hooks/useForm.meta.json

Lines changed: 12 additions & 8 deletions
Large diffs are not rendered by default.

packages/newdocs/content/functions/hooks/useNotification.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ usage: medium
66
type: hook
77
isTest: true
88
isDemo: true
9-
lastModifiedTime: 1783666924000
9+
lastModifiedTime: 1783690580000
1010
---
1111

1212
import metadata from './useNotification.meta.json';
@@ -47,7 +47,7 @@ import metadata from './useNotification.meta.json';
4747
## Usage
4848

4949
```tsx
50-
const { supported, granted, notification, trigger, show, close } = useNotification();
50+
const { supported, notification, trigger, show, close } = useNotification();
5151
```
5252

5353
## Type Declarations

packages/newdocs/content/functions/hooks/useNotification.meta.json

Lines changed: 10 additions & 12 deletions
Large diffs are not rendered by default.

packages/newdocs/generated/demos/hooks/useNotification.demo.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { useNotification } from '@siberiacancode/reactuse';
3+
import { useNotification, usePermission } from '@siberiacancode/reactuse';
44
import { BellIcon, CheckIcon } from 'lucide-react';
55

66
const NOTIFICATION = {
@@ -12,6 +12,7 @@ const NOTIFICATION = {
1212

1313
const Demo = () => {
1414
const notification = useNotification();
15+
const permission = usePermission('notifications');
1516

1617
const onSubscribe = async () => {
1718
const granted = await notification.trigger();
@@ -55,7 +56,7 @@ const Demo = () => {
5556
</div>
5657
</div>
5758

58-
{notification.granted === 'granted' && (
59+
{permission.state === 'granted' && (
5960
<div className='flex w-full flex-col items-center gap-3'>
6061
<div className='border-border text-foreground flex w-full items-center justify-center gap-2 rounded-full border py-2.5 text-sm font-medium'>
6162
<CheckIcon className='text-primary size-4' />
@@ -73,13 +74,13 @@ const Demo = () => {
7374
</div>
7475
)}
7576

76-
{notification.granted === 'prompt' && (
77+
{permission.state === 'prompt' && (
7778
<button className='w-full rounded-full!' type='button' onClick={onSubscribe}>
7879
Subscribe
7980
</button>
8081
)}
8182

82-
{notification.granted === 'denied' && (
83+
{permission.state === 'denied' && (
8384
<p className='text-muted-foreground text-center text-xs leading-relaxed'>
8485
Notifications are turned off. You can enable them again from your browser settings.
8586
</p>

packages/newdocs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
"dependencies": {
4545
"@siberiacancode/fetches": "^1.14.3",
46-
"@siberiacancode/reactuse": "^1.0.8",
46+
"@siberiacancode/reactuse": "^1.0.9",
4747
"@types/mdx": "^2.0.14",
4848
"@webcam/react": "^1.1.0",
4949
"algoliasearch": "^5.55.0",

packages/newdocs/public/functions/hooks/useField.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ usage: medium
66
type: hook
77
isTest: true
88
isDemo: true
9-
lastModifiedTime: 1780662926000
9+
lastModifiedTime: 1783690580000
1010
---
1111

1212
import metadata from './useField.meta.json';

packages/newdocs/public/functions/hooks/useForm.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ description: Hook to manage a form
44
category: state
55
usage: medium
66
type: hook
7-
isTest: false
7+
isTest: true
88
isDemo: true
9-
lastModifiedTime: 1783684565236
9+
lastModifiedTime: 1783690580000
1010
---
1111

1212
import metadata from './useForm.meta.json';

0 commit comments

Comments
 (0)