1
- import {
2
- $ ,
3
- PropsOf ,
4
- component$ ,
5
- useComputed$ ,
6
- useSignal ,
7
- useStyles$ ,
8
- } from '@builder.io/qwik' ;
9
- import { Modal } from '@qwik-ui/headless' ;
10
- import { Button } from '~/components/ui' ;
1
+ import { $ , PropsOf , component$ , useComputed$ } from '@builder.io/qwik' ;
2
+ import { Modal , Button , buttonVariants } from '~/components/ui' ;
11
3
import {
12
4
ThemeBaseColor ,
13
5
ThemeBorderRadius ,
@@ -25,69 +17,6 @@ import CopyCssConfig from '../copy-css-config/copy-css-config';
25
17
import { useAppState } from '~/_state/use-app-state' ;
26
18
27
19
export default component$ < PropsOf < typeof Button > > ( ( ) => {
28
- useStyles$ ( `
29
- .make-it-yours::backdrop {
30
- background: rgba(0,0,0,0.05);
31
- }
32
-
33
- .make-it-yours {
34
- animation: sheetOpen 0.75s forwards cubic-bezier(0.6, 0.6, 0, 1);
35
- }
36
-
37
- .make-it-yours::backdrop {
38
- animation: sheetFadeIn 0.75s forwards cubic-bezier(0.6, 0.6, 0, 1);
39
- }
40
-
41
- .make-it-yours.modal-closing {
42
- animation: sheetClose 0.35s forwards cubic-bezier(0.6, 0.6, 0, 1);
43
- }
44
-
45
- .make-it-yours.modal-closing::backdrop {
46
- animation: sheetFadeOut 0.35s forwards cubic-bezier(0.6, 0.6, 0, 1);
47
- }
48
-
49
- @keyframes sheetOpen {
50
- from {
51
- opacity: 0;
52
- transform: translateX(100%);
53
- }
54
- to {
55
- opacity: 1;
56
- transform: translateX(0%);
57
- }
58
- }
59
-
60
- @keyframes sheetClose {
61
- from {
62
- opacity: 1;
63
- transform: translateX(0%);
64
- }
65
- to {
66
- opacity: 0;
67
- transform: translateX(100%);
68
- }
69
- }
70
-
71
- @keyframes sheetFadeIn {
72
- from {
73
- opacity: 0;
74
- }
75
- to {
76
- opacity: 1;
77
- }
78
- }
79
-
80
- @keyframes sheetFadeOut {
81
- from {
82
- opacity: 1;
83
- }
84
- to {
85
- opacity: 0;
86
- }
87
- }
88
- ` ) ;
89
-
90
- const showSig = useSignal ( false ) ;
91
20
const rootStore = useAppState ( ) ;
92
21
93
22
const { theme, setTheme } = useTheme ( ) ;
@@ -132,19 +61,17 @@ export default component$<PropsOf<typeof Button>>(() => {
132
61
return [ font , mode , style , baseColor , primaryColor , borderRadius ] . join ( ' ' ) ;
133
62
} ) ;
134
63
return (
135
- < Modal . Root closeOnBackdropClick = { false } bind :show = { showSig } >
136
- < Button
137
- size = "sm"
138
- look = "outline"
139
- class = "flex sm:mr-2 sm:h-10"
140
- onClick$ = { ( ) => {
141
- showSig . value = true ;
142
- } }
64
+ < Modal . Root >
65
+ < Modal . Trigger
66
+ class = { cn (
67
+ buttonVariants ( { size : 'sm' , look : 'outline' } ) ,
68
+ 'flex sm:mr-2 sm:h-10' ,
69
+ ) }
143
70
>
144
71
< LuSlidersHorizontal class = { cn ( 'h-4 w-4 sm:mr-2' ) } />
145
72
< span class = { cn ( 'hidden' , 'sm:block' ) } > Make it yours</ span >
146
- </ Button >
147
- < Modal . Panel class = "make-it-yours fixed bottom-[50%] right-0 top-[50%] mr-0 h-screen max-w-sm rounded-l-base border-y border-l bg-background px-4 py-8 text-foreground shadow-md sm:w-full" >
73
+ </ Modal . Trigger >
74
+ < Modal . Panel class = "fixed right-0 mr-0 h-screen max-w-sm rounded-none rounded- l-base border-y border-l data-[closing]:slide-out-to-right data-[open]:slide-in-from-right sm:w-full" >
148
75
< header class = "flex w-full" >
149
76
< h2 class = "justify-self-start text-lg font-bold" > Edit Profile</ h2 >
150
77
</ header >
@@ -550,9 +477,11 @@ export default component$<PropsOf<typeof Button>>(() => {
550
477
</ Button >
551
478
< CopyCssConfig />
552
479
</ footer >
553
- < button onClick$ = { ( ) => ( showSig . value = false ) } class = "absolute right-4 top-5" >
480
+ < Modal . Close
481
+ class = { cn ( buttonVariants ( { size : 'sm' , look : 'link' } ) , 'fixed right-4 top-5' ) }
482
+ >
554
483
< LuX class = "h-8 w-8" />
555
- </ button >
484
+ </ Modal . Close >
556
485
</ Modal . Panel >
557
486
</ Modal . Root >
558
487
) ;
0 commit comments