File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ import { useState } from '#imports'
2+
3+ // Types
4+ export interface Dialog {
5+ show : boolean
6+ title : string
7+ message : string
8+ action : {
9+ function : ( ) => Promise < void >
10+ buttonText : string
11+ buttonColor : string
12+ }
13+ closeButtonText : string
14+ }
15+
16+ export const dialogInitialState = < Dialog > {
17+ show : false ,
18+ title : '' ,
19+ message : '' ,
20+ action : {
21+ function : ( ) => new Promise < void > ( resolve => resolve ( ) ) ,
22+ buttonText : '' ,
23+ buttonColor : '' ,
24+ } ,
25+ closeButtonText : 'Cancel' ,
26+ }
27+
28+ export const useDialog = ( ) =>
29+ useState ( 'dialog' , ( ) => {
30+ return dialogInitialState
31+ } )
Original file line number Diff line number Diff line change 1+ import { ref , useState } from '#imports'
2+
3+ // App
4+ export const useErrorMessage = ( ) => useState ( 'errorMessage' , ( ) => '' )
5+ export const useToast = ( ) =>
6+ useState ( 'toast' , ( ) =>
7+ ref ( {
8+ show : false ,
9+ message : '' ,
10+ } ) ,
11+ )
You can’t perform that action at this time.
0 commit comments