@@ -37,13 +37,25 @@ export const PreviewDetails = ({
37
37
const bg = useMotionTemplate `rgba(0,0,0,${ bgOpacity } )` ;
38
38
const [ isMobile , setIsMobile ] = useState ( false ) ;
39
39
40
- const [ isSmallHeight , setIsSmallHeight ] = useState ( false ) ;
40
+ const [ isSmallHeight , setIsSmallHeight ] = useState ( false ) ;
41
+ const [ isSmallWidth , setIsSmallWidth ] = useState ( false ) ;
41
42
42
43
useEffect ( ( ) => {
43
44
const checkHeight = ( ) => setIsSmallHeight ( window . innerHeight <= 1020 ) ;
45
+ const checkWidth = ( ) => setIsSmallWidth ( window . innerWidth <= 760 ) ;
46
+
47
+ // run once on mount
44
48
checkHeight ( ) ;
49
+ checkWidth ( ) ;
50
+
51
+ // add resize listeners
45
52
window . addEventListener ( "resize" , checkHeight ) ;
46
- return ( ) => window . removeEventListener ( "resize" , checkHeight ) ;
53
+ window . addEventListener ( "resize" , checkWidth ) ;
54
+
55
+ return ( ) => {
56
+ window . removeEventListener ( "resize" , checkHeight ) ;
57
+ window . removeEventListener ( "resize" , checkWidth ) ;
58
+ } ;
47
59
} , [ ] ) ;
48
60
49
61
@@ -62,29 +74,32 @@ useEffect(() => {
62
74
>
63
75
< Magnetic intensity = { 0.1 } actionArea = "global" range = { 200 } >
64
76
< div
65
- style = { { maxHeight : "1020px" ,
66
- transform : isSmallHeight ? "scale(0.8)" : "" , } }
77
+ style = { { maxHeight : "1080px" ,
78
+ maxWidth : "760px" ,
79
+ transform : isSmallHeight || isSmallWidth ? "" : "scale(1)" , } }
67
80
className = "
68
81
max-[760px]:sticky max-[760px]:top-0
69
82
max-[760px]:overflow-y-scroll
70
83
71
84
h-full
72
-
85
+ max-[760px]:scale-[0.7]
73
86
max-[760px]:h-screen
74
-
75
- md:w-[450px]
87
+ lg:scale-100
88
+ xl:scale-100
89
+ 2xl:scale-100
90
+ md:w-[450px]
76
91
lg:w-[560px]
77
92
xl:w-[600px]
78
93
2xl:w-[640px]
79
94
w-full
80
95
mx-auto
81
- overflow-hidden bg-white mt-0 rounded-2xl shadow-md shadow-slate-200 max-[760px]:shadow-gray-400 border border-dashed max-[760px]:border-none justify-center items-center" >
96
+ overflow-hidden bg-white rounded-2xl shadow-md shadow-slate-200 max-[760px]:shadow-gray-400 border border-dashed max-[760px]:border-none justify-center items-center" >
82
97
83
98
{ /* Invoice Terms */ }
84
99
< HoverCard openDelay = { 0 } closeDelay = { 0 } >
85
100
< HoverCardTrigger > < InvoiceTermsPreview { ...invoiceTerms } onClick = { onClick } /> </ HoverCardTrigger >
86
101
< HoverCardContent
87
- side = "top "
102
+ side = "bottom "
88
103
align = "center"
89
104
className = "bg-black text-white text-xs w-fit pl-1.5 py-1.5 rounded-full shadow-lg flex items-center gap-2 font-medium animate-in fade-in-0 zoom-in-95 duration-100"
90
105
>
0 commit comments