File tree 2 files changed +45
-5
lines changed
2 files changed +45
-5
lines changed Original file line number Diff line number Diff line change 1
1
'use client' ;
2
- import { useMemo } from 'react' ;
2
+ import { useEffect , useMemo } from 'react' ;
3
3
import { SolidButton } from 'src/components/buttons/SolidButton' ;
4
4
import { Card } from 'src/components/layout/Card' ;
5
5
import { Section } from 'src/components/layout/Section' ;
6
+ import { Modal , useModal } from 'src/components/menus/Modal' ;
6
7
import { Amount } from 'src/components/numbers/Amount' ;
7
8
import { ValidatorGroupTable } from 'src/features/validators/ValidatorGroupTable' ;
8
9
import { ValidatorGroup , ValidatorStatus } from 'src/features/validators/types' ;
@@ -11,11 +12,20 @@ import { bigIntMin } from 'src/utils/math';
11
12
12
13
export default function Index ( ) {
13
14
const { groups, totalVotes } = useValidatorGroups ( ) ;
15
+ const showModal = useModal ( 'stake' ) ;
16
+ useEffect ( ( ) => {
17
+ setTimeout ( ( ) => {
18
+ showModal ( ) ;
19
+ } , 5000 ) ;
20
+ } , [ showModal ] ) ;
14
21
return (
15
- < div className = "space-y-8" >
16
- < HeroSection totalVotes = { totalVotes } groups = { groups } />
17
- < ListSection totalVotes = { totalVotes } groups = { groups } />
18
- </ div >
22
+ < >
23
+ < div className = "space-y-8" >
24
+ < HeroSection totalVotes = { totalVotes } groups = { groups } />
25
+ < ListSection totalVotes = { totalVotes } groups = { groups } />
26
+ </ div >
27
+ < Modal id = "stake" > Test</ Modal >
28
+ </ >
19
29
) ;
20
30
}
21
31
Original file line number Diff line number Diff line change
1
+ import { PropsWithChildren } from 'react' ;
2
+
3
+ export function useModal ( id : string ) {
4
+ return ( ) => {
5
+ const dialog = document . getElementById ( id ) as HTMLDialogElement ;
6
+ dialog ?. showModal ( ) ;
7
+ } ;
8
+ }
9
+
10
+ export function Modal ( {
11
+ id,
12
+ className,
13
+ children,
14
+ } : PropsWithChildren < { id : string ; className ?: string } > ) {
15
+ return (
16
+ < dialog id = { id } className = "modal modal-bottom sm:modal-middle" >
17
+ < div className = { `modal-box ${ className } ` } >
18
+ < form method = "dialog" >
19
+ < button className = "btn btn-circle btn-ghost btn-sm absolute right-2 top-2 outline-none" >
20
+ ✕
21
+ </ button >
22
+ </ form >
23
+ { children }
24
+ </ div >
25
+ < form method = "dialog" className = "modal-backdrop" >
26
+ < button > close</ button >
27
+ </ form >
28
+ </ dialog >
29
+ ) ;
30
+ }
You can’t perform that action at this time.
0 commit comments