Skip to content

Commit 1c6f6e2

Browse files
committed
main 🧊 update demos and sidebars
1 parent aeffaff commit 1c6f6e2

38 files changed

Lines changed: 715 additions & 449 deletions

β€Žpackages/core/src/hooks/useAudio/useAudio.demo.tsxβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const Demo = () => {
9797
<section className='flex flex-col items-center gap-5 p-4'>
9898
<svg className='w-64' viewBox={`0 0 ${BOARD_SIZE} ${BOARD_SIZE}`}>
9999
{[CELL_SIZE, CELL_SIZE * 2].map((position) => (
100-
<g key={position} className='text-border'>
100+
<g key={position} className='text-muted-foreground'>
101101
<line
102102
stroke='currentColor'
103103
strokeLinecap='round'
@@ -189,7 +189,7 @@ const Demo = () => {
189189
))}
190190
</svg>
191191

192-
<div className='flex items-center gap-3 text-sm'>
192+
<div className='flex min-h-9 items-center gap-3 text-sm'>
193193
{!result && (
194194
<p className='text-muted-foreground flex items-center gap-1.5'>
195195
<PlayerIcon player={current} /> to move

β€Žpackages/core/src/hooks/useBrowserLocation/useBrowserLocation.demo.tsxβ€Ž

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,32 +69,33 @@ const Demo = () => {
6969
const isSelected = selectedMethod === method.id;
7070

7171
return (
72-
<div
72+
<label
7373
key={method.id}
74-
className='hover:bg-muted/50 data-[selected=true]:border-primary data-[selected=true]:bg-muted/50 flex cursor-pointer items-center gap-3 rounded-xl border p-4 text-left transition-colors'
75-
data-selected={isSelected}
76-
role='button'
77-
tabIndex={0}
78-
onClick={() => onPaymentMethodChange(method.id)}
74+
className='border-border hover:bg-muted/50 has-[:checked]:border-foreground/30 has-[:checked]:bg-muted/50 relative flex cursor-pointer items-center gap-3 rounded-xl border p-4 text-left transition-colors'
7975
>
80-
<div className='flex size-10 items-center justify-center rounded-full border'>
76+
<input
77+
checked={isSelected}
78+
className='absolute! top-4 right-4'
79+
name='method'
80+
type='radio'
81+
onChange={() => onPaymentMethodChange(method.id)}
82+
/>
83+
84+
<div className='bg-card flex size-10 items-center justify-center rounded-full border'>
8185
<Icon className='size-4' />
8286
</div>
8387

8488
<span className='flex flex-1 flex-col gap-1'>
8589
<span className='text-sm'>{method.title}</span>
8690
<span className='text-muted-foreground text-xs'>{method.description}</span>
8791
</span>
88-
89-
{isSelected && <CheckIcon className='size-4' />}
90-
</div>
92+
</label>
9193
);
9294
})}
9395
</div>
9496

9597
<div className='relative'>
9698
<AtSignIcon className='pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 opacity-50' />
97-
9899
<input
99100
className='pl-8!'
100101
placeholder='you@example.com'

β€Žpackages/core/src/hooks/useDropZone/useDropZone.demo.tsxβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const Demo = () => {
119119
<div className='flex min-w-0 flex-1 flex-col leading-tight'>
120120
<span className='truncate text-xs font-medium text-white'>{file.name}</span>
121121
<span className='text-[10px] text-white/70 tabular-nums'>
122-
{formatSize(file.size)} Β· {file.type.replace('image/', '').toUpperCase()}
122+
{formatSize(file.size)} - {file.type.replace('image/', '').toUpperCase()}
123123
</span>
124124
</div>
125125
</div>
@@ -128,12 +128,12 @@ const Demo = () => {
128128
<button
129129
aria-label='Remove'
130130
className='absolute top-2 right-2'
131-
data-size='icon-sm'
131+
data-size='icon'
132132
data-variant='secondary'
133133
type='button'
134134
onClick={onRemove}
135135
>
136-
<XIcon className='size-3.5' />
136+
<XIcon className='size-4' />
137137
</button>
138138
</div>
139139
)}

β€Žpackages/core/src/hooks/useFavicon/useFavicon.demo.tsxβ€Ž

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,6 @@ const Demo = () => {
5050
);
5151
})}
5252
</div>
53-
54-
<div className='border-border bg-muted/30 flex items-center gap-2 rounded-lg border px-3 py-2'>
55-
<img
56-
alt='Current favicon'
57-
className='size-4 shrink-0 object-contain'
58-
src={favicon.href ?? FAVICONS[0].url}
59-
/>
60-
<span className='text-muted-foreground truncate font-mono text-[10px]'>
61-
{favicon.href ?? 'default'}
62-
</span>
63-
</div>
6453
</section>
6554
);
6655
};

β€Žpackages/core/src/hooks/useFocusTrap/useFocusTrap.demo.tsxβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { SubmitEvent } from 'react';
22

33
import { useField, useFocusTrap } from '@siberiacancode/reactuse';
4-
import { ChevronDownIcon, MailIcon, XIcon } from 'lucide-react';
4+
import { AtSignIcon, ChevronDownIcon, XIcon } from 'lucide-react';
55

