File tree 2 files changed +52
-0
lines changed
2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 1
1
import { useFormAction , useNavigation } from '@remix-run/react'
2
+ import { useHydrated } from 'remix-utils/use-hydrated'
2
3
import { clsx , type ClassValue } from 'clsx'
3
4
import { useEffect , useMemo , useRef , useState } from 'react'
4
5
import { useSpinDelay } from 'spin-delay'
@@ -13,6 +14,33 @@ export function getNoteImgSrc(imageId: string) {
13
14
return `/resources/note-images/${ imageId } `
14
15
}
15
16
17
+ // credit: https://www.jacobparis.com/content/remix-progressive-client-only
18
+ export function ProgressiveClientOnly ( {
19
+ children,
20
+ className = '' ,
21
+ defaultShow = false ,
22
+ } : {
23
+ children : React . ReactNode | ( ( ) => React . ReactNode )
24
+ className ?: string
25
+ defaultShow ?: boolean
26
+ } ) {
27
+ const isHydrated = useHydrated ( )
28
+ return (
29
+ < div
30
+ className = {
31
+ isHydrated
32
+ ? className
33
+ : defaultShow
34
+ ? // Create these animations in CSS or your tailwind config
35
+ '[animation:disappear_1000ms]'
36
+ : '[animation:appear_1000ms]'
37
+ }
38
+ >
39
+ { typeof children === 'function' ? children ( ) : children }
40
+ </ div >
41
+ )
42
+ }
43
+
16
44
export function getErrorMessage ( error : unknown ) {
17
45
if ( typeof error === 'string' ) return error
18
46
if (
Original file line number Diff line number Diff line change @@ -25,6 +25,30 @@ export const marketingPreset = {
25
25
'slide-left' : 'slide-left 0.3s ease-out' ,
26
26
'slide-top' : 'slide-top 0.3s ease-out' ,
27
27
} ,
28
+ appear : {
29
+ "0%, 99%" : {
30
+ height : "0" ,
31
+ width : "0" ,
32
+ opacity : "0" ,
33
+ } ,
34
+ "100%" : {
35
+ height : "auto" ,
36
+ width : "auto" ,
37
+ opacity : "1" ,
38
+ } ,
39
+ } ,
40
+ disappear : {
41
+ "0%, 99%" : {
42
+ height : "auto" ,
43
+ width : "auto" ,
44
+ opacity : "1" ,
45
+ } ,
46
+ "100%" : {
47
+ height : "0" ,
48
+ width : "0" ,
49
+ opacity : "0" ,
50
+ } ,
51
+ } ,
28
52
} ,
29
53
} ,
30
54
} satisfies Omit < Config , 'content' >
You can’t perform that action at this time.
0 commit comments