1
+ import React , { useState } from 'react' ;
2
+ import clsx from 'clsx' ;
3
+ import Link from '@docusaurus/Link' ;
4
+ import Heading from '@theme/Heading' ;
5
+ import { useColorMode } from '@docusaurus/theme-common' ;
6
+ import CutOffCorners from '@site/src/components/elements/cut-off-corners' ;
7
+ import Button from '@site/src/components/elements/buttons/button' ;
8
+ import SvgStar from '@site/static/img/icons/star.svg' ;
9
+ import Shape from '@site/static/img/shapes/intro-cards/shape.svg' ;
10
+ import styles from './NavigationOverlay.module.css' ;
11
+ import {
12
+ METAMASK_SDK ,
13
+ EMBEDDED_WALLETS ,
14
+ DELEGATION_TOOLKIT
15
+ } from '../builder/choices' ;
16
+
17
+ interface NavigationOption {
18
+ id : string ;
19
+ title : string ;
20
+ description : string ;
21
+ icon ?: string ;
22
+ product : string ;
23
+ }
24
+
25
+ interface NavigationFlowProps {
26
+ onSelect : ( product : string ) => void ;
27
+ }
28
+
29
+ const navigationOptions : NavigationOption [ ] = [
30
+ {
31
+ id : 'connect-wallets' ,
32
+ title : "I want to connect users' wallets to my dApp" ,
33
+ description : "Enable wallet connections for Web3 interactions" ,
34
+ icon : "🔗" ,
35
+ product : METAMASK_SDK
36
+ } ,
37
+ {
38
+ id : 'create-wallets' ,
39
+ title : "I want to create wallets inside my application" ,
40
+ description : "Embed wallet functionality directly in your app" ,
41
+ icon : "💳" ,
42
+ product : EMBEDDED_WALLETS
43
+ } ,
44
+ {
45
+ id : 'gasless-transactions' ,
46
+ title : "I want to manage gasless transactions" ,
47
+ description : "Handle transaction fees for your users" ,
48
+ icon : "⚡" ,
49
+ product : DELEGATION_TOOLKIT
50
+ }
51
+ ] ;
52
+
53
+ const NavigationFlow : React . FC < NavigationFlowProps > = ( { onSelect } ) => {
54
+ const { colorMode } = useColorMode ( ) ;
55
+ const [ hoveredCard , setHoveredCard ] = useState < string | null > ( null ) ;
56
+
57
+ const handleOptionSelect = ( option : NavigationOption ) => {
58
+ onSelect ( option . product ) ;
59
+ } ;
60
+
61
+ return (
62
+ < div className = { styles . flowContainer } >
63
+ < div className = { styles . stepHeader } >
64
+ < Heading as = "h2" className = { styles . sectionTitle } > What would you like to do?</ Heading >
65
+ < p className = { styles . sectionDescription } > Choose the option that best describes your project goals:</ p >
66
+ </ div >
67
+
68
+ < div className = { styles . cardsWrapper } >
69
+ { navigationOptions . map ( ( option ) => (
70
+ < div key = { option . id } className = { styles . cardColumn } >
71
+ < div
72
+ className = { clsx ( styles . cardItem , hoveredCard === option . id && styles . cardActive ) }
73
+ style = { { '--color-palette' : 'var(--developer-purple)' } as React . CSSProperties }
74
+ >
75
+ < CutOffCorners size = "s" >
76
+ < div
77
+ className = { styles . cardHolder }
78
+ onMouseEnter = { ( ) => setHoveredCard ( option . id ) }
79
+ onMouseLeave = { ( ) => setHoveredCard ( null ) }
80
+ onClick = { ( ) => handleOptionSelect ( option ) }
81
+ >
82
+ < div className = { styles . cardInner } >
83
+ < Shape className = { styles . cardShape } />
84
+
85
+ < div className = { styles . cardHeader } >
86
+ < SvgStar className = { styles . cardIcon } />
87
+ < Heading as = "h3" className = { styles . cardTitle } >
88
+ { option . title }
89
+ </ Heading >
90
+ </ div >
91
+
92
+ < div className = { styles . cardFooter } >
93
+ < p className = { styles . cardDescription } >
94
+ { option . description }
95
+ </ p >
96
+ < Button
97
+ as = "button"
98
+ label = { false }
99
+ type = { colorMode === 'dark' ? 'secondary' : 'primary' }
100
+ icon = "arrow-right"
101
+ className = { styles . cardButton }
102
+ />
103
+ </ div >
104
+ </ div >
105
+ </ div >
106
+ </ CutOffCorners >
107
+ </ div >
108
+ </ div >
109
+ ) ) }
110
+ </ div >
111
+
112
+ < div className = { styles . quickLinks } >
113
+ < Heading as = "h4" className = { styles . quickLinksTitle } > Quick Links</ Heading >
114
+ < div className = { styles . linkGrid } >
115
+ < Link href = "/sdk" className = { styles . quickLink } >
116
+ 📖 MetaMask SDK Documentation
117
+ </ Link >
118
+ < Link href = "/wallet" className = { styles . quickLink } >
119
+ 💳 Embedded Wallets Guide
120
+ </ Link >
121
+ < Link href = "/delegation-toolkit" className = { styles . quickLink } >
122
+ ⚡ Delegation Toolkit Docs
123
+ </ Link >
124
+ </ div >
125
+ </ div >
126
+ </ div >
127
+ ) ;
128
+ } ;
129
+
130
+ export default NavigationFlow ;
0 commit comments