66
const ROLES = [
77
{ value: 'viewer', label: 'Viewer' },
@@ -51,7 +51,7 @@ const Demo = () => {
5151
Email
5252
</label>
5353
<div className='relative'>
54-
<MailIcon className='text-muted-foreground pointer-events-none absolute top-1/2 left-3 z-10 size-3.5 -translate-y-1/2' />
54+
<AtSignIcon className='text-muted-foreground pointer-events-none absolute top-1/2 left-3 z-10 size-4 -translate-y-1/2' />
5555
<input
5656
data-autofocus
5757
className='pl-9!'

β€Žpackages/core/src/hooks/useKeyPress/useKeyPress.demo.tsxβ€Ž

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useAsync, useKeyPress } from '@siberiacancode/reactuse';
2-
import { ChevronLeftIcon, ChevronRightIcon, Loader2Icon } from 'lucide-react';
2+
import { HeartIcon, Loader2Icon, XIcon } from 'lucide-react';
33
import { useState } from 'react';
44

55
interface Pokemon {
@@ -27,7 +27,6 @@ const fetchPokemon = async (id: number) => {
2727

2828
const Demo = () => {
2929
const [id, setId] = useState(randomId);
30-
3130
const pokemonAsync = useAsync(() => fetchPokemon(id), [id]);
3231

3332
const onNext = () => setId(randomId());
@@ -43,8 +42,8 @@ const Demo = () => {
4342
const loading = !pokemonAsync.data;
4443

4544
return (
46-
<section className='flex w-full max-w-xs flex-col items-center gap-3 p-4'>
47-
<div className='border-border bg-card relative h-[370px] w-full overflow-hidden rounded-2xl border shadow-lg'>
45+
<section className='flex w-full max-w-[280px] flex-col items-center gap-3 p-4'>
46+
<div className='border-border bg-card relative aspect-[3/4] w-full overflow-hidden rounded-2xl border shadow-lg'>
4847
<div className='absolute inset-0 flex items-center justify-center'>
4948
{loading && <Loader2Icon className='text-muted-foreground size-8 animate-spin' />}
5049
{!loading && pokemonAsync.data && (
@@ -88,32 +87,30 @@ const Demo = () => {
8887
))}
8988
</div>
9089
</div>
90+
91+
<button
92+
aria-label='Pass'
93+
className='absolute bottom-4 left-4 flex size-11 items-center justify-center rounded-full bg-white text-neutral-900 shadow-lg transition-transform hover:scale-110'
94+
data-variant='unstyled'
95+
type='button'
96+
onClick={onNext}
97+
>
98+
<XIcon className='size-5' strokeWidth={2.5} />
99+
</button>
100+
101+
<button
102+
aria-label='Like'
103+
className='text-destructive absolute right-4 bottom-4 flex size-11 items-center justify-center rounded-full bg-white shadow-lg transition-transform hover:scale-110'
104+
data-variant='unstyled'
105+
type='button'
106+
onClick={onNext}
107+
>
108+
<HeartIcon className='size-5' fill='currentColor' />
109+
</button>
91110
</>
92111
)}
93112
</div>
94113

95-
<div className='flex w-full items-stretch gap-2'>
96-
<button
97-
aria-label='Pass'
98-
className='flex-1'
99-
data-variant='secondary'
100-
type='button'
101-
onClick={onNext}
102-
>
103-
<ChevronLeftIcon className='size-5' />
104-
</button>
105-
106-
<button
107-
aria-label='Like'
108-
className='flex-1'
109-
data-variant='secondary'
110-
type='button'
111-
onClick={onNext}
112-
>
113-
<ChevronRightIcon className='size-5' />
114-
</button>
115-
</div>
116-
117114
<span className='text-muted-foreground text-[10px]'>Use ← β†’ keys to swipe</span>
118115
</section>
119116
);

β€Žpackages/core/src/hooks/useLogger/useLogger.demo.tsxβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ const Demo = () => {
4949

5050
return (
5151
<section className='flex w-full max-w-md flex-col gap-3 p-4'>
52-
<div className='border-border bg-card flex h-[220px] flex-col rounded-lg border shadow-sm'>
53-
<div className='border-border flex items-center justify-between border-b px-3 py-2'>
52+
<div className='bg-muted/20 flex h-[220px] flex-col rounded-lg'>
53+
<div className='flex items-center justify-between px-1 py-2'>
5454
<span className='text-foreground text-[10px] font-semibold tracking-wider uppercase'>
5555
Console
5656
</span>
@@ -70,7 +70,7 @@ const Demo = () => {
7070
</div>
7171
</div>
7272

73-
<div ref={scrollRef} className='no-scrollbar flex-1 overflow-y-auto px-3 py-2'>
73+
<div ref={scrollRef} className='no-scrollbar flex-1 overflow-y-auto px-1 py-2'>
7474
{logs.map((entry) => (
7575
<div
7676
key={entry.id}

0 commit comments

Comments
Β (0)